Рефакторинг кода панели быстрого доступа.
This commit is contained in:
@@ -301,7 +301,6 @@ public class Global {
|
||||
//--
|
||||
if (mainModule.getDb().settings.get(SettingName.AutoTestsLoad).toBoolean())
|
||||
Global.mainModule.getPass(PassCode.SynchronizeTests).Do();
|
||||
Pass.CheckAllStats();
|
||||
Global.mainModule.getSapfor().refreshPid(); //без сапфора сюда это все равно не дойдет.
|
||||
UI.CreateMenus();
|
||||
UI.CreateWindows();
|
||||
|
||||
@@ -51,7 +51,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
public SettingsDBTable settings;
|
||||
public LastProjectsDBTable lastProjects;
|
||||
public AccountsDBTable accounts;
|
||||
public PassStatsDBTable passStats;
|
||||
//-
|
||||
public SapforProfilesDBTable sapforProfiles = null;
|
||||
//---------
|
||||
@@ -76,7 +75,6 @@ public class GlobalDatabase extends VisualiserDatabase {
|
||||
addTable(settings = new SettingsDBTable());
|
||||
addTable(lastProjects = new LastProjectsDBTable());
|
||||
addTable(accounts = new AccountsDBTable());
|
||||
addTable(passStats = new PassStatsDBTable());
|
||||
addTable(dvmParameters = new DVMParameterDBTable());
|
||||
addTable(sapforProfiles = new SapforProfilesDBTable());
|
||||
addTable(sapforProfilesSettings = new SapforProfileSettingsDBTable());
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
package _VisualDVM;
|
||||
import Common.Passes.Pass;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.Vector_;
|
||||
import MainModule_.MainModule_;
|
||||
import Visual_DVM_2021.Passes.PassCode;
|
||||
@@ -42,28 +40,13 @@ import javax.swing.tree.DefaultMutableTreeNode;
|
||||
import java.io.File;
|
||||
import java.util.Vector;
|
||||
public class MainModule extends MainModule_<GlobalDatabase> {
|
||||
Vector<PassCode> accountRoleDependentPasses = new Vector_<>(
|
||||
PassCode.AddSubscriber,
|
||||
PassCode.EditSubscriber,
|
||||
PassCode.DeleteSubscriber,
|
||||
PassCode.DeleteSubscriberWorkspace,
|
||||
//--
|
||||
PassCode.DownloadAllBugReportsArchives,
|
||||
//--
|
||||
PassCode.CompileServerSapfor,
|
||||
PassCode.DeleteServerSapfor,
|
||||
//
|
||||
PassCode.ShutdownComponentsServer,
|
||||
PassCode.StartComponentsServer,
|
||||
PassCode.PublishComponentsServer,
|
||||
//
|
||||
PassCode.ShutdownTestingServer,
|
||||
PassCode.StartTestingServer,
|
||||
PassCode.PublishTestingServer
|
||||
);
|
||||
public MainModule() {
|
||||
super(GlobalDatabase.class);
|
||||
}
|
||||
@Override
|
||||
public Class getPassCodesEnum() {
|
||||
return PassCode.class;
|
||||
}
|
||||
//--
|
||||
public boolean HasProject() {
|
||||
return get(Current.Project) != null;
|
||||
@@ -315,19 +298,35 @@ public class MainModule extends MainModule_<GlobalDatabase> {
|
||||
set(Current.Array, null);
|
||||
set(Current.DBArray, null);
|
||||
}
|
||||
@Override
|
||||
public Class getPassCodesEnum() {
|
||||
return PassCode.class;
|
||||
}
|
||||
public void SetUserAccess() {
|
||||
//--
|
||||
Vector<PassCode> accountRoleDependentPasses = new Vector_<>(
|
||||
PassCode.AddSubscriber,
|
||||
PassCode.EditSubscriber,
|
||||
PassCode.DeleteSubscriber,
|
||||
PassCode.DeleteSubscriberWorkspace,
|
||||
//--
|
||||
PassCode.DownloadAllBugReportsArchives,
|
||||
//--
|
||||
PassCode.CompileServerSapfor,
|
||||
PassCode.DeleteServerSapfor,
|
||||
//
|
||||
PassCode.ShutdownComponentsServer,
|
||||
PassCode.StartComponentsServer,
|
||||
PassCode.PublishComponentsServer,
|
||||
//
|
||||
PassCode.ShutdownTestingServer,
|
||||
PassCode.StartTestingServer,
|
||||
PassCode.PublishTestingServer
|
||||
);
|
||||
public void SetUserPassesAccess() {
|
||||
for (PassCode code: accountRoleDependentPasses)
|
||||
getPass(code).setControlsVisible(false);
|
||||
}
|
||||
public void SetDeveloperAccess() {
|
||||
SetUserAccess();
|
||||
public void SetDeveloperPassesAccess() {
|
||||
SetUserPassesAccess();
|
||||
getPass(PassCode.DownloadAllBugReportsArchives).setControlsVisible(true);
|
||||
}
|
||||
public void SetAdminAccess(){
|
||||
public void SetAdminPassesAccess(){
|
||||
for (PassCode code: accountRoleDependentPasses)
|
||||
getPass(code).setControlsVisible(true);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package _VisualDVM.Visual.Menus.FastAccessMenuBar;
|
||||
import Common.Passes.PassCode_;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import Visual_DVM_2021.PassStats.PassStats;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
@@ -12,7 +14,6 @@ import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.util.LinkedHashMap;
|
||||
public class FastAccessMenuBar extends VisualiserMenuBar {
|
||||
LinkedHashMap<PassCode, JButton> passesButtons = new LinkedHashMap<>();
|
||||
public FastAccessMenuBar() {
|
||||
Refresh();
|
||||
}
|
||||
@@ -21,13 +22,7 @@ public class FastAccessMenuBar extends VisualiserMenuBar {
|
||||
//если задавать PreffredSize 0, скролл НЕ РАБОТАЕТ. Магия!
|
||||
}
|
||||
public void showPass(Pass pass) {
|
||||
JButton button = null;
|
||||
if (passesButtons.containsKey(pass.code()))
|
||||
button = passesButtons.get((pass.code()));
|
||||
else {
|
||||
button = pass.createButton();
|
||||
passesButtons.put(pass.code(), button);
|
||||
}
|
||||
JButton button = pass.createButton();
|
||||
add(button);
|
||||
Dimension d = button.getPreferredSize();
|
||||
button.setPreferredSize(new Dimension(d.width, 30));
|
||||
@@ -35,14 +30,12 @@ public class FastAccessMenuBar extends VisualiserMenuBar {
|
||||
repaint();
|
||||
}
|
||||
public void Refresh() {
|
||||
UI_.Clear(this);
|
||||
Drop();
|
||||
int i = 1;
|
||||
for (Pass pass : Pass.FAPasses) {
|
||||
if (pass.stats.HasUsages()) {
|
||||
showPass(pass);
|
||||
++i;
|
||||
if (i > ((Global.mainModule.getDb()).settings.get(SettingName.FastAccessPassesCount).toInt32())) break;
|
||||
}
|
||||
for (Pass pass: Global.mainModule.getFirstAccessPasses()){
|
||||
showPass(pass);
|
||||
++i;
|
||||
if (i > ((Global.mainModule.getDb()).settings.get(SettingName.FastAccessPassesCount).toInt32())) break;
|
||||
}
|
||||
}
|
||||
public void Drop(){
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
package _VisualDVM.Visual.Windows;
|
||||
import Common.Utils.Utils_;
|
||||
import Common.Visual.UI_;
|
||||
import _VisualDVM.Current;
|
||||
import _VisualDVM.GlobalData.GlobalDatabase;
|
||||
import _VisualDVM.Global;
|
||||
import _VisualDVM.Visual.Editor.BaseEditor;
|
||||
import _VisualDVM.Visual.Editor.Viewer;
|
||||
@@ -374,20 +372,20 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
@Override
|
||||
public void setUserRights() {
|
||||
LockMyOnly();
|
||||
Global.mainModule.SetUserAccess();
|
||||
Global.mainModule.SetUserPassesAccess();
|
||||
UI.testingBar.showServerAdminLabel(false);
|
||||
adminLabel.setVisible(false);
|
||||
}
|
||||
private void setDeveloperRights() {
|
||||
UnlockMyOnly();
|
||||
Global.mainModule.SetDeveloperAccess();
|
||||
Global.mainModule.SetDeveloperPassesAccess();
|
||||
UI.testingBar.showServerAdminLabel(false);
|
||||
adminLabel.setVisible(false);
|
||||
}
|
||||
@Override
|
||||
public void setAdminRights() {
|
||||
UnlockMyOnly();
|
||||
Global.mainModule.SetAdminAccess();
|
||||
Global.mainModule.SetAdminPassesAccess();
|
||||
//--
|
||||
UI.testingBar.showServerAdminLabel(true);
|
||||
adminLabel.setVisible(true);
|
||||
@@ -438,13 +436,13 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
Global.componentsServer.db.subscribers.ClearUI();
|
||||
}
|
||||
private void ShowDraft() {
|
||||
Pass.setPassesControlsVisible(true,
|
||||
Global.mainModule.setPassesControlsVisible(true,
|
||||
PassCode.PublishBugReport,
|
||||
PassCode.SaveBugReportRecipients,
|
||||
PassCode.SaveBugReportExecutor,
|
||||
PassCode.DeleteBugReport
|
||||
);
|
||||
Pass.setPassesControlsVisible(false,
|
||||
Global.mainModule.setPassesControlsVisible(false,
|
||||
PassCode.AppendBugReportDescription,
|
||||
PassCode.AppendBugReportComment,
|
||||
PassCode.SaveBugReportDescription,
|
||||
@@ -456,12 +454,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
);
|
||||
}
|
||||
private void ShowUserExecutor() {
|
||||
Pass.setPassesControlsVisible(true,
|
||||
Global.mainModule.setPassesControlsVisible(true,
|
||||
PassCode.AppendBugReportComment,
|
||||
PassCode.UpdateBugReportProgress,
|
||||
PassCode.OpenBugReportTestProject
|
||||
);
|
||||
Pass.setPassesControlsVisible(false,
|
||||
Global.mainModule.setPassesControlsVisible(false,
|
||||
PassCode.PublishBugReport,
|
||||
PassCode.SaveBugReportRecipients,
|
||||
PassCode.SaveBugReportExecutor,
|
||||
@@ -474,7 +472,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
);
|
||||
}
|
||||
private void ShowSender() {
|
||||
Pass.setPassesControlsVisible(true,
|
||||
Global.mainModule.setPassesControlsVisible(true,
|
||||
PassCode.AppendBugReportComment,
|
||||
PassCode.UpdateBugReportProgress,
|
||||
PassCode.OpenBugReportTestProject,
|
||||
@@ -487,12 +485,12 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
PassCode.CloseBugReport,
|
||||
PassCode.DeleteBugReport
|
||||
);
|
||||
Pass.setPassesControlsVisible(false,
|
||||
Global.mainModule.setPassesControlsVisible(false,
|
||||
PassCode.PublishBugReport
|
||||
);
|
||||
}
|
||||
private void ShowUser() {
|
||||
Pass.setPassesControlsVisible(false,
|
||||
Global.mainModule.setPassesControlsVisible(false,
|
||||
PassCode.PublishBugReport,
|
||||
PassCode.SaveBugReportRecipients,
|
||||
PassCode.SaveBugReportExecutor,
|
||||
@@ -529,7 +527,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
target.sapfor_settings
|
||||
)
|
||||
);
|
||||
Pass.setPassesControlsVisible(true, PassCode.ApplyBugReportSettings);
|
||||
Global.mainModule.setPassesControlsVisible(true, PassCode.ApplyBugReportSettings);
|
||||
//
|
||||
if (target.state.equals(BugReportState.draft)) {
|
||||
ShowDraft();
|
||||
@@ -564,7 +562,7 @@ public class CallbackForm implements FormWithSplitters, CallbackWindow {
|
||||
BugReportCommentAddition.setText("");
|
||||
BugReportSettings.setText("");
|
||||
//-
|
||||
Pass.setPassesControlsVisible(false, PassCode.SaveBugReportExecutor,
|
||||
Global.mainModule.setPassesControlsVisible(false, PassCode.SaveBugReportExecutor,
|
||||
PassCode.SaveBugReportRecipients,
|
||||
PassCode.AppendBugReportDescription,
|
||||
PassCode.SaveBugReportDescription,
|
||||
|
||||
Reference in New Issue
Block a user