2023-12-21 17:42:20 +03:00
|
|
|
|
package TestingSystem.Common;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
import Common.Current;
|
2023-11-13 21:07:44 +03:00
|
|
|
|
import Common.Global;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
import Common.UI.Menus_2023.MenuBarButton;
|
|
|
|
|
|
import Common.UI.Menus_2023.VisualiserMenuBar;
|
|
|
|
|
|
import Common.UI.Themes.VisualiserFonts;
|
|
|
|
|
|
import Common.UI.UI;
|
|
|
|
|
|
import Common.Utils.Utils;
|
2023-11-19 02:12:44 +03:00
|
|
|
|
import TestingSystem.Common.TestingServer;
|
2023-12-18 15:44:48 +03:00
|
|
|
|
import Visual_DVM_2021.Passes.PassCode_2021;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
|
public class TestingBar extends VisualiserMenuBar {
|
2023-12-11 18:29:15 +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;
|
2023-10-14 00:43:39 +03:00
|
|
|
|
JSpinner sKernels;
|
2023-10-12 00:31:58 +03:00
|
|
|
|
public TestingBar() {
|
2023-12-11 18:29:15 +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,
|
2023-11-30 01:25:26 +03:00
|
|
|
|
Utils.getTestingMaxKernels(),
|
|
|
|
|
|
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
|
|
|
|
});
|
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() {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
setIcon(Utils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
2023-10-17 22:25:10 +03:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-12-11 18:29:15 +03:00
|
|
|
|
|
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() {
|
2023-11-13 21:07:44 +03:00
|
|
|
|
setIcon(Utils.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);
|
2023-10-12 00:31:58 +03:00
|
|
|
|
UI.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
|
|
|
|
{
|
|
|
|
|
|
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2024-03-23 23:28:02 +03:00
|
|
|
|
addSeparator();
|
|
|
|
|
|
addPasses(PassCode_2021.StopTestingServer);
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
2023-11-13 21:07:44 +03:00
|
|
|
|
public void ShowAutoCheckTesting() {
|
|
|
|
|
|
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|
2024-03-13 19:19:32 +03:00
|
|
|
|
/*
|
2023-12-11 18:29:15 +03:00
|
|
|
|
public void ShowMachine(){
|
|
|
|
|
|
MachineButton.setText(Current.getMachine().getURL());
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowUser(){
|
|
|
|
|
|
UserButton.setText(Current.getUser().login);
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowNoMachine(){
|
|
|
|
|
|
MachineButton.setText("?");
|
|
|
|
|
|
}
|
|
|
|
|
|
public void ShowNoUser(){
|
|
|
|
|
|
UserButton.setText("?");
|
|
|
|
|
|
}
|
2024-03-13 19:19:32 +03:00
|
|
|
|
*/
|
2023-10-12 00:31:58 +03:00
|
|
|
|
}
|