98 lines
3.2 KiB
Java
98 lines
3.2 KiB
Java
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;
|
|
import Common.Passes.PassCode_;
|
|
import Common.Visual.DataSetControlForm;
|
|
import Common.Visual.Menus.DataMenuBar;
|
|
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
|
import _VisualDVM.Current;
|
|
import _VisualDVM.GlobalData.SapforProfile.UI.SapforProfileFields;
|
|
import _VisualDVM.GlobalData.SapforProfileSetting.SapforProfileSetting;
|
|
import _VisualDVM.Passes.PassCode;
|
|
|
|
import javax.swing.*;
|
|
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
|
|
protected DataSetControlForm createUI(JPanel mountPanel) {
|
|
return new DataSetControlForm(this,mountPanel) {
|
|
@Override
|
|
public boolean hasCheckBox() {
|
|
return true;
|
|
}
|
|
};
|
|
}
|
|
@Override
|
|
public String[] getUIColumnNames() {
|
|
return new String[]{
|
|
"Описание",
|
|
"Дата создания"
|
|
};
|
|
}
|
|
@Override
|
|
public Object getFieldAt(SapforProfile object, int columnIndex) {
|
|
switch (columnIndex) {
|
|
case 2:
|
|
return object.description;
|
|
case 3:
|
|
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);
|
|
}
|
|
@Override
|
|
public PassCode_ getDeletePassCode() {
|
|
return PassCode.DeleteProfile;
|
|
}
|
|
}
|