2024-10-09 22:21:57 +03:00
|
|
|
|
package _VisualDVM.TestingSystem.Common;
|
2024-10-07 20:04:11 +03:00
|
|
|
|
import Common.Utils.CommonUtils;
|
2024-10-08 22:33:49 +03:00
|
|
|
|
import Common.Visual.CommonUI;
|
2024-10-07 00:58:29 +03:00
|
|
|
|
import _VisualDVM.Global;
|
2024-10-09 22:01:19 +03:00
|
|
|
|
import Common.Visual.Controls.MenuBarButton;
|
|
|
|
|
|
import _VisualDVM.Visual.Menus.VisualiserMenuBar;
|
2024-10-08 22:33:49 +03:00
|
|
|
|
import Common.Visual.Fonts.VisualiserFonts;
|
2024-10-09 23:37:58 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
public class TestingBar extends VisualiserMenuBar {
|
2024-09-20 01:52:39 +03:00
|
|
|
|
// public JLabel KernelsLabel;
|
2023-12-10 02:26:28 +03:00
|
|
|
|
public JButton autorefreshButton;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
JSpinner sCheckTime;
|
2024-09-20 01:52:39 +03:00
|
|
|
|
// JSpinner sKernels;
|
2024-03-24 02:49:32 +03:00
|
|
|
|
JLabel serverAdminLabel;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
public TestingBar() {
|
2023-12-11 18:29:15 +03:00
|
|
|
|
//-
|
2024-09-20 01:52:39 +03:00
|
|
|
|
// KernelsLabel = addLabel("", "/icons/Kernels.png");
|
|
|
|
|
|
// KernelsLabel.setHorizontalTextPosition(JLabel.LEFT);
|
|
|
|
|
|
// KernelsLabel.setToolTipText("количество ядер, задействованное при тестировании");
|
|
|
|
|
|
/*
|
2023-10-14 00:43:39 +03:00
|
|
|
|
add(sKernels = new JSpinner());
|
|
|
|
|
|
sKernels.setPreferredSize(new Dimension(60, 26));
|
|
|
|
|
|
sKernels.setMaximumSize(new Dimension(60, 26));
|
2023-11-14 22:37:33 +03:00
|
|
|
|
sKernels.setModel(new SpinnerNumberModel(Global.properties.TestingKernels, 1,
|
2024-03-24 02:49:32 +03:00
|
|
|
|
Utils.getTestingMaxKernels(),
|
2023-11-30 01:25:26 +03:00
|
|
|
|
1));
|
2023-11-13 21:07:44 +03:00
|
|
|
|
sKernels.setValue(Global.properties.TestingKernels);
|
2023-10-14 00:43:39 +03:00
|
|
|
|
UI.MakeSpinnerRapid(sKernels, e -> {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
Global.properties.updateField("TestingKernels", sKernels.getValue());
|
2023-10-14 00:43:39 +03:00
|
|
|
|
});
|
2024-09-20 01:52:39 +03:00
|
|
|
|
*/
|
2023-12-11 18:29:15 +03:00
|
|
|
|
addLabel(" ");
|
2023-10-14 00:43:39 +03:00
|
|
|
|
//--
|
2023-10-17 22:25:10 +03:00
|
|
|
|
add(new MenuBarButton() {
|
|
|
|
|
|
{
|
2023-10-18 14:05:51 +03:00
|
|
|
|
setText("оповещение по email");
|
2023-10-17 22:25:10 +03:00
|
|
|
|
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
|
|
|
|
|
|
Mark();
|
|
|
|
|
|
addActionListener(e -> {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
Global.properties.switchAndUpdateFlag("EmailOnTestingProgress");
|
2023-10-17 22:25:10 +03:00
|
|
|
|
Mark();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
public void Mark() {
|
2024-10-07 20:04:11 +03:00
|
|
|
|
setIcon(CommonUtils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
2023-10-17 22:25:10 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//--
|
2023-10-12 00:31:58 +03:00
|
|
|
|
add(autorefreshButton = new MenuBarButton() {
|
|
|
|
|
|
{
|
|
|
|
|
|
setText("проверка раз в");
|
|
|
|
|
|
setToolTipText("автоматическое обновление состояния пакета задач");
|
|
|
|
|
|
Mark();
|
|
|
|
|
|
addActionListener(e -> {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
Global.properties.switchAndUpdateFlag("AutoCheckTesting");
|
|
|
|
|
|
//-
|
|
|
|
|
|
if (Global.properties.AutoCheckTesting)
|
|
|
|
|
|
TestingServer.TimerOn();
|
|
|
|
|
|
else
|
|
|
|
|
|
TestingServer.TimerOff();
|
|
|
|
|
|
//-
|
2023-10-12 00:31:58 +03:00
|
|
|
|
Mark();
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
public void Mark() {
|
2024-10-07 20:04:11 +03:00
|
|
|
|
setIcon(CommonUtils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-10-14 00:43:39 +03:00
|
|
|
|
//--
|
2023-10-12 00:31:58 +03:00
|
|
|
|
add(sCheckTime = new JSpinner());
|
|
|
|
|
|
sCheckTime.setPreferredSize(new Dimension(60, 26));
|
|
|
|
|
|
sCheckTime.setMaximumSize(new Dimension(60, 26));
|
2023-11-13 21:07:44 +03:00
|
|
|
|
sCheckTime.setModel(new SpinnerNumberModel(Global.properties.CheckTestingIntervalSeconds, 10, 3600, 1));
|
|
|
|
|
|
sCheckTime.setValue(Global.properties.CheckTestingIntervalSeconds);
|
2024-10-08 22:33:49 +03:00
|
|
|
|
CommonUI.MakeSpinnerRapid(sCheckTime, e -> {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
Global.properties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
|
|
|
|
|
|
if (Global.properties.AutoCheckTesting) TestingServer.ResetTimer();
|
2023-10-12 00:31:58 +03:00
|
|
|
|
});
|
2023-10-14 00:43:39 +03:00
|
|
|
|
add(new JLabel(" сек ") {
|
2023-10-12 00:31:58 +03:00
|
|
|
|
{
|
2024-10-08 22:33:49 +03:00
|
|
|
|
setFont(CommonUI.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-03-23 23:28:02 +03:00
|
|
|
|
addSeparator();
|
2024-03-24 02:49:32 +03:00
|
|
|
|
serverAdminLabel = addLabel(" управление сервером ");
|
2024-10-09 23:37:58 +03:00
|
|
|
|
addPasses(PassCode.StartTestingServer, PassCode.ShutdownTestingServer, PassCode.PublishTestingServer);
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
2023-11-13 21:07:44 +03:00
|
|
|
|
public void ShowAutoCheckTesting() {
|
2024-10-07 20:04:11 +03:00
|
|
|
|
autorefreshButton.setIcon(CommonUtils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
2024-03-24 02:49:32 +03:00
|
|
|
|
public void showServerAdminLabel(boolean flag) {
|
|
|
|
|
|
serverAdminLabel.setVisible(flag);
|
2023-12-11 18:29:15 +03:00
|
|
|
|
}
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|