no message
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
package SapforTestingSystem.SapforConfiguration;
|
||||
import Common.Database.rDBObject;
|
||||
public class SapforConfiguration extends rDBObject {
|
||||
//настройки.
|
||||
public int maxtime = 300; //лимит времени преобразования.
|
||||
public int FREE_FORM = 0; //"Свободный выходной стиль"; -f90
|
||||
public int STATIC_SHADOW_ANALYSIS=0;//"Оптимизация теневых обменов"; -sh
|
||||
public int MAX_SHADOW_WIDTH=50; // "Максимальный размер теневых граней"; (%) -shwidth значение поля
|
||||
public int KEEP_SPF_DIRECTIVES=0; //"Сохранять SPF директивы при построении параллельных вариантов"; -keepSPF
|
||||
public int KEEP_DVM_DIRECTIVES = 0;// "Учитывать DVM директивы"; -keepDVM
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package SapforTestingSystem.SapforConfiguration;
|
||||
import Common.Current;
|
||||
import Common.Database.*;
|
||||
import Common.Global;
|
||||
import Common.UI.DataSetControlForm;
|
||||
import Common.UI.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Utils.Utils;
|
||||
import SapforTestingSystem.SapforConfiguration.UI.SapforConfigurationFields;
|
||||
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class SapforConfigurationDBTable extends DBTable<String, SapforConfiguration> {
|
||||
public SapforConfigurationDBTable() {
|
||||
super(String.class, 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
|
||||
public void ShowCurrentObject() throws Exception {
|
||||
super.ShowCurrentObject();
|
||||
Global.db.sapforTasksPackages.ShowUI();
|
||||
}
|
||||
@Override
|
||||
public void ShowNoCurrentObject() throws Exception {
|
||||
super.ShowNoCurrentObject();
|
||||
Global.db.sapforTasksPackages.ClearUI();
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public String[] getUIColumnNames() {
|
||||
return new String[]{
|
||||
"имя",
|
||||
"автор",
|
||||
"флаги",
|
||||
"maxtime"
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public Object getFieldAt(SapforConfiguration object, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.description;
|
||||
case 3:
|
||||
return object.sender_name;
|
||||
case 4:
|
||||
return SapforConfigurationInterface.getFlags(object);
|
||||
case 5:
|
||||
return object.maxtime;
|
||||
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.sMaxtime.setValue(Result.maxtime);
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result.description = fields.tfName.getText();
|
||||
Result.maxtime = (int) fields.sMaxtime.getValue();
|
||||
// Result.transformations = ((StyledStringList) (fields.transformationsList)).pack();
|
||||
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();
|
||||
}
|
||||
@Override
|
||||
public void SetReadonly() {
|
||||
fields.tfName.setEnabled(false);
|
||||
fields.sMaxtime.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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package SapforTestingSystem.SapforConfiguration;
|
||||
import Common.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import SapforTestingSystem.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.util.Vector;
|
||||
public class SapforConfigurationInterface {
|
||||
public static String getFlags(SapforConfiguration object) {
|
||||
Vector<String> res = new Vector<>();
|
||||
if (object.FREE_FORM > 0)
|
||||
res.add("-f90");
|
||||
if (object.STATIC_SHADOW_ANALYSIS > 0)
|
||||
res.add("-sh");
|
||||
if (object.MAX_SHADOW_WIDTH > 0)
|
||||
res.add("-shwidth " + object.MAX_SHADOW_WIDTH);
|
||||
if (object.KEEP_DVM_DIRECTIVES > 0)
|
||||
res.add("-keepDVM");
|
||||
if (object.KEEP_SPF_DIRECTIVES > 0)
|
||||
res.add("-keepSPF");
|
||||
return String.join(" ", res);
|
||||
}
|
||||
public static Vector<PassCode_2021> getPassCodes(SapforConfiguration object) {
|
||||
Vector<PassCode_2021> res = new Vector<>();
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id.equals(object.id)) {
|
||||
res.add(command.passCode);
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
public static String getTransformationsNames(SapforConfiguration object) {
|
||||
Vector<String> res = new Vector<>();
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id.equals(object.id)) {
|
||||
res.add(command.passCode.getDescription());
|
||||
}
|
||||
}
|
||||
return String.join(";", res);
|
||||
}
|
||||
//todo вывести.
|
||||
public static boolean validateCommands(SapforConfiguration sapforConfiguration, TextLog log) {
|
||||
//1. получить список всех команд.
|
||||
Vector<SapforConfigurationCommand> commands = new Vector<>();
|
||||
int count = 0;
|
||||
for (SapforConfigurationCommand command : Global.testingServer.db.sapforConfigurationCommands.Data.values()) {
|
||||
if (command.sapforconfiguration_id.equals(sapforConfiguration.id)) {
|
||||
commands.add(command);
|
||||
if (command.passCode.equals(PassCode_2021.CreateParallelVariants))
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if ((count == 0) || commands.isEmpty())
|
||||
return true;
|
||||
//--
|
||||
if (count > 2) {
|
||||
log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": построение параллельных вариантов возможно единожды.");
|
||||
return false;
|
||||
}
|
||||
//--
|
||||
if (count == 1) {
|
||||
if (commands.size() == 1) return true;
|
||||
if (!commands.lastElement().passCode.equals(PassCode_2021.CreateParallelVariants)) {
|
||||
log.Writeln_("Неверная конфигурация:" + sapforConfiguration.id + ": построение параллельных вариантов может быть только завершающей командой!");
|
||||
return false;
|
||||
}
|
||||
;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="SapforTestingSystem.SapforConfiguration.UI.SapforConfigurationFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="883" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="d1d6e" layout-manager="GridLayoutManager" row-count="9" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="3257b" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false">
|
||||
<preferred-size width="284" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="название"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="224d6">
|
||||
<constraints>
|
||||
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="284" height="14"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="ecbf1" class="javax.swing.JTextField" binding="tfName" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="200" height="30"/>
|
||||
<preferred-size width="200" height="30"/>
|
||||
<maximum-size width="200" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="3e6be" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="2" use-parent-layout="false">
|
||||
<preferred-size width="284" height="20"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="макс. время прохода"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="db389" class="javax.swing.JSpinner" binding="sMaxtime">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="100" height="30"/>
|
||||
<preferred-size width="240" height="30"/>
|
||||
<maximum-size width="100" height="30"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="b644a" class="javax.swing.JCheckBox" binding="cbFREE_FORM">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="284" height="25"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="14" style="2"/>
|
||||
<icon value="icons/NotPick.png"/>
|
||||
<selectedIcon value="icons/Pick.png"/>
|
||||
<text value="Свободный выходной стиль"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="7721e" class="javax.swing.JCheckBox" binding="cbKEEP_SPF_DIRECTIVES">
|
||||
<constraints>
|
||||
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="284" height="25"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="14" style="2"/>
|
||||
<icon value="icons/NotPick.png"/>
|
||||
<selectedIcon value="icons/Pick.png"/>
|
||||
<text value="Сохранять SPF директивы"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="f44c1" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="3" use-parent-layout="false">
|
||||
<preferred-size width="284" height="17"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="14" style="2"/>
|
||||
<text value="Максимальный размер теневых граней, %"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="54e77" class="javax.swing.JCheckBox" binding="cbSTATIC_SHADOW_ANALYSIS">
|
||||
<constraints>
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="284" height="25"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="14" style="2"/>
|
||||
<icon value="icons/NotPick.png"/>
|
||||
<selectedIcon value="icons/Pick.png"/>
|
||||
<text value="Оптимизация теневых обменов"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="4e865" class="javax.swing.JCheckBox" binding="cbKEEP_DVM_DIRECTIVES">
|
||||
<constraints>
|
||||
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="284" height="25"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="14" style="2"/>
|
||||
<icon value="icons/NotPick.png"/>
|
||||
<selectedIcon value="icons/Pick.png"/>
|
||||
<text value="Учитывать DVM директивы"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="14243" class="javax.swing.JSlider" binding="sMAX_SHADOW_WIDTH">
|
||||
<constraints>
|
||||
<grid row="7" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
|
||||
<minimum-size width="500" height="40"/>
|
||||
<preferred-size width="500" height="40"/>
|
||||
<maximum-size width="500" height="40"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<majorTickSpacing value="25"/>
|
||||
<minorTickSpacing value="1"/>
|
||||
<paintLabels value="true"/>
|
||||
<paintTicks value="true"/>
|
||||
<snapToTicks value="false"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,31 @@
|
||||
package SapforTestingSystem.SapforConfiguration.UI;
|
||||
import Common.UI.TextField.StyledTextField;
|
||||
import Common.UI.Windows.Dialog.DialogFields;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class SapforConfigurationFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JTextField tfName;
|
||||
public JSpinner sMaxtime;
|
||||
public JSpinner sTransformationMaxtime;
|
||||
public JCheckBox cbFREE_FORM;
|
||||
public JSlider sMAX_SHADOW_WIDTH;
|
||||
public JCheckBox cbSTATIC_SHADOW_ANALYSIS;
|
||||
public JCheckBox cbKEEP_SPF_DIRECTIVES;
|
||||
public JCheckBox cbKEEP_DVM_DIRECTIVES;
|
||||
//--
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
}
|
||||
public SapforConfigurationFields(){
|
||||
sMaxtime.setModel(new SpinnerNumberModel(40,
|
||||
5, 3600, 1
|
||||
));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user