server
Clone or download
Modified Files
--- 'a/pom.xml'
+++ b/pom.xml
@@ -89,6 +89,12 @@
<artifactId>json</artifactId>
<version>20201115</version>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ <version>3.11</version>
+ </dependency>
</dependencies>
--- 'a/src/main/java/com/stream_pi/server/Main.java'
+++ b/src/main/java/com/stream_pi/server/Main.java
@@ -32,7 +32,6 @@ public class Main extends Application {
* Then a new instance of controller is created, and then initialised.
*/
public void start(Stage stage) {
-
for(String eachArg : getParameters().getRaw())
{
String[] r = eachArg.split("=");
--- 'a/src/main/java/com/stream_pi/server/connection/ClientConnection.java'
+++ b/src/main/java/com/stream_pi/server/connection/ClientConnection.java
@@ -24,6 +24,7 @@ import com.stream_pi.util.platform.Platf
import com.stream_pi.util.platform.ReleaseStatus;
import com.stream_pi.util.version.Version;
import javafx.concurrent.Task;
+import org.apache.commons.lang3.ArrayUtils;
import java.io.*;
import java.lang.reflect.Array;
@@ -108,9 +109,18 @@ public class ClientConnection extends Th
public void sendIcon(String profileID, String actionID, byte[] icon) throws SevereException
{
+ try
+ {
+ Thread.sleep(50);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+
Message message = new Message("action_icon");
message.setStringArrValue(profileID, actionID);
- message.setByteArrValue(icon);
+ message.setByteArrValue(ArrayUtils.toObject(icon));
sendMessage(message);
}
@@ -264,7 +274,7 @@ public class ClientConnection extends Th
String profileID = s[0];
String actionID = s[1];
- getClient().getProfileByID(profileID).getActionByID(actionID).setIcon(message.getByteArrValue());
+ getClient().getProfileByID(profileID).getActionByID(actionID).setIcon(ArrayUtils.toPrimitive(message.getByteArrValue()));
}
public void initAfterConnectionQuerySend() throws SevereException
--- 'a/src/main/java/com/stream_pi/server/controller/Controller.java'
+++ b/src/main/java/com/stream_pi/server/controller/Controller.java
@@ -47,8 +47,6 @@ public class Controller extends Base imp
{
MainServer mainServer;
- final SystemTray systemTray;
-
public void setupDashWindow() throws SevereException
{
try
@@ -63,29 +61,11 @@ public class Controller extends Base imp
}
}
- private void checkPrePathDirectory() throws SevereException
- {
- try {
- File filex = new File(ServerInfo.getInstance().getPrePath());
-
- if(!filex.exists())
- {
- filex.mkdirs();
- IOHelper.unzip(Main.class.getResourceAsStream("Default.obj"), ServerInfo.getInstance().getPrePath());
- }
- }
- catch (Exception e)
- {
- e.printStackTrace();
- throw new SevereException(e.getMessage());
- }
- }
@Override
public void init()
{
try {
- checkPrePathDirectory();
initBase();
setupDashWindow();
@@ -145,7 +125,7 @@ public class Controller extends Base imp
{
try
{
- if(ServerInfo.getInstance().isStartMinimised())
+ if(ServerInfo.getInstance().isStartMinimised() && SystemTray.isSupported())
minimiseApp();
else
getStage().show();
@@ -343,7 +323,6 @@ public class Controller extends Base imp
public Controller(){
- systemTray = SystemTray.getSystemTray();
mainServer = null;
}
@@ -351,22 +330,24 @@ public class Controller extends Base imp
{
try
{
- if(Config.getInstance().getCloseOnX())
+ if(!Config.getInstance().getCloseOnX())
{
- getConfig().setStartupWindowSize(
+ if(SystemTray.isSupported())
+ {
+ minimiseApp();
+ event.consume();
+ return;
+ }
+ }
+
+ getConfig().setStartupWindowSize(
getWidth(),
getHeight()
- );
- getConfig().save();
- onQuitApp();
- NormalActionPlugins.getInstance().shutDownActions();
- Platform.exit();
- }
- else
- {
- minimiseApp();
- event.consume();
- }
+ );
+ getConfig().save();
+ onQuitApp();
+ NormalActionPlugins.getInstance().shutDownActions();
+ Platform.exit();
}
catch (SevereException e)
{
@@ -396,20 +377,13 @@ public class Controller extends Base imp
{
try
{
+ SystemTray systemTray = SystemTray.getSystemTray();
- if(SystemTray.isSupported())
- {
- if(getTrayIcon() == null)
- initIconTray();
-
- systemTray.add(getTrayIcon());
- //getStage().setIconified(true);
- getStage().hide();
- }
- else
- {
- new StreamPiAlert("System Tray Error", "Your System does not support System Tray", StreamPiAlertType.ERROR).show();
- }
+ if(getTrayIcon() == null)
+ initIconTray(systemTray);
+
+ systemTray.add(getTrayIcon());
+ getStage().hide();
}
catch(Exception e)
{
@@ -417,7 +391,7 @@ public class Controller extends Base imp
}
}
- public void initIconTray()
+ public void initIconTray(SystemTray systemTray)
{
Platform.setImplicitExit(false);
--- 'a/src/main/java/com/stream_pi/server/window/Base.java'
+++ b/src/main/java/com/stream_pi/server/window/Base.java
@@ -11,6 +11,7 @@ import com.stream_pi.theme_api.Themes;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.SevereException;
+import com.stream_pi.util.iohelper.IOHelper;
import com.stream_pi.util.loggerhelper.StreamPiLogFileHandler;
import javafx.application.HostServices;
@@ -19,6 +20,7 @@ import javafx.scene.layout.StackPane;
import javafx.scene.text.Font;
import javafx.stage.Stage;
+import java.io.File;
import java.util.logging.Logger;
public abstract class Base extends StackPane implements ExceptionAndAlertHandler, ServerListener {
@@ -77,7 +79,8 @@ public abstract class Base extends Stack
logFileHandler.close();
}
- public void initBase() throws SevereException {
+ public void initBase() throws SevereException
+ {
initLogger();
getChildren().clear();
@@ -89,16 +92,16 @@ public abstract class Base extends Stack
getStage().setMinWidth(500);
getStage().setMinHeight(500);
+ checkPrePathDirectory();
+
config = Config.getInstance();
stage.setWidth(config.getStartupWindowWidth());
stage.setHeight(config.getStartupWindowHeight());
stage.centerOnScreen();
-
serverInfo = ServerInfo.getInstance();
-
initThemes();
settingsBase = new SettingsBase(getHostServices(), this, this);
@@ -121,11 +124,31 @@ public abstract class Base extends Stack
}
+ private void checkPrePathDirectory() throws SevereException
+ {
+ try {
+ File filex = new File(ServerInfo.getInstance().getPrePath());
+
+ if(!filex.exists())
+ {
+ filex.mkdirs();
+ IOHelper.unzip(Main.class.getResourceAsStream("Default.obj"), ServerInfo.getInstance().getPrePath());
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ getStage().show();
+ throw new SevereException(e.getMessage());
+ }
+ }
+
public void initThemes() throws SevereException {
clearStylesheets();
registerThemes();
- applyDefaultTheme();
applyDefaultStylesheet();
+ applyDefaultTheme();
+ applyDefaultIconsStylesheet();
}
public Stage getStage()
@@ -143,6 +166,12 @@ public abstract class Base extends Stack
logger.info("... Done!");
}
+ public void applyDefaultIconsStylesheet()
+ {
+ Font.loadFont(Main.class.getResourceAsStream("Roboto.ttf"), 13);
+ getStylesheets().add(Main.class.getResource("default_icons.css").toExternalForm());
+ }
+
public DashboardBase getDashboardPane()
{
return dashboardBase;
--- 'a/src/main/java/com/stream_pi/server/window/firsttimeuse/FinalConfigPane.java'
+++ b/src/main/java/com/stream_pi/server/window/firsttimeuse/FinalConfigPane.java
@@ -22,14 +22,17 @@ public class FinalConfigPane extends VBo
{
private TextField serverNicknameTextField;
private TextField serverPortTextField;
+ private Button nextButton;
private ExceptionAndAlertHandler exceptionAndAlertHandler;
private ServerListener serverListener;
- public FinalConfigPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ServerListener serverListener)
+ public FinalConfigPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ServerListener serverListener,
+ Button nextButton)
{
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
this.serverListener = serverListener;
+ this.nextButton = nextButton;
getStyleClass().add("first_time_use_pane_final_config");
@@ -44,18 +47,19 @@ public class FinalConfigPane extends VBo
HBoxInputBox serverNickNameInputBox = new HBoxInputBox("Server Nickname", serverNicknameTextField, 200);
HBoxInputBox serverPortInputBox = new HBoxInputBox("Server Port", serverPortTextField);
- Button confirmButton = new Button("Confirm");
- confirmButton.setOnAction(event -> onConfirmButtonClicked());
- HBox bBar = new HBox(confirmButton);
- bBar.setAlignment(Pos.CENTER_RIGHT);
-
- getChildren().addAll(label, serverNickNameInputBox, serverPortInputBox, SpaceFiller.vertical(), bBar);
+ getChildren().addAll(label, serverNickNameInputBox, serverPortInputBox);
setSpacing(10.0);
setVisible(false);
}
+ public void makeChangesToNextButton()
+ {
+ nextButton.setText("Confirm");
+ nextButton.setOnAction(event -> onConfirmButtonClicked());
+ }
+
private void onConfirmButtonClicked()
{
StringBuilder errors = new StringBuilder();
--- 'a/src/main/java/com/stream_pi/server/window/firsttimeuse/FirstTimeUse.java'
+++ b/src/main/java/com/stream_pi/server/window/firsttimeuse/FirstTimeUse.java
@@ -35,17 +35,6 @@ public class FirstTimeUse extends VBox{
VBox.setVgrow(stackPane, Priority.ALWAYS);
- welcomePane = new WelcomePane();
- licensePane = new LicensePane();
- finalConfigPane = new FinalConfigPane(exceptionAndAlertHandler, serverListener);
-
- stackPane.getChildren().addAll(
- welcomePane,
- licensePane,
- finalConfigPane
- );
-
-
nextButton = new Button("Next");
nextButton.setOnAction(event-> onNextButtonClicked());
@@ -56,6 +45,16 @@ public class FirstTimeUse extends VBox{
HBox buttonBar = new HBox(previousButton, SpaceFiller.horizontal(), nextButton);
buttonBar.setSpacing(10.0);
+ welcomePane = new WelcomePane();
+ licensePane = new LicensePane();
+ finalConfigPane = new FinalConfigPane(exceptionAndAlertHandler, serverListener, nextButton);
+
+ stackPane.getChildren().addAll(
+ welcomePane,
+ licensePane,
+ finalConfigPane
+ );
+
getChildren().addAll(headingLabel, stackPane, buttonBar);
setWindow(WindowName.WELCOME);
@@ -106,8 +105,9 @@ public class FirstTimeUse extends VBox{
headingLabel.setText("");
- nextButton.setDisable(false);
- previousButton.setDisable(true);
+ nextButton.setText("Next");
+ nextButton.setOnAction(event-> onNextButtonClicked());
+ previousButton.setVisible(false);
}
else if (windowName == WindowName.LICENSE)
{
@@ -119,8 +119,9 @@ public class FirstTimeUse extends VBox{
headingLabel.setText("License Agreement");
- nextButton.setDisable(false);
- previousButton.setDisable(false);
+ nextButton.setText("Agree and Continue");
+ nextButton.setOnAction(event-> onNextButtonClicked());
+ previousButton.setVisible(true);
}
else if (windowName == WindowName.FINAL)
{
@@ -132,8 +133,8 @@ public class FirstTimeUse extends VBox{
headingLabel.setText("Finishing up ...");
- nextButton.setDisable(true);
- previousButton.setDisable(false);
+ finalConfigPane.makeChangesToNextButton();
+ previousButton.setVisible(true);
}
}
--- 'a/src/main/java/com/stream_pi/server/window/firsttimeuse/LicensePane.java'
+++ b/src/main/java/com/stream_pi/server/window/firsttimeuse/LicensePane.java
@@ -2,20 +2,18 @@ package com.stream_pi.server.window.firs
import com.stream_pi.server.info.License;
+import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
-public class LicensePane extends VBox {
+public class LicensePane extends VBox
+{
public LicensePane()
{
getStyleClass().add("first_time_use_pane_license");
- Label label = new Label("By clicking on 'Next' you agree with the Stream-Pi license, and, the license('s) of the library('s) used/included with this software.");
- label.prefWidthProperty().bind(widthProperty());
- label.setWrapText(true);
-
TextArea licenseTextArea = new TextArea(License.getLicense());
licenseTextArea.setWrapText(false);
licenseTextArea.setEditable(false);
@@ -23,6 +21,6 @@ public class LicensePane extends VBox {
licenseTextArea.prefWidthProperty().bind(widthProperty());
VBox.setVgrow(licenseTextArea, Priority.ALWAYS);
- getChildren().addAll(label, licenseTextArea);
+ getChildren().addAll(licenseTextArea);
}
}
--- 'a/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java'
+++ b/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java
@@ -331,17 +331,12 @@ public class GeneralSettings extends VBo
if(!closeOnX)
{
- System.out.println("XYZ");
if(!SystemTray.isSupported())
{
StreamPiAlert alert = new StreamPiAlert("Not Supported", "Tray System not supported on this platform ", StreamPiAlertType.ERROR);
alert.show();
closeOnX = true;
- }
- else
- {
- System.out.println("YES");
}
}
--- 'a/src/main/java/module-info.java'
+++ b/src/main/java/module-info.java
@@ -8,6 +8,8 @@ module com.stream_pi.server {
requires org.kordamp.ikonli.javafx;
+ requires org.apache.commons.lang3;
+
requires java.xml;
requires javafx.base;
--- /dev/null
+++ b/src/main/resources/com/stream_pi/server/default_icons.css
@@ -0,0 +1,19 @@
+.alert_error_icon
+{
+ -fx-icon-color: RED;
+}
+
+.alert_information_icon
+{
+ -fx-icon-color: BLUE;
+}
+
+.alert_warning_icon
+{
+ -fx-icon-color: #ffcc00;
+}
+
+.action_details_pane_delete_button_icon
+{
+ -fx-icon-color:red;
+}
--- 'a/src/main/resources/com/stream_pi/server/style.css'
+++ b/src/main/resources/com/stream_pi/server/style.css
@@ -91,21 +91,6 @@
-fx-icon-size : 30;
}
-.alert_error_icon
-{
- -fx-icon-color: RED;
-}
-
-.alert_information_icon
-{
- -fx-icon-color: BLUE;
-}
-
-.alert_warning_icon
-{
- -fx-icon-color: #ffcc00;
-}
-
.alert_content_pane
{
-fx-padding: 5;
@@ -235,11 +220,6 @@
-fx-text-fill : red;
}
-.action_details_pane_delete_button_icon
-{
- -fx-icon-color:red;
-}
-
.client_and_profile_selector_pane_stack
{
-fx-spacing: 5;
@@ -248,4 +228,34 @@
.plugins_settings, .themes_settings, .clients_settings
{
-fx-padding: 0 10 0 0;
+}
+
+/*Alert Classes added to default stylesheet to show init error, if occurs */
+.action_box_display_text_label
+{
+ -fx-font-size : 16;
+ -fx-background-color : transparent;
+}
+
+.alert_pane
+{
+ -fx-background-color : white;
+ -fx-border-color : white;
+}
+
+.alert_content_pane
+{
+ -fx-background-color: white;
+ -fx-padding: 5;
+}
+
+.alert_scroll_pane
+{
+ -fx-background: white;
+ -fx-border-color:white;
+}
+
+.alert_button_bar
+{
+ -fx-background-color:white;
}
\ No newline at end of file