From: Debayan Sutradhar Date: Fri, 30 Apr 2021 01:00:52 +0530 Subject: lots of minor bug fixes, Client Action Grid Pane now is present inside a Scroll Pane --- lots of minor bug fixes, Client Action Grid Pane now is present inside a Scroll Pane --- --- 'a/pom.xml' +++ b/pom.xml @@ -27,6 +27,8 @@ 1.0.0-SNAPSHOT 1.0.0-SNAPSHOT + 4.0.11 + com.stream_pi.client.Main 2.2.1 @@ -89,27 +91,32 @@ com.gluonhq.attach lifecycle - 4.0.10 + ${attach.version} com.gluonhq.attach util - 4.0.10 + ${attach.version} + + + com.gluonhq.attach + orientation + ${attach.version} com.gluonhq.attach storage - 4.0.10 + ${attach.version} com.gluonhq.attach browser - 4.0.10 + ${attach.version} com.gluonhq.attach vibration - 4.0.10 + ${attach.version} @@ -165,6 +172,7 @@ storage browser vibration + orientation java.util.logging.FileHandler --- 'a/src/main/java/com/stream_pi/client/controller/Controller.java' +++ b/src/main/java/com/stream_pi/client/controller/Controller.java @@ -1,5 +1,6 @@ package com.stream_pi.client.controller; +import com.gluonhq.attach.orientation.OrientationService; import com.gluonhq.attach.vibration.VibrationService; import com.stream_pi.action_api.action.Action; import com.stream_pi.client.connection.Client; @@ -25,9 +26,12 @@ import javafx.animation.KeyFrame; import javafx.animation.KeyValue; import javafx.animation.Timeline; import javafx.application.Platform; +import javafx.beans.InvalidationListener; import javafx.beans.value.ChangeListener; +import javafx.geometry.Orientation; import javafx.scene.Node; import javafx.scene.input.KeyCombination; +import javafx.stage.Screen; import javafx.util.Duration; import java.io.*; @@ -140,20 +144,11 @@ public class Controller extends Base firstRun = false; } - - ChangeListener windowResizeListener = (observableValue, number, t1) -> { - if(isConnected()) - { - try { - client.sendClientScreenDetails(); - } catch (SevereException e) { - e.printStackTrace(); - } - } - }; - - getStage().widthProperty().addListener(windowResizeListener); - getStage().heightProperty().addListener(windowResizeListener); + if(!getClientInfo().isPhone()) + { + getStage().widthProperty().addListener((observableValue, orientation, t1) -> syncClientSizeDetailsWithServer()); + getStage().heightProperty().addListener((observableValue, orientation, t1) -> syncClientSizeDetailsWithServer()); + } } catch (SevereException e) @@ -166,6 +161,18 @@ public class Controller extends Base } } + public void syncClientSizeDetailsWithServer() + { + if(isConnected()) + { + try { + client.sendClientScreenDetails(); + } catch (SevereException e) { + e.printStackTrace(); + } + } + } + @Override public void setupClientConnection() { --- 'a/src/main/java/com/stream_pi/client/window/Base.java' +++ b/src/main/java/com/stream_pi/client/window/Base.java @@ -192,7 +192,6 @@ public abstract class Base extends Stack if(getClientInfo().isPhone()) { - System.out.println("FELLOW ANDROID ENJOYER :D"); firstTimeUse.setPadding(new Insets(10)); } @@ -200,7 +199,6 @@ public abstract class Base extends Stack //resolution check resizeAccordingToResolution(); - } else { @@ -217,8 +215,6 @@ public abstract class Base extends Stack double height = getScreenHeight(); double width = getScreenWidth(); - logger.info("HEIGHT: "+height+", WIDTH: "+width); - if(height < 500) setPrefHeight(320); --- '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 @@ -17,6 +17,7 @@ import javafx.geometry.Insets; import javafx.geometry.Pos; import javafx.scene.CacheHint; import javafx.scene.Node; +import javafx.scene.control.ScrollPane; import javafx.scene.layout.GridPane; import javafx.scene.layout.Priority; import javafx.scene.layout.StackPane; @@ -24,7 +25,7 @@ import javafx.scene.layout.VBox; import javafx.scene.paint.Color; import org.kordamp.ikonli.javafx.FontIcon; -public class ActionGridPane extends GridPane implements ActionGridPaneListener +public class ActionGridPane extends ScrollPane implements ActionGridPaneListener { private ExceptionAndAlertHandler exceptionAndAlertHandler; @@ -33,20 +34,27 @@ public class ActionGridPane extends Grid private ActionBox[][] actionBoxes; + private GridPane actionsGridPane; + public ActionGridPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ClientListener clientListener) { this.clientListener = clientListener; logger = Logger.getLogger(ActionGridPane.class.getName()); this.exceptionAndAlertHandler = exceptionAndAlertHandler; - getStyleClass().add("action_grid_pane"); - setPadding(new Insets(5.0)); + getStyleClass().add("action_grid_pane_parent"); + + actionsGridPane = new GridPane(); + actionsGridPane.setPadding(new Insets(5.0)); + actionsGridPane.getStyleClass().add("action_grid_pane"); + actionsGridPane.prefWidthProperty().bind(widthProperty().subtract(2)); + actionsGridPane.prefHeightProperty().bind(heightProperty().subtract(2)); - setPrefSize(USE_COMPUTED_SIZE, USE_COMPUTED_SIZE); + setContent(actionsGridPane); + actionsGridPane.setAlignment(Pos.CENTER); - setAlignment(Pos.CENTER); VBox.setVgrow(this, Priority.ALWAYS); @@ -150,8 +158,8 @@ public class ActionGridPane extends Grid private Node folderBackButton = null; public void renderGrid() { - setHgap(getClientProfile().getActionGap()); - setVgap(getClientProfile().getActionGap()); + actionsGridPane.setHgap(getClientProfile().getActionGap()); + actionsGridPane.setVgap(getClientProfile().getActionGap()); if(isFreshRender) { @@ -165,7 +173,7 @@ public class ActionGridPane extends Grid { if(folderBackButton != null) { - getChildren().remove(folderBackButton); + actionsGridPane.getChildren().remove(folderBackButton); folderBackButton = null; actionBoxes[0][0] = addBlankActionBox(0,0); @@ -177,16 +185,16 @@ public class ActionGridPane extends Grid if(folderBackButton != null) { - getChildren().remove(folderBackButton); + actionsGridPane.getChildren().remove(folderBackButton); folderBackButton = null; } else { - getChildren().remove(actionBoxes[0][0]); + actionsGridPane.getChildren().remove(actionBoxes[0][0]); } folderBackButton = getFolderBackButton(); - add(folderBackButton, 0,0); + actionsGridPane.add(folderBackButton, 0,0); } for(int row = 0; row