no message

This commit is contained in:
2024-10-08 23:21:42 +03:00
parent e0974fe4a8
commit 31c0cad38f
12 changed files with 230 additions and 517 deletions

View File

@@ -3,6 +3,7 @@ import Common.Database.Tables.DataSet;
import Common.Mode;
import Common.Utils.CommonUtils;
import Common.Visual.Themes.DefaultTheme;
import Common.Visual.Themes.ThemeElement;
import Common.Visual.Themes.VisualiserTheme;
import _VisualDVM.Global;

View File

@@ -91,8 +91,6 @@ public enum Current implements CurrentAnchestor {
//-
Credentials,
//-
DialogWindow,
//-
PackageVersion,
SapforConfiguration,
SapforProfile,
@@ -201,8 +199,6 @@ public enum Current implements CurrentAnchestor {
return "Пользователь";
case Compiler:
return "Компилятор";
case DialogWindow:
return "Диалоговое окно";
default:
return "";
}

View File

@@ -1,10 +1,94 @@
package Common_old;
import Common.Utils.CommonUtils;
import Common_old.UI.Menus_2023.StableMenuItem;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
import com.google.gson.annotations.Expose;
import javax.swing.*;
import java.io.File;
import java.lang.reflect.Field;
import java.nio.file.Paths;
public class GlobalProperties extends Properties {
@Override
public class GlobalProperties {
@Expose
public Common.Mode Mode = Common.Mode.Normal;
@Expose
public String ServerAddress = "alex-freenas.ddns.net";
@Expose
public String ServerUserName = "testuser";
@Expose
public int ServerUserSHHPort = 23;
@Expose
public int ComponentsServerPort = 7995;
@Expose
public int TestingServerPort = 7998;
@Expose
public int SocketTimeout = 5000;
@Expose
public boolean OldServer = false;
@Expose
public String SMTPHost = "smtp.mail.ru";
@Expose
public int SMTPPort = 465;
@Expose
public int MailSocketPort = 465;
@Expose
public boolean collapseCredentials = false;
@Expose
public boolean collapseFileGraphs = false;
@Expose
public boolean collapseFileMessages = false;
@Expose
public boolean collapseProjectTrees = false;
@Expose
public String BackupWorkspace = "_sapfor_x64_backups";
@Expose
public int BackupHour = 5;
@Expose
public int BackupMinute = 0;
@Expose
public boolean EmailAdminsOnStart = false;
@Expose
public boolean AutoUpdateSearch = true;
@Expose
public boolean ConfirmPassesStart = true;
@Expose
public boolean ShowPassesDone = true;
@Expose
public boolean FocusPassesResult = true;
@Expose
public String GlobalDBName = "db7.sqlite";
@Expose
public String ProjectDBName = "new_project_base.sqlite";
@Expose
public String BugReportsDBName = "bug_reports.sqlite";
@Expose
public String TestsDBName = "tests.sqlite";
@Expose
public int ComponentsWindowWidth = 650;
@Expose
public int ComponentsWindowHeight = 250;
@Expose
public String VisualiserPath = "";
@Expose
public String Sapfor_FPath = "";
@Expose
public String Visualizer_2Path = "";
@Expose
public String InstructionPath = "";
@Expose
public String PerformanceAnalyzerPath = "";
@Expose
public int ComponentsBackUpsCount = 10;
@Expose
public boolean AutoCheckTesting = false; // проверять ли задачи тестирования при включенном визуализаторе.
@Expose
public int CheckTestingIntervalSeconds = 10; //интервал автопроверки тестирования
@Expose
public boolean EmailOnTestingProgress = false; //включено ли оповещение по email о результатах тестирования.
@Expose
public boolean eraseTestingWorkspaces = true; //удалять ли рабочее пространство пакетов тестирования после его завершения
//-----------------
public String getFieldDescription(String fieldName) {
switch (fieldName) {
case "ShowPassesDone":
@@ -25,101 +109,6 @@ public class GlobalProperties extends Properties {
return "?";
}
}
@Expose
public Common.Mode Mode = Common.Mode.Normal;
@Expose
public String ServerAddress = "alex-freenas.ddns.net";
@Expose
public String ServerUserName = "testuser";
@Expose
public int ServerUserSHHPort = 23;
@Expose
public int ComponentsServerPort = 7995;
@Expose
public int TestingServerPort = 7998;
//---
@Expose
public int SocketTimeout = 5000;
@Expose
public boolean OldServer = false;
//---
@Expose
public String SMTPHost = "smtp.mail.ru";
@Expose
public int SMTPPort = 465;
@Expose
public int MailSocketPort = 465;
//---
//СВОРАЧИВАНИЕ ОБЛАСТЕЙ----------------------
@Expose
public boolean collapseCredentials = false;
@Expose
public boolean collapseFileGraphs = false;
@Expose
public boolean collapseFileMessages = false;
@Expose
public boolean collapseProjectTrees = false;
//-------------------------------------------
@Expose
public String BackupWorkspace = "_sapfor_x64_backups";
@Expose
public int BackupHour = 5;
@Expose
public int BackupMinute = 0;
@Expose
public boolean EmailAdminsOnStart = false;
//---
@Expose
public boolean AutoUpdateSearch = true;
@Expose
public boolean ConfirmPassesStart = true;
@Expose
public boolean ShowPassesDone = true;
@Expose
public boolean FocusPassesResult = true;
@Expose
public String GlobalDBName = "db7.sqlite";
@Expose
public String ProjectDBName = "new_project_base.sqlite";
@Expose
public String BugReportsDBName = "bug_reports.sqlite";
@Expose
public String TestsDBName = "tests.sqlite";
//-
@Expose
public int ComponentsWindowWidth = 650;
@Expose
public int ComponentsWindowHeight = 250;
//-
@Expose
public String VisualiserPath = "";
@Expose
public String Sapfor_FPath = "";
@Expose
public String Visualizer_2Path = "";
@Expose
public String InstructionPath = "";
@Expose
public String PerformanceAnalyzerPath = "";
@Expose
public int ComponentsBackUpsCount = 10;
//- тестирование.
@Expose
public boolean AutoCheckTesting = false; // проверять ли задачи тестирования при включенном визуализаторе.
@Expose
public int CheckTestingIntervalSeconds = 10; //интервал автопроверки тестирования
@Expose
public boolean EmailOnTestingProgress = false; //включено ли оповещение по email о результатах тестирования.
@Expose
public boolean eraseTestingWorkspaces = true; //удалять ли рабочее пространство пакетов тестирования после его завершения.
//-
@Override
public File getFile() {
return Paths.get(System.getProperty("user.dir"), "properties").toFile();
}
//--
public GlobalProperties() {
}
public GlobalProperties(GlobalProperties p) {
super();
Mode = p.Mode;
@@ -162,4 +151,80 @@ public class GlobalProperties extends Properties {
EmailOnTestingProgress = p.EmailOnTestingProgress;
eraseTestingWorkspaces = p.eraseTestingWorkspaces;
}
//-----------------
public void addFlagMenuItem(JMenu menu, String fieldName) {
JMenuItem menu_item = new StableMenuItem(getFieldDescription(fieldName),
getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png");
//-
menu_item.addActionListener(e -> {
if (Pass_2021.passes.get(PassCode_2021.UpdateProperty).Do(fieldName, !getFlag(fieldName)))
menu_item.setIcon(CommonUtils.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
});
menu.add(menu_item);
}
public boolean getFlag(String fieldName) {
boolean field = false;
try {
field = (boolean) getClass().getField(fieldName).get(this);
//
} catch (Exception ex) {
ex.printStackTrace();
}
return field;
}
public void switchFlag(String fieldName) {
boolean field = false;
try {
field = (boolean) getClass().getField(fieldName).get(this);
getClass().getField(fieldName).set(this, !field);
//
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void Update() {
try {
CommonUtils.jsonToFile(this, getFile());
} catch (Exception e) {
e.printStackTrace();
}
}
//--
public boolean updateField(String name, Object newValue) {
try {
Field field = getClass().getField(name);
Object oldValue = field.get(this);
//---
if (newValue.equals(oldValue))
return false;
//--
field.set(this, newValue);
this.Update();
return true;
//--
} catch (Exception exception) {
exception.printStackTrace();
}
return false;
}
public void switchAndUpdateFlag(String name) {
try {
Field field = getClass().getField(name);
boolean oldValue = (boolean) field.get(this);
boolean newValue = !oldValue;
//---
field.set(this, newValue);
this.Update();
//--
} catch (Exception exception) {
exception.printStackTrace();
}
}
public File getFile() {
return Paths.get(System.getProperty("user.dir"), "properties").toFile();
}
//--
public GlobalProperties() {
}
}

View File

@@ -1,81 +0,0 @@
package Common_old;
import Common.Utils.CommonUtils;
import Common_old.UI.Menus_2023.StableMenuItem;
import Visual_DVM_2021.Passes.PassCode_2021;
import Visual_DVM_2021.Passes.Pass_2021;
import javax.swing.*;
import java.io.File;
import java.lang.reflect.Field;
public abstract class Properties {
public void addFlagMenuItem(JMenu menu, String fieldName) {
JMenuItem menu_item = new StableMenuItem(getFieldDescription(fieldName),
getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png");
//-
menu_item.addActionListener(e -> {
if (Pass_2021.passes.get(PassCode_2021.UpdateProperty).Do(fieldName, !getFlag(fieldName)))
menu_item.setIcon(CommonUtils.getIcon(getFlag(fieldName) ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
});
menu.add(menu_item);
}
public boolean getFlag(String fieldName) {
boolean field = false;
try {
field = (boolean) GlobalProperties.class.getField(fieldName).get(this);
//
} catch (Exception ex) {
ex.printStackTrace();
}
return field;
}
public void switchFlag(String fieldName) {
boolean field = false;
try {
field = (boolean) GlobalProperties.class.getField(fieldName).get(this);
GlobalProperties.class.getField(fieldName).set(this, !field);
//
} catch (Exception ex) {
ex.printStackTrace();
}
}
public void Update() {
try {
CommonUtils.jsonToFile(this, getFile());
} catch (Exception e) {
e.printStackTrace();
}
}
//--
public abstract String getFieldDescription(String fieldName);
public abstract File getFile();
public boolean updateField(String name, Object newValue) {
try {
Field field = getClass().getField(name);
Object oldValue = field.get(this);
//---
if (newValue.equals(oldValue))
return false;
//--
field.set(this, newValue);
this.Update();
return true;
//--
} catch (Exception exception) {
exception.printStackTrace();
}
return false;
}
public void switchAndUpdateFlag(String name) {
try {
Field field = getClass().getField(name);
boolean oldValue = (boolean) field.get(this);
boolean newValue = !oldValue;
//---
field.set(this, newValue);
this.Update();
//--
} catch (Exception exception) {
exception.printStackTrace();
}
}
}

View File

@@ -1,9 +1,10 @@
package Common_old.UI;
import Common.Database.Tables.DataSet;
import Common.Utils.CommonUtils;
import Common.Visual.Themes.ThemeElement;
import Common.Visual.CommonUI;
import Common.Visual.DataMenuBar;
import Common_old.Current;
import Common_old.UI.Menus_2023.CredentialsBar.CredentialsBar;
import Common.Visual.DataMenuBar;
import Common_old.UI.Menus_2023.FastAccessMenuBar.FastAccessMenuBar;
import Common_old.UI.Menus_2023.FileMenuBar.FileMenuBar;
import Common_old.UI.Menus_2023.MainMenuBar.MainMenuBar;
@@ -13,10 +14,7 @@ import Common_old.UI.Menus_2023.VersionsMenuBar.VersionsMenuBar;
import Common_old.UI.Tables.*;
import Common_old.UI.Trees.GraphTreeCellRenderer;
import Common_old.UI.Trees.SelectionTreeCellRenderer;
import Common_old.UI.Windows.FormType;
import Common_old.UI.Windows.SearchReplaceForm;
import Common.Database.Tables.DataSet;
import Common.Visual.CommonUI;
import GlobalData.Compiler.CompilersDBTable;
import GlobalData.Compiler.CompilersMenuBar;
import GlobalData.CompilerEnvironment.UI.CompilerEnvironmentValueEditor;
@@ -102,7 +100,6 @@ import javax.swing.text.Highlighter;
import javax.swing.tree.TreeCellRenderer;
import java.awt.*;
import java.util.LinkedHashMap;
import java.util.Vector;
import static Common_old.UI.Tables.TableEditors.*;
import static Common_old.UI.Tables.TableRenderers.*;
@@ -115,27 +112,22 @@ public class UI {
public static FileMenuBar fileMenuBar = null;
public static VersionsMenuBar versionsMenuBar = null;
public static FastAccessMenuBar fastAccessMenuBar = null;
//------------
public static VersionsWindow versionsWindow = null;
public static DebugWindow debugWindow = null;
//ФОРМЫ
static MainWindow mainWindow = null;
static ComponentsForm componentsWindow = null;
static SearchReplaceForm searchReplaceWindow = null;
static ProfilesForm profilesWindow = null;
static VersionsWindow versionsWindow = null;
static DebugWindow debugWindow = null;
static RemoteFileChooser remoteFileChooser = null;
//------------
public static final Highlighter.HighlightPainter GoodLoopPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(152, 251, 152, 90));
public static final Highlighter.HighlightPainter BadLoopPainter = new DefaultHighlighter.DefaultHighlightPainter(new Color(240, 128, 128, 90));
public static LinkedHashMap<Common_old.UI.Tables.TableRenderers, TableCellRenderer> TableRenderers = new LinkedHashMap<>();
public static LinkedHashMap<Common_old.UI.Tables.TableEditors, TableCellEditor> TableEditors = new LinkedHashMap<>();
public static LinkedHashMap<Common_old.UI.Trees.TreeRenderers, TreeCellRenderer> TreeRenderers = new LinkedHashMap<>();
public static LinkedHashMap<FormType, ThemeElement> windows = new LinkedHashMap<>();
public static RemoteFileChooser getRemoteFileChooser() {
return (RemoteFileChooser) windows.get(FormType.RemoteFileChooser);
}
public static ComponentsForm getComponentsWindow() {
return (ComponentsForm) windows.get(FormType.Components);
}
public static boolean HasMainWindow() {
return getMainWindow() != null;
}
public static SearchReplaceForm getSearchReplaceForm() {
return (SearchReplaceForm) windows.get(FormType.SearchReplace);
return mainWindow != null;
}
public static void CreateMenus() {
mainMenuBar = new MainMenuBar();
@@ -185,15 +177,12 @@ public class UI {
//---->>
}
public static void CreateWindows() {
windows.put(FormType.SearchReplace, new SearchReplaceForm());
windows.put(FormType.RemoteFileChooser, new RemoteFileChooser());
windows.put(FormType.Profiles, new ProfilesForm());
windows.put(FormType.Main, new MainForm());
searchReplaceWindow = new SearchReplaceForm();
remoteFileChooser = new RemoteFileChooser();
profilesWindow = new ProfilesForm();
mainWindow = new MainForm();
//---------------------------------------
getMainWindow().Show();
}
public static MainWindow getMainWindow() {
return (MainWindow) windows.get(FormType.Main);
mainWindow.Show();
}
//-
public static void CreateAll() {
@@ -203,18 +192,15 @@ public class UI {
UIManager.put("FileChooser.lookInLabelText", "Смотреть в");
UIManager.put("FileChooser.fileNameLabelText", "Имя файла");
UIManager.put("FileChooser.filesOfTypeLabelText", "Тип файла");
UIManager.put("FileChooser.saveButtonText", "Сохранить");
UIManager.put("FileChooser.saveButtonToolTipText", "Сохранить");
UIManager.put("FileChooser.openButtonToolTipText", "Открыть");
UIManager.put("FileChooser.cancelButtonText", "Отмена");
UIManager.put("FileChooser.cancelButtonToolTipText", "Отмена");
UIManager.put("FileChooser.lookInLabelText", "Папка");
UIManager.put("FileChooser.saveInLabelText", "Папка");
UIManager.put("FileChooser.fileNameLabelText", "Имя файла");
UIManager.put("FileChooser.filesOfTypeLabelText", "Тип файлов");
UIManager.put("FileChooser.upFolderToolTipText", "На один уровень вверх");
UIManager.put("FileChooser.newFolderToolTipText", "Создание новой папки");
UIManager.put("FileChooser.listViewButtonToolTipText", "Список");
@@ -224,9 +210,7 @@ public class UI {
UIManager.put("FileChooser.fileTypeHeaderText", "Тип");
UIManager.put("FileChooser.fileDateHeaderText", "Изменен");
UIManager.put("FileChooser.fileAttrHeaderText", "Атрибуты");
UIManager.put("FileChooser.acceptAllFileFilterText", "Все файлы");
//</editor-fold>
//<editor-fold desc="Локализация компонентов окна подтверждения">
UIManager.put("OptionPane.yesButtonText", "Да");
@@ -260,7 +244,6 @@ public class UI {
TreeRenderers.put(RendererSapforVersion, new SapforVersionsTreeCellRenderer());
TreeRenderers.put(RendererRule, new RulesTreeCellRenderer());
TreeRenderers.put(RendererSelection, new SelectionTreeCellRenderer());
//----------------------------------------------
TableEditors.put(EditorSelect, new DBObjectSelector());
TableEditors.put(EditorHyperlinks, new VectorEditor());
@@ -271,58 +254,53 @@ public class UI {
//</editor-fold>
}
public static void CreateComponentsForm() {
windows.put(FormType.Components, new ComponentsForm());
}
public static ProfilesForm getProfilesWindow() {
return (ProfilesForm) windows.get(FormType.Profiles);
componentsWindow = new ComponentsForm();
}
//-----
public static void ShowTabsNames(JTabbedPane tabs) {
ShowTabsNames(tabs, 0);
}
public static void ShowTabsNames(JTabbedPane tabs, int startIndex) {
boolean flag = ((GlobalDatabase)CommonUtils.db).settings.get(SettingName.ShowFullTabsNames).toBoolean();
boolean flag = ((GlobalDatabase) CommonUtils.db).settings.get(SettingName.ShowFullTabsNames).toBoolean();
for (int i = startIndex; i < tabs.getTabCount(); ++i)
tabs.setTitleAt(i, flag ? tabs.getToolTipTextAt(i) : "");
}
public static boolean Contains(Vector<String> list, String line, int max_index) {
int last_index = -1;
for (int i = 0; i < list.size(); ++i)
if (list.get(i).equals(line)) last_index = i;
return (last_index >= max_index);
}
//--
public static VersionsWindow getVersionsWindow() {
return versionsWindow;
}
public static void CreateVersionsWindow() {
versionsWindow = new VersionsForm(Current.getRoot());
}
//-
public static void ShowSearchForm(boolean replace) {
searchReplaceWindow.setMode(replace);
searchReplaceWindow.ShowMode();
ShowSearchForm();
}
public static void HideSearchForm() {
if (searchReplaceWindow.isVisible())
searchReplaceWindow.setVisible(false);
}
public static void ShowSearchForm() {
if (searchReplaceWindow.isVisible())
searchReplaceWindow.Refresh();
else
searchReplaceWindow.Show();
}
public static void ShowComponentsWindow() {
componentsWindow.ShowDialog("");
}
public static void ShowProfilesWindow() {
profilesWindow.ShowDialog("");
}
//----
public static MainWindow getMainWindow(){return mainWindow;}
public static VersionsWindow getVersionsWindow(){return versionsWindow;}
public static ComponentsForm getComponentsWindow(){return componentsWindow;}
public static SearchReplaceForm getSearchReplaceWindow(){return searchReplaceWindow;}
public static ProfilesForm getProfilesWindow(){return profilesWindow;}
public static RemoteFileChooser getRemoteFileChooser(){return remoteFileChooser;}
//возможно перекинуть на тестирование. потом.
public static DebugWindow getDebugWindow() {
if (debugWindow == null)
debugWindow = new DebugForm();
return debugWindow;
}
//-
public static void ShowSearchForm(boolean replace) {
getSearchReplaceForm().setMode(replace);
getSearchReplaceForm().ShowMode();
ShowSearchForm();
}
public static void HideSearchForm() {
if (getSearchReplaceForm().isVisible())
getSearchReplaceForm().setVisible(false);
}
public static void ShowSearchForm() {
if (getSearchReplaceForm().isVisible())
getSearchReplaceForm().Refresh();
else
getSearchReplaceForm().Show();
}
public static void ShowComponentsWindow() {
getComponentsWindow().ShowDialog("");
}
public static void ShowProfilesWindow() {
getProfilesWindow().ShowDialog("");
}
}

View File

@@ -1,9 +0,0 @@
package Common_old.UI.Windows;
public enum FormType {
Undefined,
Main,
SearchReplace,
Components,
RemoteFileChooser,
Profiles
}

View File

@@ -373,6 +373,12 @@ public class Utils {
file.getAbsolutePath()
;
}
public static boolean containsLine(Vector<String> list, String line, int max_index) {
int last_index = -1;
for (int i = 0; i < list.size(); ++i)
if (list.get(i).equals(line)) last_index = i;
return (last_index >= max_index);
}
public static String compareTexts(String master, String slave) {
Vector<String> lines = new Vector<>(Arrays.asList(master.split("\n")));
Vector<String> slavelines = new Vector<>(Arrays.asList(slave.split("\n")));
@@ -380,7 +386,7 @@ public class Utils {
int old_j = 0;
int j = 0;
for (int i = 0; i < lines.size(); ++i) {
if (UI.Contains(slavelines, lines.get(i), old_j)) {
if (containsLine(slavelines, lines.get(i), old_j)) {
for (int k = old_j; k < slavelines.size(); ++k) {
j = k;
if (lines.get(i).equals(slavelines.get(k))) {

View File

@@ -72,19 +72,6 @@ public class ParallelVariant extends DBObject {
return String.join(";", templates_description);
}
/*
@Override
public boolean isVisible() {
boolean res = true;
if (father.f_distributed())
res = Match(true);
if (res && father.f_multiplied()) {
res = Match(false);
}
if (!res) Select(false);
return res;
}
*/
@Override
public Object getPK() {
return UniqKey;

View File

@@ -359,7 +359,7 @@ public abstract class Sapfor extends OSDComponent {
}
Global.enable_text_changed = false;
Global.transformationPermission = TransformationPermission.None;
if ((CommonUI.isActive()) && (UI.getMainWindow() != null) && (UI.getVersionsWindow() != null))
if ((CommonUI.isActive()) && (UI.HasMainWindow()) && (UI.getVersionsWindow() != null))
UI.getVersionsWindow().BlockVariants();
}
//--------------------------------------------------------------------------->>

View File

@@ -218,9 +218,7 @@ public class FileForm implements FileWindow, FormWithSplitters {
public void ShowText() {
CommonUI.Clear(editorPanel);
editorPanel.add(new RTextScrollPane(Body = new SPFEditor(file)));
UI.getSearchReplaceForm().setEditor(Body);
if (UI.getSearchReplaceForm().isVisible())
UI.getSearchReplaceForm().requestFocus();
UI.getSearchReplaceWindow().updateEditor(Body);
}
@Override
public void ShowMessages() {

View File

@@ -36,6 +36,8 @@ import java.io.File;
import java.nio.file.Paths;
import java.util.Vector;
public class Global {
//Режим
public static Mode mode = Mode.Undefined;
//--------------------------------------------------
public static GlobalProperties properties = new GlobalProperties();
//</editor-fold>
@@ -76,8 +78,7 @@ public class Global {
public static int bad_state = 0;
public static int need_update = 0;
public static int need_publish = 0;
//Режим
public static Mode mode = Mode.Undefined;
public static void SynschronizeProperties() {
try {
File new_propertiesFile = new File(CommonUtils.getHomeDirectory(), "properties");