no message
This commit is contained in:
@@ -72,10 +72,10 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
}
|
||||
}
|
||||
public String getPluralDescription() {
|
||||
protected String getPluralDescription() {
|
||||
return "";
|
||||
}
|
||||
public String getSingleDescription() {
|
||||
protected String getSingleDescription() {
|
||||
return "";
|
||||
}
|
||||
<M> Vector<M> getFilters(Class<M> f) {
|
||||
@@ -88,7 +88,7 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public void AddFilter(DBObjectFilter_<D> filter_in) {
|
||||
protected void AddFilter(DBObjectFilter_<D> filter_in) {
|
||||
allFilters.add(filter_in);
|
||||
}
|
||||
public ColumnInfo getColumnInfo(int i) {
|
||||
@@ -98,11 +98,11 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
protected String[] getUIColumnNames() {
|
||||
return new String[]{};
|
||||
}
|
||||
public Object getFieldAt(D object, int coulmnIndex) {
|
||||
public Object getFieldAt(D object, int columnIndex) {
|
||||
return null;
|
||||
}
|
||||
//-
|
||||
public void SaveColumns() {
|
||||
void SaveColumns() {
|
||||
if (MainModule_.instance.getDb() != null) {
|
||||
try {
|
||||
if (CurrentName() != null) {
|
||||
@@ -124,10 +124,10 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
}
|
||||
}
|
||||
private Vector<String> getHeaders() {
|
||||
Vector<String> getHeaders() {
|
||||
return columns.stream().map(ColumnInfo::getName).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
protected void CreateColumnsInfo() {
|
||||
void CreateColumnsInfo() {
|
||||
columns.clear();
|
||||
columns.add(new ColumnInfo(dataSource.getPKName()));
|
||||
if (hasCheckBox()) {
|
||||
@@ -144,9 +144,6 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
protected Comparator getDefaultComparator() {
|
||||
return null;
|
||||
}
|
||||
public boolean isObjectVisible(D object) {
|
||||
return ApplyFilters(object);
|
||||
}
|
||||
Vector<Object> getVisibleKeys() {
|
||||
Comparator comparator = getDefaultComparator();
|
||||
Vector<Object> res_keys = new Vector<>();
|
||||
@@ -167,7 +164,6 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
return res_keys;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
protected void createControl() {
|
||||
CreateColumnsInfo();
|
||||
@@ -350,7 +346,7 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
protected void createFilters() {
|
||||
}
|
||||
protected boolean ApplyFilters(D object) {
|
||||
boolean ApplyFilters(D object) {
|
||||
for (DBObjectFilter_ filterInterface : allFilters) {
|
||||
if (!filterInterface.Validate(object))
|
||||
return false;
|
||||
@@ -361,40 +357,7 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
protected void redrawControl() {
|
||||
control.CorrectSizes();
|
||||
}
|
||||
@Override
|
||||
public void Show() {
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.DropMatchesCount();
|
||||
super.Show();
|
||||
if (counter_ui != null) counter_ui.ShowMatchesCount(getRowCount());
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.ShowMatchesCount();
|
||||
}
|
||||
public void Show(Object pk) {
|
||||
Show();
|
||||
SetCurrentByPK(pk);
|
||||
}
|
||||
public void SetCurrentByPK(Object pk) {
|
||||
if (isShown())
|
||||
control.SelectRowByPK(pk);
|
||||
}
|
||||
public void ClearSelection() {
|
||||
if (isShown()) control.clearSelection(); //строка сбросится сама. благодаря сбросу события выбора
|
||||
}
|
||||
public void SelectAll(boolean flag) {
|
||||
for (D object : dataSource.Data.values()) {
|
||||
if (isObjectVisible(object))
|
||||
object.Select(flag);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
@Override
|
||||
public void Clear() {
|
||||
super.Clear();
|
||||
if (counter_ui != null) counter_ui.ShowNoMatches();
|
||||
}
|
||||
public int getRowCount() {
|
||||
return control.getRowCount();
|
||||
}
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
protected void ShowCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
@@ -409,7 +372,7 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
}
|
||||
}
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
protected void ShowNoCurrentObject() throws Exception {
|
||||
if (dataSource instanceof DBTable) {
|
||||
DBTable table = (DBTable) dataSource;
|
||||
for (Class dep : table.getFKDependencies().keySet()) {
|
||||
@@ -424,16 +387,50 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
}
|
||||
}
|
||||
public void MouseAction2() throws Exception {
|
||||
protected void MouseAction2() throws Exception {
|
||||
}
|
||||
//-
|
||||
public boolean hasCheckBox() {
|
||||
protected boolean hasCheckBox() {
|
||||
return false;
|
||||
}
|
||||
public boolean hasMenuBar() {
|
||||
protected boolean hasMenuBar() {
|
||||
return true;
|
||||
}
|
||||
//-found
|
||||
//-
|
||||
protected Current_ CurrentName() {
|
||||
return null;
|
||||
}
|
||||
void dropCurrent() {
|
||||
MainModule_.instance.set(CurrentName(), null);
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
protected DBObjectDialog getDialog() {
|
||||
return null;
|
||||
}
|
||||
protected boolean isObjectEditable(D object) {
|
||||
return true;
|
||||
}
|
||||
//БАЗОВЫЙ ФУНКЦИОНАЛ ФОРМЫ
|
||||
@Override
|
||||
public void Show() {
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.DropMatchesCount();
|
||||
super.Show();
|
||||
if (counter_ui != null) counter_ui.ShowMatchesCount(getRowCount());
|
||||
for (DBObjectFilter_ filter_ : allFilters) filter_.ShowMatchesCount();
|
||||
}
|
||||
public void Show(Object pk) {
|
||||
Show();
|
||||
SetCurrentByPK(pk);
|
||||
}
|
||||
@Override
|
||||
public void Clear() {
|
||||
super.Clear();
|
||||
if (counter_ui != null) counter_ui.ShowNoMatches();
|
||||
}
|
||||
public int getRowCount() {
|
||||
return control.getRowCount();
|
||||
}
|
||||
//ТЕКУЩИЕ И ВЫБРАННЫЕ ОБЪЕКТЫ
|
||||
public void SaveLastCurrent() {
|
||||
savedCurrentKey = null;
|
||||
savedSelectedKeys.clear();
|
||||
@@ -451,6 +448,9 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
SetCurrentByPK(savedCurrentKey);
|
||||
}
|
||||
}
|
||||
public boolean isObjectVisible(D object) {
|
||||
return ApplyFilters(object);
|
||||
}
|
||||
public int getSelectedCount() {
|
||||
return (int) dataSource.Data.values().stream().filter(d -> isObjectVisible(d) && d.isSelected()).count();
|
||||
}
|
||||
@@ -460,10 +460,6 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
public Vector<Object> getSelectedKeys() {
|
||||
return dataSource.Data.values().stream().filter(DBObject::isSelected).map(d -> d.getPK()).collect(Collectors.toCollection(Vector::new));
|
||||
}
|
||||
//--
|
||||
public Current_ CurrentName() {
|
||||
return null;
|
||||
}
|
||||
public boolean CheckCurrent(TextLog log) {
|
||||
return MainModule_.instance.Check(log, CurrentName());
|
||||
}
|
||||
@@ -475,9 +471,6 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
return true;
|
||||
}
|
||||
public void dropCurrent() {
|
||||
MainModule_.instance.set(CurrentName(), null);
|
||||
}
|
||||
public D getCurrent() {
|
||||
return (D) MainModule_.instance.get(CurrentName());
|
||||
}
|
||||
@@ -503,25 +496,36 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public DBObjectDialog getDialog() {
|
||||
return null;
|
||||
public void SetCurrentByPK(Object pk) {
|
||||
if (isShown())
|
||||
control.SelectRowByPK(pk);
|
||||
}
|
||||
public void ClearSelection() {
|
||||
if (isShown()) control.clearSelection(); //строка сбросится сама. благодаря сбросу события выбора
|
||||
}
|
||||
public void SelectAll(boolean flag) {
|
||||
for (D object : dataSource.Data.values()) {
|
||||
if (isObjectVisible(object))
|
||||
object.Select(flag);
|
||||
}
|
||||
Refresh();
|
||||
}
|
||||
//ДИАЛОГИ
|
||||
public boolean ShowAddObjectDialog(D object) {
|
||||
return getDialog().ShowDialog(getSingleDescription() + ": добавление", object);
|
||||
}
|
||||
//todo встроить развилку на возможность редактирования объекты boolean isObjectEditable(D object){return true;}
|
||||
public boolean ShowEditObjectDialog(D object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.edit = true;
|
||||
dialog.SetEditLimits();
|
||||
return dialog.ShowDialog(getSingleDescription() + ": редактирование", object);
|
||||
}
|
||||
public boolean ViewObject(D object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.SetReadonly();
|
||||
dialog.ShowDialog(getSingleDescription() + ": просмотр", object);
|
||||
return false;
|
||||
String title = getSingleDescription() + ": ";
|
||||
if (isObjectEditable(object)) {
|
||||
title += "редактирование";
|
||||
} else {
|
||||
title += "просмотр";
|
||||
dialog.SetReadonly();
|
||||
}
|
||||
return dialog.ShowDialog(title, object);
|
||||
}
|
||||
public boolean ShowDeleteObjectDialog(D object) {
|
||||
return UI.Warning(getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
|
||||
|
||||
Reference in New Issue
Block a user