server
Clone or download
Modified Files
--- 'a/pom.xml'
+++ b/pom.xml
@@ -14,12 +14,14 @@
<maven.compiler.target>11</maven.compiler.target>
<client.plugin.version>0.1.36</client.plugin.version>
- <javafx.version>17-ea+8</javafx.version>
+ <javafx.version>17-ea+11</javafx.version>
<action.api.version>1.0.0-SNAPSHOT</action.api.version>
<theme.api.version>1.0.0-SNAPSHOT</theme.api.version>
<util.version>1.0.0-SNAPSHOT</util.version>
+ <controlsfx.version>11.1.0</controlsfx.version>
+
<commons.bean.util.version>1.9.4</commons.bean.util.version>
<commons.configuration.version>2.7</commons.configuration.version>
@@ -76,6 +78,11 @@
<version>${theme.api.version}</version>
</dependency>
+ <dependency>
+ <groupId>org.controlsfx</groupId>
+ <artifactId>controlsfx</artifactId>
+ <version>${controlsfx.version}</version>
+ </dependency>
</dependencies>
--- 'a/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java'
+++ b/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java
@@ -15,6 +15,7 @@ import com.stream_pi.util.exception.Mino
import com.stream_pi.util.exception.SevereException;
import com.stream_pi.util.platform.PlatformType;
import com.stream_pi.util.startatboot.StartAtBoot;
+import com.stream_pi.util.uihelper.HBoxWithSpaceBetween;
import com.stream_pi.util.version.Version;
import javafx.application.HostServices;
import javafx.application.Platform;
@@ -29,6 +30,7 @@ import javafx.scene.control.ScrollPane;
import javafx.scene.control.TextField;
import javafx.scene.layout.*;
import javafx.stage.DirectoryChooser;
+import org.controlsfx.control.ToggleSwitch;
import org.kordamp.ikonli.javafx.FontIcon;
import java.awt.SystemTray;
@@ -46,9 +48,12 @@ public class GeneralSettings extends VBo
private final TextField themesPathTextField;
private final TextField actionGridPaneActionBoxSize;
private final TextField actionGridPaneActionBoxGap;
- private final ToggleButton startOnBootToggleButton;
- private final ToggleButton minimizeToSystemTrayOnCloseToggleButton;
- private final ToggleButton showAlertsPopupToggleButton;
+ private final ToggleSwitch startOnBootToggleSwitch;
+ private final HBoxWithSpaceBetween startOnBootHBox;
+ private final ToggleSwitch minimizeToSystemTrayOnCloseToggleSwitch;
+ private final HBoxWithSpaceBetween minimizeToSystemTrayOnCloseHBox;
+ private final ToggleSwitch showAlertsPopupToggleSwitch;
+ private final HBoxWithSpaceBetween showAlertsPopupHBox;
private final Button saveButton;
private final Button checkForUpdatesButton;
@@ -82,9 +87,15 @@ public class GeneralSettings extends VBo
actionGridPaneActionBoxSize = new TextField();
actionGridPaneActionBoxGap = new TextField();
- startOnBootToggleButton = new ToggleButton("Start on Boot");
- minimizeToSystemTrayOnCloseToggleButton = new ToggleButton("Minimise To Tray On Close");
- showAlertsPopupToggleButton = new ToggleButton("Show Popup On Alert");
+ startOnBootToggleSwitch = new ToggleSwitch();
+ startOnBootHBox = new HBoxWithSpaceBetween("Start on Boot", startOnBootToggleSwitch);
+ startOnBootHBox.managedProperty().bind(startOnBootHBox.visibleProperty());
+
+ minimizeToSystemTrayOnCloseToggleSwitch = new ToggleSwitch();
+ minimizeToSystemTrayOnCloseHBox = new HBoxWithSpaceBetween("Minimise To Tray On Close", minimizeToSystemTrayOnCloseToggleSwitch);
+
+ showAlertsPopupToggleSwitch = new ToggleSwitch();
+ showAlertsPopupHBox = new HBoxWithSpaceBetween("Show Popup On Alert", showAlertsPopupToggleSwitch);
checkForUpdatesButton = new Button("Check for updates");
checkForUpdatesButton.setOnAction(event->checkForUpdates());
@@ -101,20 +112,18 @@ public class GeneralSettings extends VBo
getUIInputBox("Grid Pane - Box Size", actionGridPaneActionBoxSize),
getUIInputBox("Grid Pane - Box Gap", actionGridPaneActionBoxGap),
getUIInputBoxWithDirectoryChooser("Plugins Path", pluginsPathTextField),
- getUIInputBoxWithDirectoryChooser("Themes Path", themesPathTextField)
+ getUIInputBoxWithDirectoryChooser("Themes Path", themesPathTextField),
+ minimizeToSystemTrayOnCloseHBox,
+ startOnBootHBox,
+ showAlertsPopupHBox
);
serverNameTextField.setPrefWidth(200);
- HBox toggleButtons = new HBox(minimizeToSystemTrayOnCloseToggleButton, startOnBootToggleButton, showAlertsPopupToggleButton);
- toggleButtons.setSpacing(10.0);
- VBox.setMargin(toggleButtons, new Insets(30, 0 , 0,0));
- toggleButtons.setAlignment(Pos.CENTER);
-
saveButton = new Button("Save");
saveButton.setOnAction(event->save());
- getChildren().addAll(toggleButtons, checkForUpdatesButton, saveButton);
+ getChildren().addAll(checkForUpdatesButton, saveButton);
setPadding(new Insets(10));
@@ -193,9 +202,9 @@ public class GeneralSettings extends VBo
actionGridPaneActionBoxSize.setText(config.getActionGridActionSize()+"");
actionGridPaneActionBoxGap.setText(config.getActionGridActionGap()+"");
- minimizeToSystemTrayOnCloseToggleButton.setSelected(config.getMinimiseToSystemTrayOnClose());
- showAlertsPopupToggleButton.setSelected(config.isShowAlertsPopup());
- startOnBootToggleButton.setSelected(config.getStartOnBoot());
+ minimizeToSystemTrayOnCloseToggleSwitch.setSelected(config.getMinimiseToSystemTrayOnClose());
+ showAlertsPopupToggleSwitch.setSelected(config.isShowAlertsPopup());
+ startOnBootToggleSwitch.setSelected(config.getStartOnBoot());
});
}
@@ -211,13 +220,6 @@ public class GeneralSettings extends VBo
Platform.runLater(()->{
saveButton.setDisable(true);
-
- serverNameTextField.setDisable(true);
- portTextField.setDisable(true);
-
- minimizeToSystemTrayOnCloseToggleButton.setDisable(true);
- showAlertsPopupToggleButton.setDisable(true);
- startOnBootToggleButton.setDisable(true);
});
String serverNameStr = serverNameTextField.getText();
@@ -228,9 +230,9 @@ public class GeneralSettings extends VBo
String actionGridActionBoxSize = actionGridPaneActionBoxSize.getText();
String actionGridActionBoxGap = actionGridPaneActionBoxGap.getText();
- boolean minimizeToSystemTrayOnClose = minimizeToSystemTrayOnCloseToggleButton.isSelected();
- boolean showAlertsPopup = showAlertsPopupToggleButton.isSelected();
- boolean startOnBoot = startOnBootToggleButton.isSelected();
+ boolean minimizeToSystemTrayOnClose = minimizeToSystemTrayOnCloseToggleSwitch.isSelected();
+ boolean showAlertsPopup = showAlertsPopupToggleSwitch.isSelected();
+ boolean startOnBoot = startOnBootToggleSwitch.isSelected();
Config config = Config.getInstance();
@@ -422,13 +424,6 @@ public class GeneralSettings extends VBo
finally {
Platform.runLater(()->{
saveButton.setDisable(false);
-
- serverNameTextField.setDisable(false);
- portTextField.setDisable(false);
-
- minimizeToSystemTrayOnCloseToggleButton.setDisable(false);
- showAlertsPopupToggleButton.setDisable(false);
- startOnBootToggleButton.setDisable(false);
});
}
return null;
--- 'a/src/main/java/module-info.java'
+++ b/src/main/java/module-info.java
@@ -24,6 +24,8 @@ module com.stream_pi.server
opens com.stream_pi.server.window.settings;
+ requires org.controlsfx.controls;
+
exports com.stream_pi.server;
opens com.stream_pi.server.window.settings.About;
}
\ No newline at end of file