Files
VisualSapfor/src/_VisualDVM/GlobalData/SapforProfile/SapforProfilesDBTable.java

92 lines
3.0 KiB
Java
Raw Normal View History

2024-10-09 22:21:57 +03:00
package _VisualDVM.GlobalData.SapforProfile;
import Common.Database.Objects.DBObject;
import Common.Database.Tables.FKBehaviour;
import Common.Database.Tables.FKCurrentObjectBehaviuor;
import Common.Database.Tables.FKDataBehaviour;
import Common.Database.Tables.iDBTable;
2024-10-14 15:19:13 +03:00
import Common.Visual.DataSetControlForm;
import Common.Visual.Menus.DataMenuBar;
2024-10-14 15:19:13 +03:00
import Common.Visual.Windows.Dialog.DBObjectDialog;
import _VisualDVM.Current;
2024-10-09 22:21:57 +03:00
import _VisualDVM.GlobalData.SapforProfile.UI.SapforProfileFields;
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
import _VisualDVM.Passes.PassCode;
2023-09-17 22:13:42 +03:00
import java.util.Date;
import java.util.LinkedHashMap;
public class SapforProfilesDBTable extends iDBTable<SapforProfile> {
public SapforProfilesDBTable() {
super(SapforProfile.class);
}
@Override
public String getPluralDescription() {
return "профили SAPFOR";
}
@Override
public String getSingleDescription() {
return "профиль SAPFOR";
}
@Override
2023-09-17 22:13:42 +03:00
protected DataSetControlForm createUI() {
2024-10-16 19:52:16 +03:00
return new DataSetControlForm(this){
@Override
public boolean hasCheckBox() {
return true;
}
};
2023-09-17 22:13:42 +03:00
}
@Override
public String[] getUIColumnNames() {
return new String[]{
"Описание",
"Дата создания"
};
}
@Override
public Object getFieldAt(SapforProfile object, int columnIndex) {
switch (columnIndex) {
case 2:
2024-10-16 19:52:16 +03:00
return object.description;
case 3:
2023-09-17 22:13:42 +03:00
return new Date(object.creationDate);
default:
return null;
}
}
@Override
public Current CurrentName() {
return Current.SapforProfile;
}
@Override
public DBObjectDialog<SapforProfile, SapforProfileFields> getDialog() {
return new DBObjectDialog<SapforProfile, SapforProfileFields>(SapforProfileFields.class) {
@Override
public int getDefaultHeight() {
return 250;
}
@Override
public void fillFields() {
fields.tfDescription.setText(edit ? Result.description : "По умолчанию");
}
@Override
public void ProcessResult() {
Result.description = fields.tfDescription.getText();
}
};
}
@Override
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
res.put(SapforProfileSetting.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
return res;
}
@Override
public DataMenuBar createMenuBar() {
return new DataMenuBar(getPluralDescription(),
PassCode.SaveProfile,
PassCode.EditProfile,
PassCode.ApplyProfile,
PassCode.DeleteProfile);
}
2023-09-17 22:13:42 +03:00
}