130 lines
4.6 KiB
Java
130 lines
4.6 KiB
Java
package _VisualDVM.TestingSystem.DVM.DVMConfiguration;
|
||
import Common.Database.Objects.DBObject;
|
||
import Common.Database.Tables.iDBTable;
|
||
import Common.Visual.DataSetControlForm;
|
||
import Common.Visual.Menus.DataMenuBar;
|
||
import Common.Visual.Tables.RendererMultiline;
|
||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||
import _VisualDVM.Current;
|
||
import _VisualDVM.Global;
|
||
import _VisualDVM.Passes.PassCode;
|
||
import _VisualDVM.ServerObjectsCache.ConfigurationCache;
|
||
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
||
import _VisualDVM.TestingSystem.DVM.DVMConfiguration.UI.ConfigurationFields;
|
||
public class DVMConfigurationDBTable extends iDBTable<DVMConfiguration> {
|
||
public DVMConfigurationDBTable() {
|
||
super(DVMConfiguration.class);
|
||
}
|
||
@Override
|
||
public Current CurrentName() {
|
||
return Current.DVMConfiguration;
|
||
}
|
||
@Override
|
||
public String getSingleDescription() {
|
||
return "конфигурация";
|
||
}
|
||
@Override
|
||
public String getPluralDescription() {
|
||
return "конфигурации";
|
||
}
|
||
@Override
|
||
protected DataSetControlForm createUI() {
|
||
return new DataSetControlForm(this) {
|
||
@Override
|
||
public boolean hasCheckBox() {
|
||
return true;
|
||
}
|
||
@Override
|
||
protected void AdditionalInitColumns() {
|
||
columns.get(6).setRendererClass(RendererMultiline.class);
|
||
columns.get(6).setMaxWidth(500);
|
||
}
|
||
};
|
||
}
|
||
@Override
|
||
public String[] getUIColumnNames() {
|
||
return new String[]{
|
||
"имя",
|
||
"автор",
|
||
"ядра",
|
||
"параметры",
|
||
"группы",
|
||
"тестов",
|
||
"компиляция(с)",
|
||
"запуск(с)"
|
||
};
|
||
}
|
||
@Override
|
||
public Object getFieldAt(DVMConfiguration object, int columnIndex) {
|
||
ConfigurationCache cache = (ConfigurationCache) VisualCaches.GetCache(object);
|
||
switch (columnIndex) {
|
||
case 2:
|
||
return object.description;
|
||
case 3:
|
||
return object.sender_name;
|
||
case 4:
|
||
return object.kernels;
|
||
case 5:
|
||
return cache.settingsSummary;
|
||
case 6:
|
||
return cache.groupsSummary;
|
||
case 7:
|
||
return cache.getTestsCount();
|
||
case 8:
|
||
return object.c_maxtime;
|
||
case 9:
|
||
return object.maxtime;
|
||
default:
|
||
return null;
|
||
}
|
||
}
|
||
@Override
|
||
public DBObjectDialog<DVMConfiguration, ConfigurationFields> getDialog() {
|
||
return new DBObjectDialog<DVMConfiguration, ConfigurationFields>(ConfigurationFields.class) {
|
||
@Override
|
||
public int getDefaultHeight() {
|
||
return 300;
|
||
}
|
||
@Override
|
||
public int getDefaultWidth() {
|
||
return 500;
|
||
}
|
||
@Override
|
||
public void fillFields() {
|
||
fields.tfName.setText(Result.description);
|
||
//------->>>>
|
||
fields.sCompilationMaxtime.setValue(Result.c_maxtime);
|
||
fields.sRunMaxtime.setValue(Result.maxtime);
|
||
fields.sKernels.setValue(Result.kernels);
|
||
}
|
||
@Override
|
||
public void ProcessResult() {
|
||
Result.description = fields.tfName.getText();
|
||
Result.c_maxtime = (int) fields.sCompilationMaxtime.getValue();
|
||
Result.maxtime = (int) fields.sRunMaxtime.getValue();
|
||
Result.kernels = (int) fields.sKernels.getValue();
|
||
}
|
||
@Override
|
||
public void SetReadonly() {
|
||
fields.tfName.setEnabled(false);
|
||
fields.sCompilationMaxtime.setEnabled(false);
|
||
fields.sRunMaxtime.setEnabled(false);
|
||
}
|
||
};
|
||
}
|
||
@Override
|
||
public boolean ShowEditObjectDialog(DBObject object) {
|
||
return (Global.mainModule.getAccount().CheckAccessRights(((DVMConfiguration) object).sender_address, null)) ? super.ShowEditObjectDialog(object) : ViewObject(object);
|
||
}
|
||
@Override
|
||
public DataMenuBar createMenuBar() {
|
||
return new DataMenuBar(getPluralDescription(),
|
||
PassCode.PublishConfiguration,
|
||
PassCode.EditConfiguration,
|
||
PassCode.ShowCurrentDVMConfigurationTests,
|
||
PassCode.SaveCurrentDVMConfiguration,
|
||
PassCode.DeleteConfiguration,
|
||
PassCode.StartSelectedDVMConfigurations );
|
||
}
|
||
}
|