2024-10-09 22:21:57 +03:00
|
|
|
package _VisualDVM.TestingSystem.DVM.DVMSettings;
|
2024-10-07 00:58:29 +03:00
|
|
|
import Common.Database.Objects.DBObject;
|
|
|
|
|
import Common.Database.Tables.iDBTable;
|
2024-10-16 21:58:46 +03:00
|
|
|
import Common.Passes.PassCode_;
|
2024-10-08 00:39:13 +03:00
|
|
|
import Common.Visual.DataSetControlForm;
|
2024-10-16 20:45:59 +03:00
|
|
|
import Common.Visual.Menus.DataMenuBar;
|
2024-10-08 22:33:49 +03:00
|
|
|
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
2024-10-14 15:19:13 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-13 22:08:13 +03:00
|
|
|
import _VisualDVM.Global;
|
2024-10-16 20:45:59 +03:00
|
|
|
import _VisualDVM.Passes.PassCode;
|
2024-10-09 22:21:57 +03:00
|
|
|
import _VisualDVM.TestingSystem.DVM.DVMSettings.UI.DVMSettingsFields;
|
2024-10-17 20:04:16 +03:00
|
|
|
|
|
|
|
|
import javax.swing.*;
|
2024-10-01 17:33:08 +03:00
|
|
|
public class DVMSettingsDBTable extends iDBTable<DVMSettings> {
|
|
|
|
|
public DVMSettingsDBTable() {
|
|
|
|
|
super(DVMSettings.class);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public Current CurrentName() {
|
|
|
|
|
return Current.DVMSettings;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getSingleDescription() {
|
2024-10-16 20:45:59 +03:00
|
|
|
return "параметры тестирования";
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getPluralDescription() {
|
2024-10-16 20:45:59 +03:00
|
|
|
return "параметры тестирования";
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
|
|
|
|
//--
|
|
|
|
|
//-
|
|
|
|
|
@Override
|
2024-10-17 20:04:16 +03:00
|
|
|
protected DataSetControlForm createUI(JPanel mountPanel) {
|
2024-10-17 21:24:55 +03:00
|
|
|
return new DataSetControlForm(this, mountPanel) {
|
2024-10-01 17:33:08 +03:00
|
|
|
@Override
|
|
|
|
|
public boolean hasCheckBox() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-10-17 22:09:18 +03:00
|
|
|
public String[] getUIColumnNames() {
|
|
|
|
|
return new String[]{
|
|
|
|
|
"имя",
|
|
|
|
|
"автор",
|
|
|
|
|
"флаги",
|
|
|
|
|
"окружение",
|
|
|
|
|
"usr.par",
|
|
|
|
|
"куб",
|
|
|
|
|
"max",
|
|
|
|
|
"min dim",
|
|
|
|
|
"max dim"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-10-17 21:24:55 +03:00
|
|
|
public DataMenuBar createMenuBar() {
|
|
|
|
|
return new DataMenuBar(getPluralDescription(),
|
|
|
|
|
PassCode.PublishDVMSettings,
|
|
|
|
|
PassCode.CloneDVMSettings,
|
|
|
|
|
PassCode.EditDVMSettings,
|
|
|
|
|
PassCode.DeleteDVMSettings);
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public DBObjectDialog<DVMSettings, DVMSettingsFields> getDialog() {
|
|
|
|
|
return new DBObjectDialog<DVMSettings, DVMSettingsFields>(DVMSettingsFields.class) {
|
|
|
|
|
@Override
|
|
|
|
|
public int getDefaultHeight() {
|
|
|
|
|
return 400;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public int getDefaultWidth() {
|
|
|
|
|
return 800;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void validateFields() {
|
|
|
|
|
int min = (int) fields.sMinDimProc.getValue();
|
|
|
|
|
int max = (int) fields.sMaxDimProc.getValue();
|
|
|
|
|
if (max < min)
|
|
|
|
|
Log.Writeln_("Некорректный диапазон размерностей: максимум меньше минимума");
|
|
|
|
|
if ((min == 0) && (max != 0) || (min != 0) && (max == 0))
|
|
|
|
|
Log.Writeln_("Некорректный диапазон размерностей. " +
|
|
|
|
|
"'0' допускается только одновременно на обеих границах,\n" +
|
|
|
|
|
"и подразумевает единственный запуск без решётки");
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void fillFields() {
|
|
|
|
|
fields.tfName.setText(Result.description);
|
|
|
|
|
//------->>>
|
|
|
|
|
fields.tfFlags.setText(Result.flags);
|
|
|
|
|
fields.tfEnvironments.setText(Result.environments);
|
|
|
|
|
//------->>>
|
|
|
|
|
fields.sMinDimProc.setValue(Result.min_dim_proc_count);
|
|
|
|
|
fields.sMaxDimProc.setValue(Result.max_dim_proc_count);
|
|
|
|
|
fields.cbCube.setSelected(Result.cube == 1);
|
|
|
|
|
//-
|
|
|
|
|
fields.sMaxProc.setValue(Result.max_proc_count);
|
2024-10-14 15:19:13 +03:00
|
|
|
fields.cbDvmStat.setSelected(Result.Is_DVM_STAT != 0);
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void ProcessResult() {
|
|
|
|
|
Result.description = fields.tfName.getText();
|
|
|
|
|
Result.min_dim_proc_count = (int) fields.sMinDimProc.getValue();
|
|
|
|
|
Result.max_dim_proc_count = (int) fields.sMaxDimProc.getValue();
|
|
|
|
|
Result.cube = fields.cbCube.isSelected() ? 1 : 0;
|
|
|
|
|
Result.max_proc_count = (int) fields.sMaxProc.getValue();
|
|
|
|
|
Result.flags = fields.tfFlags.getText();
|
|
|
|
|
Result.environments = fields.tfEnvironments.getText();
|
2024-10-14 15:19:13 +03:00
|
|
|
Result.Is_DVM_STAT = fields.cbDvmStat.isSelected() ? 1 : 0;
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void SetReadonly() {
|
|
|
|
|
fields.tfName.setEnabled(false);
|
|
|
|
|
fields.sMinDimProc.setEnabled(false);
|
|
|
|
|
fields.sMaxDimProc.setEnabled(false);
|
|
|
|
|
fields.cbCube.setEnabled(false);
|
|
|
|
|
fields.sMaxProc.setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean ShowEditObjectDialog(DBObject object) {
|
2024-10-13 22:08:13 +03:00
|
|
|
return (Global.mainModule.getAccount().CheckAccessRights(((DVMSettings) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|
2024-10-14 20:57:18 +03:00
|
|
|
@Override
|
2024-10-16 21:58:46 +03:00
|
|
|
public PassCode_ getDeletePassCode() {
|
|
|
|
|
return PassCode.DeleteDVMSettings;
|
|
|
|
|
}
|
2024-10-01 17:33:08 +03:00
|
|
|
}
|