Рефакторинг кода панели быстрого доступа.
This commit is contained in:
@@ -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