вывод диалоговых форм для объектов в отдельный класс
This commit is contained in:
@@ -3,8 +3,6 @@ import Common.Database.Objects.DBObject;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.UI;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Comparator;
|
||||
@@ -53,32 +51,6 @@ public class DataSet<K, D extends DBObject> extends DataSetAnchestor {
|
||||
res.sort(comparator);
|
||||
return res;
|
||||
}
|
||||
//todo все это тоже в уи?
|
||||
@SuppressWarnings("unchecked")
|
||||
public DBObjectDialog<D, ? extends DialogFields> getDialog() {
|
||||
return null;
|
||||
}
|
||||
public boolean ShowAddObjectDialog(DBObject object) {
|
||||
return getDialog().ShowDialog(getUI().getSingleDescription() + ": добавление", object);
|
||||
}
|
||||
public boolean ShowEditObjectDialog(DBObject object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.edit = true;
|
||||
dialog.SetEditLimits();
|
||||
return dialog.ShowDialog(getUI().getSingleDescription() + ": редактирование", object);
|
||||
}
|
||||
public boolean ViewObject(DBObject object) {
|
||||
DBObjectDialog dialog = getDialog();
|
||||
dialog.SetReadonly();
|
||||
dialog.ShowDialog(getUI().getSingleDescription() + ": просмотр", object);
|
||||
return false;
|
||||
}
|
||||
public boolean ShowDeleteObjectDialog(DBObject object) {
|
||||
return UI.Warning(getUI().getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
|
||||
}
|
||||
public boolean ShowDeleteObjectsDialog(int toDeleteCount) {
|
||||
return UI.Warning(getUI().getPluralDescription() + " в количестве " + toDeleteCount + " будут удалены)");
|
||||
}
|
||||
public String QName() {
|
||||
return "\"" + Name + "\"";
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ public abstract class AddObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
fillObjectFields();
|
||||
}
|
||||
protected boolean fillObjectFields() throws Exception {
|
||||
return getTable().ShowAddObjectDialog(target);
|
||||
return getTable().getUI().ShowAddObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
public String getIconPath() {
|
||||
|
||||
@@ -11,7 +11,7 @@ public abstract class DeleteObjectPass<D extends DBObject> extends ObjectPass<D>
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (D) getTable().getUI().getCurrent();
|
||||
return getTable().getUI().CheckCurrent(Log) && getTable().ShowDeleteObjectDialog(target);
|
||||
return getTable().getUI().CheckCurrent(Log) && getTable().getUI().ShowDeleteObjectDialog(target);
|
||||
}
|
||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||
@Override
|
||||
|
||||
@@ -13,7 +13,7 @@ public abstract class DeleteObjectsPass<D extends DBObject> extends ObjectsPass<
|
||||
if (!getTable().getUI().CheckSelectedOrCurrent(Log))
|
||||
return false;
|
||||
target = getTable().getUI().getSelectedOrCurrent();
|
||||
return getTable().ShowDeleteObjectsDialog(target.size());
|
||||
return getTable().getUI().ShowDeleteObjectsDialog(target.size());
|
||||
}
|
||||
//Очищаем все связанные таблицы, чтобы не допустить перерисовки во время удаления объекта.
|
||||
@Override
|
||||
|
||||
@@ -11,7 +11,7 @@ public abstract class EditObjectPass<D extends DBObject> extends ObjectPass<D> {
|
||||
@Override
|
||||
protected boolean canStart(Object... args) throws Exception {
|
||||
target = (D) getTable().getUI().getCurrent();
|
||||
return getTable().getUI().CheckCurrent(Log) && getTable().ShowEditObjectDialog(target);
|
||||
return getTable().getUI().CheckCurrent(Log) && getTable().getUI().ShowEditObjectDialog(target);
|
||||
}
|
||||
@Override
|
||||
protected void body() throws Exception {
|
||||
|
||||
@@ -13,6 +13,7 @@ import Common.Visual.Menus.DataMenuBar;
|
||||
import Common.Visual.Menus.TableMenu;
|
||||
import Common.Visual.Tables.*;
|
||||
import Common.Visual.Tables.Grid.GridAnchestor;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.table.TableColumn;
|
||||
@@ -33,10 +34,7 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
protected boolean events_on = true;
|
||||
protected String colNamesAndSizes = "";
|
||||
protected Vector<ColumnInfo> columns = new Vector<>(); //информация о столбцах и их оформлении
|
||||
//-
|
||||
protected Vector<DBObjectFilter_<D>> allFilters = new Vector<>();
|
||||
//---
|
||||
//фильтры и подсчеты. todo слить с баром (?)
|
||||
MatchesCounter counter_ui = null;
|
||||
//--
|
||||
Object savedCurrentKey = null;
|
||||
@@ -505,4 +503,30 @@ public class DataSetControlForm<D extends DBObject> extends ControlForm<DataTabl
|
||||
}
|
||||
return res;
|
||||
}
|
||||
@SuppressWarnings("unchecked")
|
||||
public DBObjectDialog getDialog() {
|
||||
return null;
|
||||
}
|
||||
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;
|
||||
}
|
||||
public boolean ShowDeleteObjectDialog(D object) {
|
||||
return UI.Warning(getSingleDescription() + " " + object.getBDialogName() + " будет удален(а)");
|
||||
}
|
||||
public boolean ShowDeleteObjectsDialog(int toDeleteCount) {
|
||||
return UI.Warning(getPluralDescription() + " в количестве " + toDeleteCount + " будут удалены)");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user