141 lines
5.4 KiB
Java
141 lines
5.4 KiB
Java
package TestingSystem.SAPFOR.SapforConfiguration;
|
|
import Common.Current;
|
|
import Common.Database.*;
|
|
import Common.UI.DataSetControlForm;
|
|
import Common.UI.Tables.TableEditors;
|
|
import Common.UI.Tables.TableRenderers;
|
|
import Common.UI.VisualCache.ConfigurationCache;
|
|
import Common.UI.VisualCache.VisualCaches;
|
|
import Common.UI.Windows.Dialog.DBObjectDialog;
|
|
import Common.Utils.Utils;
|
|
import Common.Utils.Vector_;
|
|
import TestingSystem.SAPFOR.SapforConfiguration.UI.SapforConfigurationFields;
|
|
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
|
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Vector;
|
|
public class SapforConfigurationDBTable extends iDBTable<SapforConfiguration> {
|
|
public SapforConfigurationDBTable() {
|
|
super(SapforConfiguration.class);
|
|
}
|
|
@Override
|
|
public Current CurrentName() {
|
|
return Current.SapforConfiguration;
|
|
}
|
|
@Override
|
|
public String getSingleDescription() {
|
|
return "конфигурация тестирования SAPFOR";
|
|
}
|
|
@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(5).setRenderer(TableRenderers.RendererAutoConfiguration);
|
|
columns.get(5).setEditor(TableEditors.EditorAutoConfiguration);
|
|
columns.get(5).setMinWidth(25);
|
|
columns.get(5).setMaxWidth(25);
|
|
columns.get(6).setMaxWidth(300);
|
|
}
|
|
};
|
|
}
|
|
@Override
|
|
public String[] getUIColumnNames() {
|
|
return new String[]{
|
|
"имя",
|
|
"автор",
|
|
"ядра",
|
|
"",
|
|
"группы",
|
|
"тестов",
|
|
"флаги",
|
|
};
|
|
}
|
|
@Override
|
|
public Object getFieldAt(SapforConfiguration 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 object.printAuto();
|
|
case 6:
|
|
return cache.getGroupsDescriptions();
|
|
case 7:
|
|
return cache.getTestsCount();
|
|
case 8:
|
|
return object.getFlags();
|
|
default:
|
|
return null;
|
|
}
|
|
}
|
|
//--
|
|
@Override
|
|
public DBObjectDialog<SapforConfiguration, SapforConfigurationFields> getDialog() {
|
|
return new DBObjectDialog<SapforConfiguration, SapforConfigurationFields>(SapforConfigurationFields.class) {
|
|
@Override
|
|
public int getDefaultHeight() {
|
|
return 415;
|
|
}
|
|
@Override
|
|
public int getDefaultWidth() {
|
|
return 600;
|
|
}
|
|
@Override
|
|
public void validateFields() {
|
|
}
|
|
@Override
|
|
public void fillFields() {
|
|
fields.tfName.setText(Result.description);
|
|
fields.cbFREE_FORM.setSelected(Result.FREE_FORM != 0);
|
|
fields.cbKEEP_DVM_DIRECTIVES.setSelected(Result.KEEP_DVM_DIRECTIVES != 0);
|
|
fields.cbKEEP_SPF_DIRECTIVES.setSelected(Result.KEEP_SPF_DIRECTIVES != 0);
|
|
fields.cbSTATIC_SHADOW_ANALYSIS.setSelected(Result.STATIC_SHADOW_ANALYSIS != 0);
|
|
fields.sMAX_SHADOW_WIDTH.setValue(Result.MAX_SHADOW_WIDTH);
|
|
fields.sKernels.setValue(Result.kernels);
|
|
}
|
|
@Override
|
|
public void ProcessResult() {
|
|
Result.description = fields.tfName.getText();
|
|
Result.FREE_FORM = Utils.fromBoolean(fields.cbFREE_FORM.isSelected());
|
|
Result.KEEP_DVM_DIRECTIVES = Utils.fromBoolean(fields.cbKEEP_DVM_DIRECTIVES.isSelected());
|
|
Result.KEEP_SPF_DIRECTIVES = Utils.fromBoolean(fields.cbKEEP_SPF_DIRECTIVES.isSelected());
|
|
Result.STATIC_SHADOW_ANALYSIS = Utils.fromBoolean(fields.cbSTATIC_SHADOW_ANALYSIS.isSelected());
|
|
Result.MAX_SHADOW_WIDTH = fields.sMAX_SHADOW_WIDTH.getValue();
|
|
Result.kernels = (int) fields.sKernels.getValue();
|
|
}
|
|
@Override
|
|
public void SetReadonly() {
|
|
fields.tfName.setEnabled(false);
|
|
fields.sTransformationMaxtime.setEnabled(false);
|
|
}
|
|
};
|
|
}
|
|
@Override
|
|
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
|
|
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
|
|
res.put(SapforConfigurationCommand.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
|
return res;
|
|
}
|
|
public Vector<SapforConfiguration> getAutoConfigurations() {
|
|
Vector<SapforConfiguration> res = new Vector_<>();
|
|
for (SapforConfiguration configuration : Data.values()) {
|
|
if (configuration.autoTesting != 0)
|
|
res.add(configuration);
|
|
}
|
|
return res;
|
|
}
|
|
}
|