From: rnayabed Date: Fri, 12 Feb 2021 15:56:57 +0530 Subject: work --- work --- --- 'a/pom.xml' +++ b/pom.xml @@ -13,7 +13,6 @@ UTF-8 11 - 16-ea+6 0.1.36 11.5.0 @@ -69,6 +68,13 @@ util 4.0.10 + + + + org.apache.commons + commons-lang3 + 3.11 + @@ -105,10 +111,10 @@ client-maven-plugin ${client.plugin.version} - ${clientTarget} + android --initialize-at-build-time=com.sun.org.apache.xml.internal.serializer.ToXMLStream - ${additionalArgs} + -Dsvm.targetName=android com.sun.org.apache.xerces.internal.impl.msg.XMLMessages @@ -133,7 +139,7 @@ - + --- 'a/src/main/java/com/stream_pi/client/Main.java' +++ b/src/main/java/com/stream_pi/client/Main.java @@ -25,10 +25,20 @@ public class Main extends Application { for(String eachArg : args) { String[] r = eachArg.split("="); - if(r[0].equals("-DStreamPi.startupRunnerFileName")) - ClientInfo.getInstance().setRunnerFileName(r[1]); - else if(r[0].equals("-DStreamPi.showShutDownButton")) - ClientInfo.getInstance().setShowShutDownButton(r[1].equals("true")); + String arg = r[0]; + String val = r[1]; + + switch (arg) { + case "-DStreamPi.startupRunnerFileName": + ClientInfo.getInstance().setRunnerFileName(val); + break; + case "-DStreamPi.showShutDownButton": + ClientInfo.getInstance().setShowShutDownButton(val.equals("true")); + break; + case "-DStreamPi.isXMode": + ClientInfo.getInstance().setXMode(val.equals("true")); + break; + } } launch(args); --- 'a/src/main/java/com/stream_pi/client/connection/Client.java' +++ b/src/main/java/com/stream_pi/client/connection/Client.java @@ -15,10 +15,13 @@ import com.stream_pi.client.window.dashb import com.stream_pi.theme_api.Theme; import com.stream_pi.util.alert.StreamPiAlertType; import com.stream_pi.util.comms.Message; +import com.stream_pi.util.comms.Message; import com.stream_pi.util.exception.MinorException; import com.stream_pi.util.exception.SevereException; import com.stream_pi.util.version.Version; +import javafx.application.Platform; import javafx.concurrent.Task; +import org.apache.commons.lang3.ArrayUtils; import java.io.*; import java.net.InetSocketAddress; @@ -237,7 +240,7 @@ public class Client extends Thread{ clientListener.getClientProfiles().getProfileFromID(profileID).saveActionIcon( actionID, - message.getByteArrValue() + ArrayUtils.toPrimitive(message.getByteArrValue()) ); Action a = clientListener.getClientProfiles().getProfileFromID(profileID).getActionFromID(actionID); @@ -251,9 +254,18 @@ public class Client extends Thread{ public synchronized 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); } @@ -611,29 +623,9 @@ public class Client extends Thread{ clientListener.getClientProfiles().getProfileFromID(profileID).addAction(action); - System.out.println("XXXXXXXXXXX " +action.isHasIcon()); - clientListener.getClientProfiles().getProfileFromID(profileID).saveAction(action); clientListener.renderAction(profileID, action); - - /*if(clientListener.getCurrentProfile().getID().equals(profileID) && - clientListener.get&& action.getLocation().getCol()!=-1) - { - javafx.application.Platform.runLater(()->{ - ActionBox box = clientListener.getActionBox(action.getLocation().getCol(), action.getLocation().getRow()); - System.out.println(box==null); - System.out.println("jj : "+action.getLocation().getCol()+","+action.getLocation().getRow()); - - if(box!=null) - { - box.clear(); - box.setAction(action); - box.baseInit(); - box.init(); - } - }); - }*/ } catch (Exception e) { @@ -704,8 +696,27 @@ public class Client extends Thread{ if(acc.getLocation().getCol()!=-1) { - clientListener.clearActionBox(acc.getLocation().getCol(), acc.getLocation().getRow()); - clientListener.addBlankActionBox(acc.getLocation().getCol(), acc.getLocation().getRow()); + String currentParent = clientListener.getCurrentParent(); + if(acc.getParent().equals(currentParent)) + { + clientListener.clearActionBox(acc.getLocation().getCol(), acc.getLocation().getRow()); + clientListener.addBlankActionBox(acc.getLocation().getCol(), acc.getLocation().getRow()); + } + + if(acc.getActionType() == ActionType.FOLDER && currentParent.equals(acc.getID())) + { + Platform.runLater(()->{ + try + { + clientListener.renderRootDefaultProfile(); + } + catch (SevereException e) + { + e.printStackTrace(); + exceptionAndAlertHandler.handleSevereException(e); + } + }); + } } --- 'a/src/main/java/com/stream_pi/client/connection/ClientListener.java' +++ b/src/main/java/com/stream_pi/client/connection/ClientListener.java @@ -34,6 +34,8 @@ public interface ClientListener ClientProfile getCurrentProfile(); + String getCurrentParent(); + Theme getCurrentTheme(); void init(); --- 'a/src/main/java/com/stream_pi/client/controller/Controller.java' +++ b/src/main/java/com/stream_pi/client/controller/Controller.java @@ -372,4 +372,10 @@ public class Controller extends Base return getDashboardPane().getActionGridPane().getClientProfile(); } + @Override + public String getCurrentParent() + { + return getDashboardPane().getActionGridPane().getCurrentParent(); + } + } --- 'a/src/main/java/com/stream_pi/client/info/ClientInfo.java' +++ b/src/main/java/com/stream_pi/client/info/ClientInfo.java @@ -108,6 +108,17 @@ public class ClientInfo { isShowShutDownButton = showShutDownButton; } + private boolean isXMode = false; + + public void setXMode(boolean isXMode) + { + this.isXMode = isXMode; + } + + public boolean isXMode() { + return isXMode; + } + public boolean isShowShutDownButton() { return isShowShutDownButton; } --- 'a/src/main/java/com/stream_pi/client/window/Base.java' +++ b/src/main/java/com/stream_pi/client/window/Base.java @@ -237,7 +237,8 @@ public abstract class Base extends Stack return dashboardBase; } - public void renderRootDefaultProfile() throws SevereException { + public void renderRootDefaultProfile() throws SevereException + { getDashboardPane().renderProfile(getClientProfiles().getProfileFromID( Config.getInstance().getStartupProfileID() )); --- 'a/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionBox.java' +++ b/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionBox.java @@ -116,7 +116,8 @@ public class ActionBox extends StackPane statusIcon.toBack(); }); - + setCache(true); + setCacheHint(CacheHint.SPEED); } public void actionClicked() --- 'a/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java' +++ b/src/main/java/com/stream_pi/client/window/dashboard/actiongridpane/ActionGridPane.java @@ -138,7 +138,8 @@ public class ActionGridPane extends Grid return stackPane; } - public void renderGrid() throws SevereException { + public void renderGrid() throws SevereException + { clear(); setHgap(getClientProfile().getActionGap()); --- 'a/src/main/java/com/stream_pi/client/window/firsttimeuse/FinalConfigPane.java' +++ b/src/main/java/com/stream_pi/client/window/firsttimeuse/FinalConfigPane.java @@ -27,14 +27,17 @@ public class FinalConfigPane extends VBo private TextField serverPortTextField; private TextField displayWidthTextField; private TextField displayHeightTextField; + private Button nextButton; private ExceptionAndAlertHandler exceptionAndAlertHandler; private ClientListener clientListener; - public FinalConfigPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ClientListener clientListener) + public FinalConfigPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ClientListener clientListener, + Button nextButton) { this.exceptionAndAlertHandler = exceptionAndAlertHandler; this.clientListener = clientListener; + this.nextButton = nextButton; getStyleClass().add("first_time_use_pane_final_config"); @@ -62,11 +65,6 @@ public class FinalConfigPane extends VBo displayHeightInputBox.setVisible(false); } - Button confirmButton = new Button("Confirm"); - confirmButton.setOnAction(event -> onConfirmButtonClicked()); - HBox bBar = new HBox(confirmButton); - bBar.setAlignment(Pos.CENTER_RIGHT); - VBox v = new VBox(clientNickNameInputBox, serverIPHostNameInputBox, serverIPPortInputBox, displayWidthInputBox, displayHeightInputBox); v.setSpacing(10.0); @@ -75,13 +73,19 @@ public class FinalConfigPane extends VBo scrollPane.getStyleClass().add("first_time_use_final_config_pane_scroll_pane"); v.prefWidthProperty().bind(scrollPane.widthProperty().subtract(25)); - getChildren().addAll(label, scrollPane, SpaceFiller.vertical(), bBar); + getChildren().addAll(label, scrollPane); 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/client/window/firsttimeuse/FirstTimeUse.java' +++ b/src/main/java/com/stream_pi/client/window/firsttimeuse/FirstTimeUse.java @@ -35,28 +35,26 @@ public class FirstTimeUse extends VBox{ VBox.setVgrow(stackPane, Priority.ALWAYS); - welcomePane = new WelcomePane(); - licensePane = new LicensePane(); - finalConfigPane = new FinalConfigPane(exceptionAndAlertHandler, clientListener); - - stackPane.getChildren().addAll( - welcomePane, - licensePane, - finalConfigPane - ); - - nextButton = new Button("Next"); nextButton.setOnAction(event-> onNextButtonClicked()); previousButton = new Button("Previous"); previousButton.setOnAction(event-> onPreviousButtonClicked()); - HBox buttonBar = new HBox(previousButton, SpaceFiller.horizontal(), nextButton); buttonBar.getStyleClass().add("first_time_use_pane_button_bar"); buttonBar.setSpacing(10.0); + welcomePane = new WelcomePane(); + licensePane = new LicensePane(); + finalConfigPane = new FinalConfigPane(exceptionAndAlertHandler, clientListener, nextButton); + + stackPane.getChildren().addAll( + welcomePane, + licensePane, + finalConfigPane + ); + getChildren().addAll(headingLabel, stackPane, buttonBar); setWindow(WindowName.WELCOME); @@ -85,6 +83,8 @@ public class FirstTimeUse extends VBox{ private void onPreviousButtonClicked() { + nextButton.setText("Next"); + if(windowName == WindowName.FINAL) { setWindow(WindowName.LICENSE); @@ -107,8 +107,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) { @@ -120,8 +121,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) { @@ -130,11 +132,11 @@ public class FirstTimeUse extends VBox{ welcomePane.setVisible(false); licensePane.setVisible(false); finalConfigPane.setVisible(true); - + headingLabel.setText("Finishing up ..."); - nextButton.setDisable(true); - previousButton.setDisable(false); + finalConfigPane.makeChangesToNextButton(); + previousButton.setVisible(true); } } --- 'a/src/main/java/com/stream_pi/client/window/firsttimeuse/LicensePane.java' +++ b/src/main/java/com/stream_pi/client/window/firsttimeuse/LicensePane.java @@ -12,10 +12,6 @@ public class LicensePane extends VBox { { 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 +19,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/client/window/settings/SettingsBase.java' +++ b/src/main/java/com/stream_pi/client/window/settings/SettingsBase.java @@ -451,7 +451,8 @@ public class SettingsBase extends VBox { StartAtBoot startAtBoot = new StartAtBoot(SoftwareType.CLIENT, ClientInfo.getInstance().getPlatformType()); if(startOnBoot) { - startAtBoot.create(new File(ClientInfo.getInstance().getRunnerFileName())); + startAtBoot.create(new File(ClientInfo.getInstance().getRunnerFileName()), + ClientInfo.getInstance().isXMode()); } else { --- 'a/src/main/java/module-info.java' +++ b/src/main/java/module-info.java @@ -8,6 +8,8 @@ module com.stream_pi.client { requires com.gluonhq.attach.lifecycle; requires com.gluonhq.attach.util; + requires org.apache.commons.lang3; + requires java.xml; requires com.stream_pi.util; --- /dev/null +++ b/src/main/resources/META-INF/native-image/serialization-config.json @@ -0,0 +1,8 @@ +[ + {"name":"com.stream_pi.util.comms.Message"}, + {"name": "java.lang.String"}, + {"name": "java.lang.String[]"}, + {"name": "java.lang.Byte"}, + {"name": "java.lang.Byte[]"}, + {"name": "java.lang.Number"} +] \ No newline at end of file --- /dev/null +++ b/test.json @@ -0,0 +1,11 @@ +[ + { + "name":"com.stream_pi.util.comms.StreamPiMessage", + "allDeclaredConstructors" : true, + "allPublicConstructors" : true, + "allDeclaredMethods" : true, + "allPublicMethods" : true, + "allDeclaredClasses" : true, + "allPublicClasses" : true + } +] \ No newline at end of file