промежуточный. частичный рефакторинг смены глобальный настроек. автоотключение проверки бд тестов если активных пакетов нет.

This commit is contained in:
2023-11-13 21:07:44 +03:00
parent 56f54581b6
commit a76e9d0310
21 changed files with 218 additions and 188 deletions

View File

@@ -1,5 +1,6 @@
package Common.UI.Menus_2023.TestingBar;
import Common.Current;
import Common.Global;
import Common.UI.Menus_2023.MenuBarButton;
import Common.UI.Menus_2023.VisualiserMenuBar;
import Common.UI.Themes.VisualiserFonts;
@@ -25,9 +26,10 @@ public class TestingBar extends VisualiserMenuBar {
add(sKernels = new JSpinner());
sKernels.setPreferredSize(new Dimension(60, 26));
sKernels.setMaximumSize(new Dimension(60, 26));
sKernels.setModel(new SpinnerNumberModel(TestingServer.kernels, 1, 64, 1));
sKernels.setModel(new SpinnerNumberModel(Global.properties.TestingKernels, 1, 64, 1));
sKernels.setValue(Global.properties.TestingKernels);
UI.MakeSpinnerRapid(sKernels, e -> {
TestingServer.kernels = (int) sKernels.getValue();
Global.properties.updateField("TestingKernels", sKernels.getValue());
});
//--
add(new MenuBarButton() {
@@ -36,14 +38,13 @@ public class TestingBar extends VisualiserMenuBar {
setToolTipText("Оповещение о прогрессе выполнения пакета тестов");
Mark();
addActionListener(e -> {
TestingServer.email = !TestingServer.email;
Global.properties.switchAndUpdateFlag("EmailOnTestingProgress");
Mark();
});
}
public void Mark() {
setIcon(Utils.getIcon(TestingServer.email ? "/icons/Pick.png" : "/icons/NotPick.png"));
setIcon(Utils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
add(autorefreshButton = new MenuBarButton() {
@@ -52,23 +53,29 @@ public class TestingBar extends VisualiserMenuBar {
setToolTipText("автоматическое обновление состояния пакета задач");
Mark();
addActionListener(e -> {
TestingServer.checkTasks = !TestingServer.checkTasks;
TestingServer.switchTimer(TestingServer.checkTasks);
Global.properties.switchAndUpdateFlag("AutoCheckTesting");
//-
if (Global.properties.AutoCheckTesting)
TestingServer.TimerOn();
else
TestingServer.TimerOff();
//-
Mark();
});
}
public void Mark() {
setIcon(Utils.getIcon(TestingServer.checkTasks ? "/icons/Pick.png" : "/icons/NotPick.png"));
setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
});
//--
add(sCheckTime = new JSpinner());
sCheckTime.setPreferredSize(new Dimension(60, 26));
sCheckTime.setMaximumSize(new Dimension(60, 26));
sCheckTime.setModel(new SpinnerNumberModel(TestingServer.checkIntervalSecond, 10, 3600, 1));
sCheckTime.setModel(new SpinnerNumberModel(Global.properties.CheckTestingIntervalSeconds, 10, 3600, 1));
sCheckTime.setValue(Global.properties.CheckTestingIntervalSeconds);
UI.MakeSpinnerRapid(sCheckTime, e -> {
TestingServer.checkIntervalSecond = (int) sCheckTime.getValue();
if (TestingServer.checkTasks) TestingServer.ResetTimer();
Global.properties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
if (Global.properties.AutoCheckTesting) TestingServer.ResetTimer();
});
add(new JLabel(" сек ") {
{
@@ -76,7 +83,7 @@ public class TestingBar extends VisualiserMenuBar {
}
});
}
public void ShowAutorefresh() {
autorefreshButton.setIcon(Utils.getIcon(TestingServer.checkTasks ? "/icons/Pick.png" : "/icons/NotPick.png"));
public void ShowAutoCheckTesting() {
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
}
}