2023-11-19 18:49:50 +03:00
|
|
|
package TestingSystem.DVM.Configuration;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.Current;
|
|
|
|
|
import Common.Database.DBObject;
|
2023-11-19 18:49:50 +03:00
|
|
|
import Common.Database.iDBTable;
|
2023-09-17 22:13:42 +03:00
|
|
|
import Common.UI.DataSetControlForm;
|
|
|
|
|
import Common.UI.Tables.TableRenderers;
|
|
|
|
|
import Common.UI.VisualiserStringList;
|
|
|
|
|
import Common.UI.Windows.Dialog.DBObjectDialog;
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 18:49:50 +03:00
|
|
|
import TestingSystem.DVM.Configuration.UI.ConfigurationFields;
|
2024-09-15 01:36:19 +03:00
|
|
|
public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
|
|
|
|
|
public DVMConfigurationDBTable() {
|
2024-09-14 00:18:27 +03:00
|
|
|
super(DVMConfiguration.class);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public Current CurrentName() {
|
2024-09-15 01:36:19 +03:00
|
|
|
return Current.DVMConfiguration;
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getSingleDescription() {
|
2024-09-15 01:36:19 +03:00
|
|
|
return "конфигурация тестирования DVM системы";
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String getPluralDescription() {
|
2024-09-15 01:36:19 +03:00
|
|
|
return "конфигурации тестирования DVM системы";
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected DataSetControlForm createUI() {
|
|
|
|
|
return new DataSetControlForm(this) {
|
|
|
|
|
@Override
|
|
|
|
|
public boolean hasCheckBox() {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
protected void AdditionalInitColumns() {
|
2023-11-19 18:49:50 +03:00
|
|
|
// columns.get(0).setVisible(false);
|
2023-09-17 22:13:42 +03:00
|
|
|
columns.get(5).setRenderer(TableRenderers.RendererMultiline);
|
2024-09-15 01:36:19 +03:00
|
|
|
columns.get(7).setRenderer(TableRenderers.RendererMultiline);
|
|
|
|
|
columns.get(8).setRenderer(TableRenderers.RendererMultiline);
|
|
|
|
|
columns.get(15).setRenderer(TableRenderers.RendererMultiline);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public String[] getUIColumnNames() {
|
|
|
|
|
return new String[]{
|
|
|
|
|
"имя",
|
|
|
|
|
"автор",
|
2024-09-15 01:36:19 +03:00
|
|
|
"авто",
|
|
|
|
|
"группы",
|
|
|
|
|
"тестов",
|
2023-09-17 22:13:42 +03:00
|
|
|
"флаги",
|
|
|
|
|
"окружение",
|
|
|
|
|
"c_time",
|
|
|
|
|
"куб",
|
|
|
|
|
"max",
|
|
|
|
|
"min dim",
|
|
|
|
|
"max dim",
|
|
|
|
|
"r_time",
|
|
|
|
|
"usr.par"
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-09-14 00:18:27 +03:00
|
|
|
public Object getFieldAt(DVMConfiguration object, int columnIndex) {
|
2023-09-17 22:13:42 +03:00
|
|
|
switch (columnIndex) {
|
|
|
|
|
case 2:
|
|
|
|
|
return object.description;
|
|
|
|
|
case 3:
|
|
|
|
|
return object.sender_name;
|
2024-09-15 01:36:19 +03:00
|
|
|
//---
|
2023-09-17 22:13:42 +03:00
|
|
|
case 4:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.printAuto();
|
2023-09-17 22:13:42 +03:00
|
|
|
case 5:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.getGroupsNamesArray();
|
2023-09-17 22:13:42 +03:00
|
|
|
case 6:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.testsCount;
|
|
|
|
|
//---
|
2023-09-17 22:13:42 +03:00
|
|
|
case 7:
|
2024-09-15 01:36:19 +03:00
|
|
|
return Utils.unpackStrings(object.flags, true);
|
2023-09-17 22:13:42 +03:00
|
|
|
case 8:
|
2024-09-15 01:36:19 +03:00
|
|
|
return Utils.unpackStrings(object.environments, true);
|
2023-09-17 22:13:42 +03:00
|
|
|
case 9:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.c_maxtime;
|
2023-09-17 22:13:42 +03:00
|
|
|
case 10:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.cube;
|
2023-09-17 22:13:42 +03:00
|
|
|
case 11:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.max_proc_count;
|
2023-09-17 22:13:42 +03:00
|
|
|
case 12:
|
2024-09-15 01:36:19 +03:00
|
|
|
return object.min_dim_proc_count;
|
|
|
|
|
case 13:
|
|
|
|
|
return object.max_dim_proc_count;
|
|
|
|
|
case 14:
|
|
|
|
|
return object.maxtime;
|
|
|
|
|
case 15:
|
2023-09-17 22:13:42 +03:00
|
|
|
return Utils.unpackStrings(object.usr_par, true);
|
|
|
|
|
default:
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
@Override
|
2024-09-14 00:18:27 +03:00
|
|
|
public DBObjectDialog<DVMConfiguration, ConfigurationFields> getDialog() {
|
|
|
|
|
return new DBObjectDialog<DVMConfiguration, ConfigurationFields>(ConfigurationFields.class) {
|
2023-09-17 22:13:42 +03:00
|
|
|
@Override
|
|
|
|
|
public int getDefaultHeight() {
|
|
|
|
|
return 480;
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public int getDefaultWidth() {
|
|
|
|
|
return 1000;
|
|
|
|
|
}
|
|
|
|
|
@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);
|
|
|
|
|
//------->>>>
|
2024-09-14 00:18:27 +03:00
|
|
|
((VisualiserStringList) (fields.flagsList)).fill(Result.getFlagsArray());
|
2023-11-19 18:49:50 +03:00
|
|
|
((VisualiserStringList) (fields.environmentsList)).fill(Result.getEnvironments());
|
|
|
|
|
((VisualiserStringList) (fields.parList)).fill(Result.getParams());
|
2023-09-17 22:13:42 +03:00
|
|
|
//------->>>>
|
|
|
|
|
fields.sCompilationMaxtime.setValue(Result.c_maxtime);
|
|
|
|
|
//-
|
|
|
|
|
fields.sMinDimProc.setValue(Result.min_dim_proc_count);
|
|
|
|
|
fields.sMaxDimProc.setValue(Result.max_dim_proc_count);
|
|
|
|
|
fields.cbCube.setSelected(Result.cube == 1);
|
2024-09-14 00:18:27 +03:00
|
|
|
fields.sRunMaxtime.setValue(Result.maxtime);
|
2023-09-17 22:13:42 +03:00
|
|
|
//-
|
|
|
|
|
fields.sMaxProc.setValue(Result.max_proc_count);
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void ProcessResult() {
|
|
|
|
|
Result.description = fields.tfName.getText();
|
|
|
|
|
Result.c_maxtime = (int) fields.sCompilationMaxtime.getValue();
|
|
|
|
|
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();
|
2024-09-14 00:18:27 +03:00
|
|
|
Result.maxtime = (int) fields.sRunMaxtime.getValue();
|
2023-09-17 22:13:42 +03:00
|
|
|
Result.flags = ((VisualiserStringList) (fields.flagsList)).pack();
|
|
|
|
|
Result.environments = ((VisualiserStringList) (fields.environmentsList)).pack();
|
|
|
|
|
Result.usr_par = ((VisualiserStringList) (fields.parList)).pack();
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public void SetReadonly() {
|
|
|
|
|
fields.tfName.setEnabled(false);
|
|
|
|
|
fields.sCompilationMaxtime.setEnabled(false);
|
|
|
|
|
fields.sRunMaxtime.setEnabled(false);
|
|
|
|
|
fields.sMinDimProc.setEnabled(false);
|
|
|
|
|
fields.sMaxDimProc.setEnabled(false);
|
|
|
|
|
fields.cbCube.setEnabled(false);
|
|
|
|
|
fields.sMaxProc.setEnabled(false);
|
|
|
|
|
fields.bAddFlags.setEnabled(false);
|
|
|
|
|
fields.bDeleteFlags.setEnabled(false);
|
|
|
|
|
fields.bAddEnvironments.setEnabled(false);
|
|
|
|
|
fields.bDeleteEnvironment.setEnabled(false);
|
|
|
|
|
fields.bAddPar.setEnabled(false);
|
|
|
|
|
fields.bDeletePar.setEnabled(false);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
@Override
|
|
|
|
|
public boolean ShowEditObjectDialog(DBObject object) {
|
2024-09-14 00:18:27 +03:00
|
|
|
return (Current.getAccount().CheckAccessRights(((DVMConfiguration) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
|
2023-09-17 22:13:42 +03:00
|
|
|
}
|
|
|
|
|
}
|