создание 3 кнопок синхронизации бд тестов - в тестах. и в соответствующих конфигурациях.
This commit is contained in:
129
src/TestingSystem/Common/TestingBar.java
Normal file
129
src/TestingSystem/Common/TestingBar.java
Normal file
@@ -0,0 +1,129 @@
|
||||
package TestingSystem.Common;
|
||||
import Common.Current;
|
||||
import Common.Global;
|
||||
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;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
public class TestingBar extends VisualiserMenuBar {
|
||||
public MenuBarButton MachineButton;
|
||||
public MenuBarButton UserButton;
|
||||
public JLabel KernelsLabel;
|
||||
|
||||
public JButton autorefreshButton;
|
||||
JSpinner sCheckTime;
|
||||
JSpinner sKernels;
|
||||
public TestingBar() {
|
||||
add(MachineButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/icons/Machine.png");
|
||||
setFont(VisualiserFonts.TreePlain);
|
||||
setToolTipText("Машина тестирования");
|
||||
addActionListener(e -> {
|
||||
UI.getMainWindow().FocusCredentials();
|
||||
});
|
||||
}
|
||||
});
|
||||
//--
|
||||
add(UserButton = new MenuBarButton() {
|
||||
{
|
||||
setIcon("/icons/User.png");
|
||||
setFont(VisualiserFonts.TreePlain);
|
||||
setToolTipText("Учетная запись машины тестирования");
|
||||
addActionListener(e -> {
|
||||
UI.getMainWindow().FocusCredentials();
|
||||
});
|
||||
}
|
||||
});
|
||||
//-
|
||||
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.properties.switchAndUpdateFlag("EmailOnTestingProgress");
|
||||
Mark();
|
||||
});
|
||||
}
|
||||
public void Mark() {
|
||||
setIcon(Utils.getIcon(Global.properties.EmailOnTestingProgress ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
}
|
||||
});
|
||||
|
||||
//--
|
||||
add(autorefreshButton = new MenuBarButton() {
|
||||
{
|
||||
setText("проверка раз в");
|
||||
setToolTipText("автоматическое обновление состояния пакета задач");
|
||||
Mark();
|
||||
addActionListener(e -> {
|
||||
Global.properties.switchAndUpdateFlag("AutoCheckTesting");
|
||||
//-
|
||||
if (Global.properties.AutoCheckTesting)
|
||||
TestingServer.TimerOn();
|
||||
else
|
||||
TestingServer.TimerOff();
|
||||
//-
|
||||
Mark();
|
||||
});
|
||||
}
|
||||
public void Mark() {
|
||||
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(Global.properties.CheckTestingIntervalSeconds, 10, 3600, 1));
|
||||
sCheckTime.setValue(Global.properties.CheckTestingIntervalSeconds);
|
||||
UI.MakeSpinnerRapid(sCheckTime, e -> {
|
||||
Global.properties.updateField("CheckTestingIntervalSeconds", sCheckTime.getValue());
|
||||
if (Global.properties.AutoCheckTesting) TestingServer.ResetTimer();
|
||||
});
|
||||
add(new JLabel(" сек ") {
|
||||
{
|
||||
setFont(Current.getTheme().Fonts.get(VisualiserFonts.TreeItalic));
|
||||
}
|
||||
});
|
||||
}
|
||||
public void ShowAutoCheckTesting() {
|
||||
autorefreshButton.setIcon(Utils.getIcon(Global.properties.AutoCheckTesting ? "/icons/Pick.png" : "/icons/NotPick.png"));
|
||||
}
|
||||
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("?");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user