101 lines
4.3 KiB
Java
101 lines
4.3 KiB
Java
package _VisualDVM.TestingSystem.Common;
|
||
import Common.MainModule_;
|
||
import Common.Utils.Utils_;
|
||
import Common.Visual.Controls.MenuBarButton;
|
||
import Common.Visual.Fonts.VisualiserFonts;
|
||
import Common.Visual.Menus.VisualiserMenuBar;
|
||
import Common.Visual.UI;
|
||
import _VisualDVM.Global;
|
||
import _VisualDVM.Passes.PassCode;
|
||
|
||
import javax.swing.*;
|
||
import java.awt.*;
|
||
public class TestingMenuBar extends VisualiserMenuBar {
|
||
// public JLabel KernelsLabel;
|
||
public JButton autorefreshButton;
|
||
JSpinner sCheckTime;
|
||
// JSpinner sKernels;
|
||
JLabel serverAdminLabel;
|
||
public TestingMenuBar() {
|
||
//-
|
||
// KernelsLabel = addLabel("", "/icons/Kernels.png");
|
||
// KernelsLabel.setHorizontalTextPosition(JLabel.LEFT);
|
||
// KernelsLabel.setToolTipText("количество ядер, задействованное при тестировании");
|
||
/*
|
||
add(sKernels = new JSpinner());
|
||
sKernels.setPreferredSize(new Dimension(60, 26));
|
||
sKernels.setMaximumSize(new Dimension(60, 26));
|
||
sKernels.setModel(new SpinnerNumberModel(Global.properties.TestingKernels, 1,
|
||
Utils.getTestingMaxKernels(),
|
||
1));
|
||
sKernels.setValue(Global.properties.TestingKernels);
|
||
UI.MakeSpinnerRapid(sKernels, e -> {
|
||
Global.properties.updateField("TestingKernels", sKernels.getValue());
|
||
});
|
||
*/
|
||
addLabel(" ");
|
||
//--
|
||
add(new MenuBarButton() {
|
||
{
|
||
setText("оповещение по email");
|
||
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
|
||
Mark();
|
||
addActionListener(e -> {
|
||
Global.mainModule.getPass(PassCode.UpdateProperty).Do("EmailOnTestingProgress");
|
||
Mark();
|
||
});
|
||
}
|
||
public void Mark() {
|
||
setIcon(Utils_.getIcon(Global.normalProperties.EmailOnTestingProgress ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||
}
|
||
});
|
||
//--
|
||
add(autorefreshButton = new MenuBarButton() {
|
||
{
|
||
setText("проверка раз в");
|
||
setToolTipText("автоматическое обновление состояния пакета задач");
|
||
Mark();
|
||
addActionListener(e -> {
|
||
Global.mainModule.getPass(PassCode.UpdateProperty).Do("AutoCheckTesting");
|
||
if (Global.normalProperties.AutoCheckTesting)
|
||
TestingServer.TimerOn();
|
||
else
|
||
TestingServer.TimerOff();
|
||
//-
|
||
Mark();
|
||
});
|
||
}
|
||
public void Mark() {
|
||
setIcon(Utils_.getIcon(Global.normalProperties.AutoCheckTesting ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||
}
|
||
});
|
||
//--
|
||
add(sCheckTime = new JSpinner());
|
||
sCheckTime.setPreferredSize(new Dimension(60, 26));
|
||
sCheckTime.setMaximumSize(new Dimension(60, 26));
|
||
sCheckTime.setModel(new SpinnerNumberModel(Global.normalProperties.CheckTestingIntervalSeconds, 10, 3600, 1));
|
||
sCheckTime.setValue(Global.normalProperties.CheckTestingIntervalSeconds);
|
||
UI.MakeSpinnerRapid(sCheckTime, e -> {
|
||
Global.normalProperties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
|
||
if (Global.normalProperties.AutoCheckTesting) TestingServer.ResetTimer();
|
||
});
|
||
add(new JLabel(" сек ") {
|
||
{
|
||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||
}
|
||
});
|
||
addSeparator();
|
||
serverAdminLabel = addLabel(" управление сервером ");
|
||
addPasses(PassCode.StartTestingServer,
|
||
PassCode.ShutdownTestingServer,
|
||
PassCode.PublishTestingServer,
|
||
PassCode.TestingServerBackUp);
|
||
}
|
||
public void ShowAutoCheckTesting() {
|
||
autorefreshButton.setIcon(Utils_.getIcon(Global.normalProperties.AutoCheckTesting ? "/Common/icons/Pick.png" : "/Common/icons/NotPick.png"));
|
||
}
|
||
public void showServerAdminLabel(boolean flag) {
|
||
serverAdminLabel.setVisible(flag);
|
||
}
|
||
}
|