Перенос.

This commit is contained in:
2023-09-17 22:13:42 +03:00
parent dd2e0ca7e0
commit 629d8b8477
1239 changed files with 61161 additions and 1 deletions

View File

@@ -0,0 +1,18 @@
package GlobalData.EnvironmentValue;
import Common.Current;
import Common.Database.iDBObject;
import Common.Utils.Utils;
public class EnvironmentValue extends iDBObject {
public String name = "";
public String value = "";
public int machine_id = Utils.Nan; //для удаления машин
public int run_configuration_id = Utils.Nan;
@Override
public boolean isVisible() {
return Current.HasRunConfiguration() && (run_configuration_id == Current.getRunConfiguration().id);
}
@Override
public String toString() {
return name + "=" + Utils.DQuotes(value);
}
}

View File

@@ -0,0 +1,98 @@
package GlobalData.EnvironmentValue;
import Common.Current;
import Common.Database.iDBTable;
import Common.Global;
import Common.UI.DataSetControlForm;
import Common.UI.UI;
import Common.UI.Windows.Dialog.DBObjectDialog;
import Common.Utils.Utils;
import GlobalData.EnvironmentValue.UI.EnvironmentValueFields;
public class EnvironmentValuesDBTable extends iDBTable<EnvironmentValue> {
public EnvironmentValuesDBTable() {
super(EnvironmentValue.class);
}
@Override
public String getSingleDescription() {
return "переменная окружения";
}
@Override
public String getPluralDescription() {
return "переменные окружения";
}
@Override
public DBObjectDialog<EnvironmentValue, EnvironmentValueFields> getDialog() {
return new DBObjectDialog<EnvironmentValue, EnvironmentValueFields>(EnvironmentValueFields.class) {
@Override
public void fillFields() {
UI.TrySelect(fields.cbName, Result.name);
fields.tfValue.setText(Result.value);
}
//https://javarush.ru/groups/posts/regulyarnye-vyrazheniya-v-java
@Override
public void validateFields() {
String name = (String) fields.cbName.getSelectedItem();
String value = fields.tfValue.getText();
if (name.isEmpty())
Log.Writeln("Имя переменной окружения не может быть пустым.");
if (!name.matches("\\w*")) {
Log.Writeln("Имя переменной окружения может содержать только латинские буквы, цифры и подчёркивания");
}
if (Utils.isLinuxSystemCommand(name))
Log.Writeln(Utils.DQuotes(name) + " является системной командой Linux,\nи не может быть задано в качестве имени переменной окружения.");
if (value.contains("\"")) {
Log.Writeln("Значение переменной окружения не может содержать двойные кавычки");
}
for (EnvironmentValue env : Global.db.environmentValues.Data.values()) {
if (env.isVisible() && (Result.id != env.id) && (env.name.equals(name))) {
Log.Writeln("В конфигурации запуска уже задана переменная окружения с именем " + Utils.Brackets(name));
break;
}
}
}
@Override
public void ProcessResult() {
Result.machine_id = Current.getMachine().id;
Result.run_configuration_id = Current.getRunConfiguration().id;
Result.name = (String) fields.cbName.getSelectedItem();
Result.value = fields.tfValue.getText();
}
@Override
public int getDefaultHeight() {
return 200;
}
};
}
@Override
protected DataSetControlForm createUI() {
return new DataSetControlForm(this){
@Override
protected void AdditionalInitColumns() {
columns.get(0).setVisible(false);
}
};
}
@Override
public String[] getUIColumnNames() {
return new String[]{"имя", "значение"};
}
@Override
public Object getFieldAt(EnvironmentValue object, int columnIndex) {
switch (columnIndex) {
case 1:
return object.name;
case 2:
return object.value;
}
return null;
}
@Override
public Current CurrentName() {
return Current.EnvironmentValue;
}
public EnvironmentValue getEnvByName(String name_in) {
for (EnvironmentValue environmentValue : Data.values())
if (environmentValue.name.equalsIgnoreCase(name_in)) return environmentValue;
return null;
}
}

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="GlobalData.EnvironmentValue.UI.EnvironmentValueFields">
<grid id="27dc6" binding="content" layout-manager="GridLayoutManager" row-count="3" 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="4db5a" class="javax.swing.JComboBox" binding="cbName">
<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>
<editable value="true"/>
<font name="Times New Roman" size="16" style="0"/>
<model/>
<toolTipText value="Выберите из списка дополнительную команду компиляции ( актуально для DVM компиляторов)"/>
</properties>
</component>
<vspacer id="eb1a6">
<constraints>
<grid row="2" column="1" 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="508af" 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>
<component id="1a477" 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"/>
</constraints>
<properties>
<font name="Times New Roman" size="16" style="2"/>
<text value="значение"/>
</properties>
</component>
<component id="abfff" class="javax.swing.JTextField" binding="tfValue" custom-create="true">
<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">
<preferred-size width="150" height="-1"/>
</grid>
</constraints>
<properties/>
</component>
</children>
</grid>
</form>

View File

@@ -0,0 +1,22 @@
package GlobalData.EnvironmentValue.UI;
import Common.UI.TextField.StyledTextField;
import Common.UI.Windows.Dialog.DialogFields;
import javax.swing.*;
import java.awt.*;
public class EnvironmentValueFields implements DialogFields {
public JPanel content;
public JComboBox cbName;
public JTextField tfValue;
public EnvironmentValueFields() {
cbName.addItem("");
}
@Override
public Component getContent() {
return content;
}
private void createUIComponents() {
// TODO: place custom component creation code here
tfValue = new StyledTextField();
}
}