From: rnayabed Date: Wed, 10 Mar 2021 14:27:17 +0530 Subject: removed client display size editing feature --- removed client display size editing feature --- --- 'a/src/main/java/com/stream_pi/server/client/Client.java' +++ b/src/main/java/com/stream_pi/server/client/Client.java @@ -35,7 +35,7 @@ public class Client private final Version themeAPIVersion; private final ReleaseStatus releaseStatus; - private double startupDisplayHeight, startupDisplayWidth; + private double displayHeight, displayWidth; private final HashMap profiles; @@ -157,34 +157,34 @@ public class Client return themeAPIVersion; } - public double getStartupDisplayHeight() + public double getDisplayHeight() { - return startupDisplayHeight; + return displayHeight; } - public double getStartupDisplayWidth() + public double getDisplayWidth() { - return startupDisplayWidth; + return displayWidth; } - public void setStartupDisplayHeight(double height) + public void setDisplayHeight(double height) { - startupDisplayHeight = height; + displayHeight = height; } - public void setStartupDisplayWidth(double width) + public void setDisplayWidth(double width) { - startupDisplayWidth = width; + displayWidth = width; } private int getMaxRows(int eachActionSize) { - return (int) (startupDisplayHeight / eachActionSize); + return (int) (displayHeight / eachActionSize); } public int getMaxCols(int eachActionSize) { - return (int) (startupDisplayWidth / eachActionSize); + return (int) (displayWidth / eachActionSize); } } --- 'a/src/main/java/com/stream_pi/server/connection/ClientConnection.java' +++ b/src/main/java/com/stream_pi/server/connection/ClientConnection.java @@ -159,8 +159,8 @@ public class ClientConnection extends Th client = new Client(clientVersion, releaseStatus, commsStandard, themesStandard, ar[4], Platform.valueOf(ar[7]), socket.getRemoteSocketAddress()); - client.setStartupDisplayWidth(Double.parseDouble(ar[5])); - client.setStartupDisplayHeight(Double.parseDouble(ar[6])); + client.setDisplayWidth(Double.parseDouble(ar[5])); + client.setDisplayHeight(Double.parseDouble(ar[6])); client.setDefaultProfileID(ar[8]); client.setDefaultThemeFullName(ar[9]); @@ -672,14 +672,12 @@ public class ClientConnection extends Th sendMessage(message); } - public void saveClientDetails(String clientNickname, String screenWidth, String screenHeight, String defaultProfileID, + public void saveClientDetails(String clientNickname, String defaultProfileID, String defaultThemeFullName) throws SevereException { Message message = new Message("save_client_details"); message.setStringArrValue( clientNickname, - screenWidth, - screenHeight, defaultProfileID, defaultThemeFullName ); @@ -687,8 +685,6 @@ public class ClientConnection extends Th sendMessage(message); client.setNickName(clientNickname); - client.setStartupDisplayWidth(Double.parseDouble(screenWidth)); - client.setStartupDisplayHeight(Double.parseDouble(screenHeight)); client.setDefaultProfileID(defaultProfileID); client.setDefaultThemeFullName(defaultThemeFullName); } --- 'a/src/main/java/com/stream_pi/server/window/settings/ClientsSettings.java' +++ b/src/main/java/com/stream_pi/server/window/settings/ClientsSettings.java @@ -92,21 +92,6 @@ public class ClientsSettings extends VBo if(clientSettingsVBox.getNickname().isBlank()) errors.append(" Cannot have blank nickname. \n"); - try { - Double.parseDouble(clientSettingsVBox.getStartupWindowHeight()); - } - catch (NumberFormatException e) - { - errors.append(" Must have integer display height. \n"); - } - - try { - Double.parseDouble(clientSettingsVBox.getStartupWindowWidth()); - } - catch (NumberFormatException e) - { - errors.append(" Must have integer display width. \n"); - } for(ClientProfileVBox clientProfileVBox : clientSettingsVBox.getClientProfileVBoxes()) { @@ -137,10 +122,8 @@ public class ClientsSettings extends VBo int rows = Integer.parseInt(clientProfileVBox.getRows()); int actionsSize = Integer.parseInt(clientProfileVBox.getActionSize()); - double startupWidth = Double.parseDouble(clientSettingsVBox.getStartupWindowWidth()); - - if((rows*actionsSize) > (startupWidth - 50)) + if((rows*actionsSize) > (clientSettingsVBox.getDisplayWidth() - 50)) { errors2.append(" Rows out of bounds of screen size. \n"); } @@ -155,9 +138,8 @@ public class ClientsSettings extends VBo int cols = Integer.parseInt(clientProfileVBox.getCols()); int actionsSize = Integer.parseInt(clientProfileVBox.getActionSize()); - double startupHeight = Double.parseDouble(clientSettingsVBox.getStartupWindowHeight()); - if((cols*actionsSize) > (startupHeight - 50)) + if((cols*actionsSize) > (clientSettingsVBox.getDisplayHeight() - 50)) { errors2.append(" Cols out of bounds of screen size. \n"); } @@ -271,16 +253,23 @@ public class ClientsSettings extends VBo private ComboBox themesComboBox; - private TextField startupWindowHeightTextField; + private double displayHeight; + private double displayWidth; + + public double getDisplayHeight() { + return displayHeight; + } - public String getStartupWindowHeight() { - return startupWindowHeightTextField.getText(); + public void setDisplayHeight(double displayHeight) { + this.displayHeight = displayHeight; } - private TextField startupWindowWidthTextField; + public double getDisplayWidth() { + return displayWidth; + } - public String getStartupWindowWidth() { - return startupWindowWidthTextField.getText(); + public void setDisplayWidth(double displayWidth) { + this.displayWidth = displayWidth; } private TextField nicknameTextField; @@ -314,8 +303,6 @@ public class ClientsSettings extends VBo private Label platformLabel; - private HBoxInputBox startupWindowHeightInputBox, startupWindowWidthInputBox; - public ArrayList getClientProfileVBoxes() { return clientProfileVBoxes; } @@ -342,8 +329,6 @@ public class ClientsSettings extends VBo getConnection().saveClientDetails( nicknameTextField.getText(), - startupWindowWidthTextField.getText(), - startupWindowHeightTextField.getText(), profilesComboBox.getSelectionModel().getSelectedItem().getID(), themesComboBox.getSelectionModel().getSelectedItem().getThemeFullName() ); @@ -433,9 +418,6 @@ public class ClientsSettings extends VBo themesComboBox.setCellFactory(themesComboBoxFactory); themesComboBox.setButtonCell(themesComboBoxFactory.call(null)); - startupWindowHeightTextField = new TextField(); - startupWindowWidthTextField = new TextField(); - platformLabel = new Label(); platformLabel.getStyleClass().add("client_settings_each_client_platform_label"); @@ -463,12 +445,6 @@ public class ClientsSettings extends VBo getStyleClass().add("settings_clients_each_client"); - startupWindowHeightInputBox = new HBoxInputBox("Startup window Height", startupWindowHeightTextField); - startupWindowHeightInputBox.managedProperty().bind(startupWindowHeightInputBox.visibleProperty()); - - startupWindowWidthInputBox = new HBoxInputBox("Startup window Width", startupWindowWidthTextField); - startupWindowWidthInputBox.managedProperty().bind(startupWindowWidthInputBox.visibleProperty()); - this.getChildren().addAll( nickNameLabel, @@ -482,10 +458,6 @@ public class ClientsSettings extends VBo themesComboBox ), - startupWindowHeightInputBox, - - startupWindowWidthInputBox, - new HBox(new Label("Startup Profile"), SpaceFiller.horizontal(), profilesComboBox), @@ -514,16 +486,10 @@ public class ClientsSettings extends VBo nicknameTextField.setText(client.getNickName()); - if(client.getPlatform() == com.stream_pi.util.platform.Platform.ANDROID) - { - startupWindowHeightInputBox.setVisible(false); - startupWindowWidthInputBox.setVisible(false); - } - platformLabel.setText("Platform : "+client.getPlatform().getUIName()); - startupWindowWidthTextField.setText(client.getStartupDisplayWidth()+""); - startupWindowHeightTextField.setText(client.getStartupDisplayHeight()+""); + setDisplayHeight(client.getDisplayHeight()); + setDisplayWidth(client.getDisplayWidth()); socketConnectionLabel.setText(client.getRemoteSocketAddress().toString().substring(1)); //substring removes the `/`