рефакторинг хранения окон

This commit is contained in:
2024-10-15 02:32:52 +03:00
parent 1f6cc4a579
commit 2999390b91
105 changed files with 421 additions and 318 deletions

View File

@@ -1,5 +1,6 @@
package _VisualDVM.Visual.Interface;
import Common.Visual.Trees.TreeForm;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
public interface ProjectWindow {
//-
@@ -28,12 +29,12 @@ public interface ProjectWindow {
ShowFunctions();
getArraysWindow().ShowArrays();
//------------------------------>>
UI.getVersionsWindow().getVariantsWindow().ShowVariantsFilterButtons();
UI.getVersionsWindow().getVariantsWindow().ShowProjectDistribution();
UI.getVersionsWindow().getVariantsWindow().ShowVariantsFilter();
UI.getVersionsWindow().getVariantsWindow().ShowTotalVariantsCount();
UI.getVersionsWindow().getVariantsWindow().ShowFilteredVariantsCount();
UI.getVersionsWindow().getVariantsWindow().ShowCheckedVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowVariantsFilterButtons();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowProjectDistribution();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowVariantsFilter();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowTotalVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowFilteredVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowCheckedVariantsCount();
//----------------------------->>
getAnalysisWindow().ShowMetrics();
getAnalysisWindow().ShowLoopsCount();
@@ -47,12 +48,12 @@ public interface ProjectWindow {
ShowNoFunctions();
getFunctionsWindow().ShowNoCurrentFunction();
getArraysWindow().ShowNoArrays();
UI.getVersionsWindow().getVariantsWindow().ShowNoProjectDistribution();
UI.getVersionsWindow().getVariantsWindow().ShowNoVariants();
UI.getVersionsWindow().getVariantsWindow().ShowNoVariantsFilter();
UI.getVersionsWindow().getVariantsWindow().ShowNoTotalVariantsCount();
UI.getVersionsWindow().getVariantsWindow().ShowNoFilteredVariantsCount();
UI.getVersionsWindow().getVariantsWindow().ShowNoCheckedVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoProjectDistribution();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoVariants();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoVariantsFilter();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoTotalVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoFilteredVariantsCount();
Global.mainModule.getUI().getVersionsWindow().getVariantsWindow().ShowNoCheckedVariantsCount();
getAnalysisWindow().ShowNoMetrics();
getAnalysisWindow().ShowNoRegions();
getAnalysisWindow().ShowLoopsCount();

View File

@@ -1,31 +1,103 @@
package _VisualDVM.Visual;
import Common.Visual.UIModule_;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.RemoteFile.UI.RemoteFileChooser;
import _VisualDVM.Repository.Component.UI.ComponentsForm;
import _VisualDVM.TestingSystem.Common.TestingMenuBar;
import _VisualDVM.Visual.Interface.DebugWindow;
import _VisualDVM.Visual.Interface.VersionsWindow;
import _VisualDVM.Visual.Menus.CredentialsBar.CredentialsMenuBar;
import _VisualDVM.Visual.Menus.FileMenuBar.FileMenuBar;
import _VisualDVM.Visual.Menus.MainMenuBar.MainMenuBar;
import _VisualDVM.Visual.Menus.MainMenuBar.MainWindow;
import _VisualDVM.Visual.Menus.VersionsMenuBar.VersionsMenuBar;
import _VisualDVM.Visual.Syntax.LightSPFEditorTheme;
import _VisualDVM.Visual.Windows.*;
public class MainUI extends UIModule_ {
public MainWindow mainWindow = null;
ComponentsForm componentsWindow = null;
public SearchReplaceForm searchReplaceWindow = null;
public ProfilesForm profilesWindow = null;
public VersionsWindow versionsWindow = null;
public DebugWindow debugWindow = null;
public RemoteFileChooser remoteFileChooser = null;
//-
TestingMenuBar testingMenuBar = null;
CredentialsMenuBar credentialsMenuBar = null;
VersionsMenuBar versionsMenuBar = null;
public TestingMenuBar getTestingMenuBar(){
if (testingMenuBar ==null)
//-
public TestingMenuBar getTestingMenuBar() {
if (testingMenuBar == null)
testingMenuBar = new TestingMenuBar();
return testingMenuBar;
}
public VersionsMenuBar getVersionsMenuBar(){
if (versionsMenuBar ==null)
public VersionsMenuBar getVersionsMenuBar() {
if (versionsMenuBar == null)
versionsMenuBar = new VersionsMenuBar();
return versionsMenuBar;
}
public CredentialsMenuBar getCredentialsMenuBar(){
if (credentialsMenuBar==null)
credentialsMenuBar= new CredentialsMenuBar();
public CredentialsMenuBar getCredentialsMenuBar() {
if (credentialsMenuBar == null)
credentialsMenuBar = new CredentialsMenuBar();
return credentialsMenuBar;
}
public MainUI(){
//-
//-
public MainUI() {
setTheme(new LightSPFEditorTheme());
}
public MainWindow getMainWindow() {
if (mainWindow == null)
mainWindow = new MainForm();
return mainWindow;
}
public boolean hasMainWindow() {
return mainWindow != null;
}
public ComponentsForm getComponentsWindow() {
if (componentsWindow == null)
componentsWindow = new ComponentsForm();
return componentsWindow;
}
//--
//возможно перекинуть на тестирование. потом.
public DebugWindow getDebugWindow() {
if (debugWindow == null)
debugWindow = new DebugForm();
return debugWindow;
}
public void HideSearchForm() {
if (searchReplaceWindow.isVisible())
searchReplaceWindow.setVisible(false);
}
public VersionsWindow getVersionsWindow() {
return versionsWindow;
}
public SearchReplaceForm getSearchReplaceWindow() {
if (searchReplaceWindow == null)
searchReplaceWindow = new SearchReplaceForm();
return searchReplaceWindow;
}
public void ShowSearchForm(boolean replace) {
searchReplaceWindow.setMode(replace);
searchReplaceWindow.ShowMode();
ShowSearchForm();
}
public void ShowSearchForm() {
if (searchReplaceWindow.isVisible())
searchReplaceWindow.Refresh();
else
searchReplaceWindow.Show();
}
public RemoteFileChooser getRemoteFileChooser() {
if (remoteFileChooser == null)
remoteFileChooser = new RemoteFileChooser();
return remoteFileChooser;
}
public void CreateVersionsWindow() {
versionsWindow = new VersionsForm(Global.mainModule.getRoot());
}
public ProfilesForm getProfilesWindow() {
if (profilesWindow == null)
profilesWindow = new ProfilesForm();
return profilesWindow;
}
}

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Visual.Menus.FileMenuBar;
import Common.Visual.Controls.MenuBarButton;
import Common.Visual.Menus.VisualiserMenuBar;
import _VisualDVM.Global;
import _VisualDVM.Passes.PassCode;
import _VisualDVM.ProjectData.Files.UI.Editor.SPFEditor;
import _VisualDVM.Visual.UI;
@@ -19,7 +20,7 @@ public class FileMenuBar extends VisualiserMenuBar {
{
setToolTipText("Поиск(Ctrl+F)");
setIcon("/icons/LastOpened.png");
addActionListener(e -> UI.ShowSearchForm());
addActionListener(e -> Global.mainModule.getUI().ShowSearchForm());
}
});
addPasses(PassCode.Save);

View File

@@ -22,7 +22,7 @@ public class FileSettingsMenu extends VisualiserMenu {
if (Global.mainModule.getFile().UpdateLanguage(languageName)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
Global.mainModule.getFile().form.ShowLanguage();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
Global.mainModule.getUI().getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
}
}
});
@@ -44,7 +44,7 @@ public class FileSettingsMenu extends VisualiserMenu {
public void action(FileType fileType) {
if (Global.mainModule.getFile().UpdateType(fileType)) {
Global.mainModule.getSapfor().ResetAllAnalyses();
UI.getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
Global.mainModule.getUI().getMainWindow().getProjectWindow().getFilesTreeForm().getTree().RefreshNode(Global.mainModule.getFile().node);
Global.mainModule.getFile().form.ShowType();
}
}

View File

@@ -34,7 +34,7 @@ public class MainMenuBar extends VisualiserMenuBar {
} else {
Global.mainModule.getPass(PassCode.GetComponentsActualVersions).Do();
Global.RefreshUpdatesStatus();
UI.ShowComponentsWindow();
Global.mainModule.getUI().getComponentsWindow().ShowDialog("");
}
});
}

View File

@@ -49,7 +49,7 @@ public class ProjectFilesMenu extends GraphMenu {
{
addActionListener(e -> {
if (Global.mainModule.HasProject()) {
UI.getVersionsWindow().getVersionsForm().getTree().SelectNode(Global.mainModule.getProject().node);
Global.mainModule.getUI().getVersionsWindow().getVersionsForm().getTree().SelectNode(Global.mainModule.getProject().node);
Global.mainModule.getPass(PassCode.DeleteVersion).Do();
}
});
@@ -62,7 +62,7 @@ public class ProjectFilesMenu extends GraphMenu {
Global.files_multiselection = !Global.files_multiselection;
m_multiselection.setIcon(Utils_.getIcon(Global.files_multiselection ? "/icons/Pick.png" : "/icons/NotPick.png"));
Global.mainModule.getProject().SelectAllFiles(false);
UI.getMainWindow().getProjectWindow().RefreshProjectFiles();
Global.mainModule.getUI().getMainWindow().getProjectWindow().RefreshProjectFiles();
//-
});
add(m_multiselection);

View File

@@ -1,6 +1,7 @@
package _VisualDVM.Visual.Menus.ProjectMenuBar;
import Common.Visual.Controls.MenuBarButton;
import Common.Visual.Menus.VisualiserMenuBar;
import _VisualDVM.Global;
import _VisualDVM.Visual.UI;
import javax.swing.*;
@@ -18,7 +19,7 @@ public class ProjectMenuBar extends VisualiserMenuBar {
setToolTipText("Профили");
setIcon("/icons/Profiles.png");
addActionListener(e -> {
UI.ShowProfilesWindow();
Global.mainModule.getUI().getProfilesWindow().ShowDialog("");
});
}
});

View File

@@ -22,7 +22,7 @@ public class ProjectViewMenu extends VisualiserMenu {
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeItalic));
addActionListener(e -> {
Global.mainModule.set(Current.ProjectView, view);
UI.getMainWindow().getProjectWindow().ShowProjectView();
Global.mainModule.getUI().getMainWindow().getProjectWindow().ShowProjectView();
});
}
};

View File

@@ -21,7 +21,7 @@ public class VersionsMenu extends GraphMenu<DataTree> {
Global.versions_multiselection = !Global.versions_multiselection;
m_multiselection.setIcon(Utils_.getIcon(Global.versions_multiselection ? "/icons/Pick.png" : "/icons/NotPick.png"));
Global.mainModule.getRoot().SelectAllVersions(false);
UI.getVersionsWindow().getVersionsForm().getTree().updateUI();
Global.mainModule.getUI().getVersionsWindow().getVersionsForm().getTree().updateUI();
});
add(m_multiselection);
addSeparator();

View File

@@ -49,24 +49,6 @@ public class UI {
public static LinkedHashMap<Common.Visual.Tables.TableEditors, TableCellEditor> TableEditors = new LinkedHashMap<>();
public static LinkedHashMap<Common.Visual.Trees.TreeRenderers, TreeCellRenderer> TreeRenderers = new LinkedHashMap<>();
//ФОРМЫ
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 boolean HasMainWindow() {
return mainWindow != null;
}
public static void CreateWindows() {
searchReplaceWindow = new SearchReplaceForm();
remoteFileChooser = new RemoteFileChooser();
profilesWindow = new ProfilesForm();
mainWindow = new MainForm();
//---------------------------------------
mainWindow.Show();
}
//-
public static void CreateAll() {
//<editor-fold desc="Объекты отрисовки и редактирования деревьев и таблиц">
@@ -103,9 +85,6 @@ public class UI {
TableEditors.put(EditorAutoConfiguration, new ConfigurationAutoSwitcher());
//</editor-fold>
}
public static void CreateComponentsForm() {
componentsWindow = new ComponentsForm();
}
//-----
public static void ShowTabsNames(JTabbedPane tabs) {
ShowTabsNames(tabs, 0);
@@ -115,54 +94,4 @@ public class UI {
for (int i = startIndex; i < tabs.getTabCount(); ++i)
tabs.setTitleAt(i, flag ? tabs.getToolTipTextAt(i) : "");
}
public static void CreateVersionsWindow() {
versionsWindow = new VersionsForm(Global.mainModule.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;
}
}

View File

@@ -366,7 +366,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
public void EnableBugreports() {
UI_.Clear(accountPanel);
accountPanel.add(SC10);
UI.getMainWindow().SwitchTestingTabs(true);
Global.mainModule.getUI().getMainWindow().SwitchTestingTabs(true);
}
@Override
public void setUserRights() {

View File

@@ -216,7 +216,7 @@ public class FileForm implements FileWindow, FormWithSplitters {
public void ShowText() {
UI_.Clear(editorPanel);
editorPanel.add(new RTextScrollPane(Body = new SPFEditor(file)));
UI.getSearchReplaceWindow().updateEditor(Body);
Global.mainModule.getUI().getSearchReplaceWindow().updateEditor(Body);
}
@Override
public void ShowMessages() {

View File

@@ -61,14 +61,14 @@ public class MainForm extends Form implements MainWindow {
@Override
public void AfterClose() {
Global.mainModule.getPass(PassCode.CloseCurrentProject).Do();
if (UI.getVersionsWindow() != null)
((VersionsForm) UI.getVersionsWindow()).SaveSplitters();
if (Global.mainModule.getUI().getVersionsWindow() != null)
((FormWithSplitters)Global.mainModule.getUI().getVersionsWindow()).SaveSplitters();
SaveCallbackPanel();
SaveTestsPanel();
SaveTestingPanel();
//--
if (UI.getDebugWindow() != null)
((FormWithSplitters) UI.getDebugWindow()).SaveSplitters();
if (Global.mainModule.getUI().getDebugWindow() != null)
((FormWithSplitters) Global.mainModule.getUI().getDebugWindow()).SaveSplitters();
//--
Global.mainModule.getDb().SaveCredentials();
//--
@@ -245,7 +245,7 @@ public class MainForm extends Form implements MainWindow {
RemoveProjectPanel();
InstallProjectPanel();
restoreGlobalTab();
UI.getDebugWindow().DropCompilationTasksComparison();
Global.mainModule.getUI().getDebugWindow().DropCompilationTasksComparison();
mainMenuBar.ShowProject(true);
}
@Override

View File

@@ -67,7 +67,7 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
filesForm.Show();
InstallVersionsPanel();
InstallDebugPanel();
UI.getDebugWindow().ShowAll();
Global.mainModule.getUI().getDebugWindow().ShowAll();
ShowAllAnalyses();
ShowProjectView();
SwitchScreen((Global.mainModule.getDb()).settings.get(SettingName.SmallScreen).toBoolean());
@@ -231,8 +231,8 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
DBProjectFile badFile = Global.mainModule.getProject().getFirstBadFile();
if (badFile != null) {
Global.mainModule.getPass(PassCode.OpenCurrentFile).Do(badFile);
UI.getMainWindow().FocusProject();
UI.getMainWindow().getProjectWindow().FocusFile();
Global.mainModule.getUI().getMainWindow().FocusProject();
Global.mainModule.getUI().getMainWindow().getProjectWindow().FocusFile();
}
//-
if (Global.mainModule.HasFile()) {
@@ -277,13 +277,13 @@ public class ProjectForm implements FormWithSplitters, ProjectWindow {
private void InstallVersionsPanel() {
projectTabs.insertTab("",
Utils_.getIcon("/icons/VersionsTree.png"),
UI.getVersionsWindow().getContent(),
Global.mainModule.getUI().getVersionsWindow().getContent(),
"Версии", 5);
}
private void InstallDebugPanel() {
projectTabs.insertTab("",
Utils_.getIcon("/icons/Command.png"),
UI.getDebugWindow().getContent(),
Global.mainModule.getUI().getDebugWindow().getContent(),
"Компиляция и запуск", 6);
}
@Override

View File

@@ -119,9 +119,9 @@ public class SapforPackagesComparisonForm {
lObjectName.setToolTipText("Объект не назначен.");
showNoTree();
if (isMaster()) {
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersionEtalon();
Global.mainModule.getUI().getMainWindow().getTestingWindow().ShowNoSapforPackageVersionEtalon();
} else {
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersion();
Global.mainModule.getUI().getMainWindow().getTestingWindow().ShowNoSapforPackageVersion();
}
}
//---
@@ -233,8 +233,8 @@ public class SapforPackagesComparisonForm {
showNoTree();
slave.showNoTree();
//--->>>
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersionEtalon();
UI.getMainWindow().getTestingWindow().ShowNoSapforPackageVersion();
Global.mainModule.getUI().getMainWindow().getTestingWindow().ShowNoSapforPackageVersionEtalon();
Global.mainModule.getUI().getMainWindow().getTestingWindow().ShowNoSapforPackageVersion();
}
@Override
protected void body() throws Exception {

View File

@@ -129,7 +129,7 @@ public class SearchReplaceForm extends Form {
}
@Override
public Component getRelative() {
return (Component) UI.getMainWindow();
return (Component) Global.mainModule.getUI().getMainWindow();
}
@Override
public int getDefaultWidth() {