no message
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
package _VisualDVM.TestingSystem.SAPFOR.SapforSettings;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Global;
|
||||
import Common.Utils.TextLog;
|
||||
import _VisualDVM.TestingSystem.Common.Settings.Settings;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Vector;
|
||||
public class SapforSettings extends Settings {
|
||||
//настройки.
|
||||
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
|
||||
//----
|
||||
//----
|
||||
public void packFlags() {
|
||||
Vector<String> res = new Vector<>();
|
||||
//--
|
||||
if (FREE_FORM > 0)
|
||||
res.add("-f90");
|
||||
if (STATIC_SHADOW_ANALYSIS > 0)
|
||||
res.add("-sh");
|
||||
if (MAX_SHADOW_WIDTH > 0)
|
||||
res.add("-shwidth " + MAX_SHADOW_WIDTH);
|
||||
if (KEEP_DVM_DIRECTIVES > 0)
|
||||
res.add("-keepDVM");
|
||||
if (KEEP_SPF_DIRECTIVES > 0)
|
||||
res.add("-keepSPF");
|
||||
//--
|
||||
flags = String.join(" ", res);
|
||||
}
|
||||
//--
|
||||
@Override
|
||||
public void SynchronizeFields(DBObject src) {
|
||||
super.SynchronizeFields(src);
|
||||
SapforSettings c = (SapforSettings) src;
|
||||
FREE_FORM = c.FREE_FORM;
|
||||
STATIC_SHADOW_ANALYSIS = c.STATIC_SHADOW_ANALYSIS;
|
||||
MAX_SHADOW_WIDTH = c.MAX_SHADOW_WIDTH;
|
||||
KEEP_SPF_DIRECTIVES = c.KEEP_SPF_DIRECTIVES;
|
||||
KEEP_DVM_DIRECTIVES = c.KEEP_DVM_DIRECTIVES;
|
||||
}
|
||||
public SapforSettings(SapforSettings sapforSettings) {
|
||||
this.SynchronizeFields(sapforSettings);
|
||||
}
|
||||
public SapforSettings() {
|
||||
}
|
||||
public Vector<PassCode_2021> getCodes() {
|
||||
Vector<PassCode_2021> res = new Vector<>();
|
||||
for (SapforSettingsCommand command : Global.testingServer.db.sapforSettingsCommands.Data.values())
|
||||
if (command.sapforsettings_id == id) res.add(command.passCode);
|
||||
return res;
|
||||
}
|
||||
public List<PassCode_2021> getCheckedCodes(){
|
||||
Vector<PassCode_2021> res = getCodes();
|
||||
if (!res.firstElement().equals(PassCode_2021.SPF_InsertIncludesPass))
|
||||
res.insertElementAt(PassCode_2021.SPF_CorrectCodeStylePass,0); //всегда добавляется.
|
||||
return res;
|
||||
}
|
||||
@Override
|
||||
public boolean validate(TextLog Log) {
|
||||
boolean res = true;
|
||||
Vector<PassCode_2021> codes = getCodes();
|
||||
if (codes.size() == 0) {
|
||||
Log.Writeln_("Настройки:" + id + " не содержат ни одного прохода.");
|
||||
return false;
|
||||
}
|
||||
//-
|
||||
int first = 0;
|
||||
int last = codes.size() - 1;
|
||||
Vector<PassCode_2021> matches = new Vector<>();
|
||||
for (int i = 0; i < codes.size(); ++i) {
|
||||
PassCode_2021 code = codes.get(i);
|
||||
if (code.isSapforStart()) {
|
||||
if (i > first) {
|
||||
Log.Writeln_("Неверные настройки:" + id + ": проход" +
|
||||
CommonUtils.Brackets(code.getDescription()) +
|
||||
" может быть только первым!");
|
||||
res=false;
|
||||
}
|
||||
}
|
||||
if (code.isSapforTerminal()) {
|
||||
if (i < last) {
|
||||
Log.Writeln_("Неверные настройки:" + id + ": проход " +
|
||||
CommonUtils.Brackets(code.getDescription()) +
|
||||
" может быть только последним!");
|
||||
res= false;
|
||||
}
|
||||
}
|
||||
if (matches.contains(code)) {
|
||||
Log.Writeln_("Неверные настройки:" + id + ": проход " +
|
||||
CommonUtils.Brackets(code.getDescription()) +
|
||||
" запрещено применять более одного раза!");
|
||||
res=false;
|
||||
} else matches.add(code);
|
||||
}
|
||||
//-
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package _VisualDVM.TestingSystem.SAPFOR.SapforSettings;
|
||||
import Common.Visual.Menus.DataMenuBar;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
public class SapforSettingsBar extends DataMenuBar {
|
||||
public SapforSettingsBar() {
|
||||
super("параметры тестирования",
|
||||
PassCode_2021.PublishSapforSettings,
|
||||
PassCode_2021.CloneSapforSettings,
|
||||
PassCode_2021.EditSapforSettings,
|
||||
PassCode_2021.DeleteSapforSettings
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package _VisualDVM.TestingSystem.SAPFOR.SapforSettings;
|
||||
import Common.Utils.CommonUtils;
|
||||
import _VisualDVM.Current;
|
||||
import Common.Visual.DataSetControlForm;
|
||||
import Common.Visual.Windows.Dialog.DBObjectDialog;
|
||||
import Common.Database.Objects.DBObject;
|
||||
import Common.Database.Tables.FKBehaviour;
|
||||
import Common.Database.Tables.FKCurrentObjectBehaviuor;
|
||||
import Common.Database.Tables.FKDataBehaviour;
|
||||
import Common.Database.Tables.iDBTable;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI.SapforSettingsFields;
|
||||
import _VisualDVM.TestingSystem.SAPFOR.SapforSettingsCommand.SapforSettingsCommand;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class SapforSettingsDBTable extends iDBTable<SapforSettings> {
|
||||
public SapforSettingsDBTable() {
|
||||
super(SapforSettings.class);
|
||||
}
|
||||
@Override
|
||||
public Current CurrentName() {
|
||||
return Current.SapforSettings;
|
||||
}
|
||||
@Override
|
||||
public String getSingleDescription() {
|
||||
return "параметры тестирования системы SAPFOR";
|
||||
}
|
||||
@Override
|
||||
public String getPluralDescription() {
|
||||
return "параметры тестирования системы SAPFOR";
|
||||
}
|
||||
@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(SapforSettings object, int columnIndex) {
|
||||
switch (columnIndex) {
|
||||
case 2:
|
||||
return object.description;
|
||||
case 3:
|
||||
return object.sender_name;
|
||||
case 4:
|
||||
return object.flags;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
//-
|
||||
@Override
|
||||
public DBObjectDialog<SapforSettings, SapforSettingsFields> getDialog() {
|
||||
return new DBObjectDialog<SapforSettings, SapforSettingsFields>(SapforSettingsFields.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);
|
||||
}
|
||||
@Override
|
||||
public void ProcessResult() {
|
||||
Result.description = fields.tfName.getText();
|
||||
Result.FREE_FORM = CommonUtils.fromBoolean(fields.cbFREE_FORM.isSelected());
|
||||
Result.KEEP_DVM_DIRECTIVES = CommonUtils.fromBoolean(fields.cbKEEP_DVM_DIRECTIVES.isSelected());
|
||||
Result.KEEP_SPF_DIRECTIVES = CommonUtils.fromBoolean(fields.cbKEEP_SPF_DIRECTIVES.isSelected());
|
||||
Result.STATIC_SHADOW_ANALYSIS = CommonUtils.fromBoolean(fields.cbSTATIC_SHADOW_ANALYSIS.isSelected());
|
||||
Result.MAX_SHADOW_WIDTH = fields.sMAX_SHADOW_WIDTH.getValue();
|
||||
Result.packFlags();
|
||||
}
|
||||
@Override
|
||||
public void SetReadonly() {
|
||||
fields.tfName.setEnabled(false);
|
||||
}
|
||||
};
|
||||
}
|
||||
@Override
|
||||
public LinkedHashMap<Class<? extends DBObject>, FKBehaviour> getFKDependencies() {
|
||||
LinkedHashMap<Class<? extends DBObject>, FKBehaviour> res = new LinkedHashMap<>();
|
||||
res.put(SapforSettingsCommand.class, new FKBehaviour(FKDataBehaviour.DELETE, FKCurrentObjectBehaviuor.ACTIVE));
|
||||
return res;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI.SapforSettingsCommandFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="2" 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>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="4edf7" 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"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<font name="Times New Roman" size="16" style="2"/>
|
||||
<text value="проход"/>
|
||||
</properties>
|
||||
</component>
|
||||
<vspacer id="40ef0">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</vspacer>
|
||||
<component id="64847" class="javax.swing.JComboBox" binding="cbPassCode" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<toolTipText value="выберите проход"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -0,0 +1,33 @@
|
||||
package _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI;
|
||||
import Common.Visual.CommonUI;
|
||||
import Common.Visual.Tables.StyledCellLabel;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
import _VisualDVM.Repository.Component.Sapfor.Sapfor;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class SapforSettingsCommandFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JComboBox<PassCode_2021> cbPassCode;
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
cbPassCode = new JComboBox<>();
|
||||
cbPassCode.setRenderer((list, value, index, isSelected, cellHasFocus) -> {
|
||||
JLabel res = new StyledCellLabel();
|
||||
res.setText(value.getDescription());
|
||||
res.setBackground(isSelected ?
|
||||
CommonUI.getTheme().selection_background : CommonUI.getTheme().background
|
||||
);
|
||||
return res;
|
||||
});
|
||||
//-
|
||||
for (PassCode_2021 code : Sapfor.getScenariosCodes())
|
||||
cbPassCode.addItem(code);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="_VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI.SapforSettingsFields">
|
||||
<grid id="27dc6" binding="content" layout-manager="BorderLayout" hgap="0" vgap="0">
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="528" height="400"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="3b4b2" layout-manager="GridLayoutManager" row-count="8" 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 border-constraint="Center"/>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="2c43d" 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="2c147">
|
||||
<constraints>
|
||||
<grid row="7" 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="7844f" 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="7788a" class="javax.swing.JCheckBox" binding="cbFREE_FORM">
|
||||
<constraints>
|
||||
<grid row="1" 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="243fb" class="javax.swing.JCheckBox" binding="cbKEEP_SPF_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="Сохранять SPF директивы"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="16d89" class="javax.swing.JLabel">
|
||||
<constraints>
|
||||
<grid row="5" 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="5eba5" class="javax.swing.JCheckBox" binding="cbSTATIC_SHADOW_ANALYSIS">
|
||||
<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="27b84" class="javax.swing.JCheckBox" binding="cbKEEP_DVM_DIRECTIVES">
|
||||
<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="Учитывать DVM директивы"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="d47f0" class="javax.swing.JSlider" binding="sMAX_SHADOW_WIDTH">
|
||||
<constraints>
|
||||
<grid row="6" 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,23 @@
|
||||
package _VisualDVM.TestingSystem.SAPFOR.SapforSettings.UI;
|
||||
import Common.Visual.TextField.StyledTextField;
|
||||
import Common.Visual.Windows.Dialog.DialogFields;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class SapforSettingsFields implements DialogFields {
|
||||
private JPanel content;
|
||||
public JTextField tfName;
|
||||
public JCheckBox cbFREE_FORM;
|
||||
public JCheckBox cbKEEP_SPF_DIRECTIVES;
|
||||
public JCheckBox cbSTATIC_SHADOW_ANALYSIS;
|
||||
public JCheckBox cbKEEP_DVM_DIRECTIVES;
|
||||
public JSlider sMAX_SHADOW_WIDTH;
|
||||
@Override
|
||||
public Component getContent() {
|
||||
return content;
|
||||
}
|
||||
private void createUIComponents() {
|
||||
// TODO: place custom component creation code here
|
||||
tfName = new StyledTextField();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user