Files
VisualSapfor/src/Common/UI/Menus_2023/TestingBar/TestingBar.java

92 lines
3.7 KiB
Java
Raw Normal View History

2023-10-12 00:31:58 +03:00
package Common.UI.Menus_2023.TestingBar;
import Common.Current;
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;
import TestingSystem.Common.TestingServer;
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 {
JButton autorefreshButton;
JSpinner sCheckTime;
2023-10-14 00:43:39 +03:00
JSpinner sKernels;
2023-10-12 00:31:58 +03:00
public TestingBar() {
addPasses(PassCode_2021.SynchronizeTestsTasks);
2023-10-14 00:43:39 +03:00
//--
add(new JLabel(" ядер ") {
{
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
}
});
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);
2023-10-14 00:43:39 +03:00
UI.MakeSpinnerRapid(sKernels, e -> {
Global.properties.updateField("TestingKernels", sKernels.getValue());
2023-10-14 00:43:39 +03:00
});
//--
add(new MenuBarButton() {
{
setText("оповещение по email");
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
Mark();
addActionListener(e -> {
Global.properties.switchAndUpdateFlag("EmailOnTestingProgress");
Mark();
});
}
public void Mark() {
setIcon(Utils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
2023-10-12 00:31:58 +03:00
add(autorefreshButton = new MenuBarButton() {
{
setText("проверка раз в");
setToolTipText("автоматическое обновление состояния пакета задач");
Mark();
addActionListener(e -> {
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() {
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));
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 -> {
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));
}
});
}
public void ShowAutoCheckTesting() {
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
2023-10-12 00:31:58 +03:00
}
}