client

Clone or download

Modified Files

--- 'a/src/main/java/com/stream_pi/client/connection/Client.java'
+++ b/src/main/java/com/stream_pi/client/connection/Client.java
@@ -241,7 +241,6 @@ public class Client extends Thread{
);
Action a = clientListener.getClientProfiles().getProfileFromID(profileID).getActionFromID(actionID);
- clientListener.clearActionBox(a.getLocation().getCol(), a.getLocation().getRow());
clientListener.renderAction(profileID, a);
}
@@ -697,23 +696,20 @@ public class Client extends Thread{
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);
- }
- });
- }
+
+ Platform.runLater(()->{
+ try
+ {
+ clientListener.renderRootDefaultProfile();
+ }
+ catch (SevereException e)
+ {
+ e.printStackTrace();
+ exceptionAndAlertHandler.handleSevereException(e);
+ }
+ });
}
@@ -784,7 +780,7 @@ public class Client extends Thread{
{
clientListener.getClientProfiles().addProfile(clientProfile);
clientProfile.saveProfileDetails();
- clientListener.refreshGridIfCurrent(sep[0]);
+ clientListener.refreshGridIfCurrentProfile(sep[0]);
javafx.application.Platform.runLater(clientListener::loadSettings);
}
catch (Exception e)
--- 'a/src/main/java/com/stream_pi/client/connection/ClientListener.java'
+++ b/src/main/java/com/stream_pi/client/connection/ClientListener.java
@@ -28,7 +28,7 @@ public interface ClientListener
void clearActionBox(int col, int row);
void addBlankActionBox(int col, int row);
void renderAction(String currentProfileID, Action action);
- void refreshGridIfCurrent(String currentProfileID);
+ void refreshGridIfCurrentProfile(String currentProfileID);
ActionBox getActionBox(int col, int row);
--- 'a/src/main/java/com/stream_pi/client/controller/Controller.java'
+++ b/src/main/java/com/stream_pi/client/controller/Controller.java
@@ -353,9 +353,11 @@ public class Controller extends Base
}
@Override
- public void refreshGridIfCurrent(String profileID) {
+ public void refreshGridIfCurrentProfile(String profileID) {
ClientProfile clientProfile = getDashboardPane().getActionGridPane().getClientProfile();
+ getDashboardPane().getActionGridPane().setFreshRender(true);
+
if(clientProfile.getID().equals(profileID))
{
Platform.runLater(()->{
--- '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
@@ -44,18 +44,19 @@ public class ActionBox extends StackPane
public void clear()
- {
+ {
+ setStyle(null);
setAction(null);
+ getStyleClass().clear();
setBackground(Background.EMPTY);
- setStyle(null);
getChildren().clear();
+ baseInit();
}
private FontIcon statusIcon;
public void baseInit()
{
-
displayTextLabel = new Label();
displayTextLabel.setWrapText(true);
displayTextLabel.setTextAlignment(TextAlignment.CENTER);
@@ -80,9 +81,10 @@ public class ActionBox extends StackPane
getStyleClass().clear();
getStyleClass().add("action_box");
- getStyleClass().add("action_box_icon_not_present");
getStyleClass().add("action_box_"+row+"_"+col);
+ setIcon(null);
+
setOnMouseClicked(touchEvent -> actionClicked());
setOnMousePressed(TouchEvent -> {
@@ -203,7 +205,7 @@ public class ActionBox extends StackPane
}
}
- private Action action;
+ private Action action = null;
public Action getAction() {
return action;
--- '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
@@ -27,6 +27,8 @@ public class ActionGridPane extends Grid
private ClientListener clientListener;
+ private ActionBox[][] actionBoxes;
+
public ActionGridPane(ExceptionAndAlertHandler exceptionAndAlertHandler, ClientListener clientListener)
{
this.clientListener = clientListener;
@@ -92,7 +94,7 @@ public class ActionGridPane extends Grid
public void failShow(Action action)
{
- for(Node node : getChildren())
+ /*for(Node node : getChildren())
{
if(GridPane.getColumnIndex(node) == action.getLocation().getRow() &&
GridPane.getRowIndex(node) == action.getLocation().getCol())
@@ -104,7 +106,9 @@ public class ActionGridPane extends Grid
break;
}
- }
+ }*/
+
+ actionBoxes[action.getLocation().getCol()][action.getLocation().getRow()].animateStatus();
}
@@ -135,20 +139,47 @@ public class ActionGridPane extends Grid
return stackPane;
}
+ private boolean isFreshRender = true;
+ private Node folderBackButton = null;
public void renderGrid() throws SevereException
{
- clear();
-
setHgap(getClientProfile().getActionGap());
setVgap(getClientProfile().getActionGap());
+ if(isFreshRender)
+ {
+ clear();
+ actionBoxes = new ActionBox[cols][rows];
+ }
+
boolean isFolder = false;
- if(!getCurrentParent().equals("root"))
+ if(getCurrentParent().equals("root"))
+ {
+ if(folderBackButton != null)
+ {
+ getChildren().remove(folderBackButton);
+ folderBackButton = null;
+
+ actionBoxes[0][0] = addBlankActionBox(0,0);
+ }
+ }
+ else
{
isFolder = true;
- add(getFolderBackButton(), 0,0);
+ if(folderBackButton != null)
+ {
+ getChildren().remove(folderBackButton);
+ folderBackButton = null;
+ }
+ else
+ {
+ getChildren().remove(actionBoxes[0][0]);
+ }
+
+ folderBackButton = getFolderBackButton();
+ add(folderBackButton, 0,0);
}
for(int row = 0; row<rows; row++)
@@ -158,10 +189,32 @@ public class ActionGridPane extends Grid
if(row == 0 && col == 0 && isFolder)
continue;
- addBlankActionBox(col, row);
+ if(isFreshRender)
+ {
+ actionBoxes[col][row] = addBlankActionBox(col, row);
+ }
+ else
+ {
+ if(actionBoxes[col][row].getAction() != null)
+ {
+ logger.info("xc234213123123");
+ actionBoxes[col][row].clear();
+ }
+ else
+ {
+ logger.info("bbbbbb " +col+","+row);
+ }
+ }
+ logger.info(isFreshRender+"22222222222222222xxxxxxxxxx");
}
}
+
+ isFreshRender = false;
+ }
+
+ public void setFreshRender(boolean isFreshRender) {
+ this.isFreshRender = isFreshRender;
}
public void renderActions()
@@ -200,20 +253,14 @@ public class ActionGridPane extends Grid
public void clearActionBox(int col, int row)
{
- for(Node node : getChildren())
- {
- if(GridPane.getColumnIndex(node) == row &&
- GridPane.getRowIndex(node) == col)
- {
- getChildren().remove(node);
- break;
- }
- }
+ actionBoxes[col][row].clear();
}
public ActionBox getActionBox(int col, int row)
{
- for(Node node : getChildren())
+ return actionBoxes[col][row];
+
+ /*for(Node node : getChildren())
{
if(GridPane.getColumnIndex(node) == row &&
GridPane.getRowIndex(node) == col)
@@ -222,16 +269,17 @@ public class ActionGridPane extends Grid
}
}
- return null;
+ return null;*/
}
- public void addBlankActionBox(int col, int row)
+ public ActionBox addBlankActionBox(int col, int row)
{
ActionBox actionBox = new ActionBox(getClientProfile().getActionSize(), this, row, col);
actionBox.setStreamPiParent(currentParent);
add(actionBox, row, col);
+ return actionBox;
}
public void renderAction(Action action) throws SevereException, MinorException
@@ -257,7 +305,15 @@ public class ActionGridPane extends Grid
Location location = action.getLocation();
- ActionBox actionBox = new ActionBox(getClientProfile().getActionSize(), action, exceptionAndAlertHandler, this, location.getRow(), location.getCol());
+ ActionBox actionBox = actionBoxes[location.getCol()][location.getRow()];
+
+ actionBox.clear();
+
+ actionBox.setAction(action);
+ actionBox.setStreamPiParent(currentParent);
+ actionBox.init();
+
+ /*ActionBox actionBox = new ActionBox(getClientProfile().getActionSize(), action, exceptionAndAlertHandler, this, location.getRow(), location.getCol());
actionBox.setStreamPiParent(currentParent);
@@ -266,6 +322,7 @@ public class ActionGridPane extends Grid
System.out.println(location.getCol()+","+location.getRow());
add(actionBox, location.getRow(), location.getCol());
+ actionBoxes[location.getCol()][location.getRow()] = actionBox;*/
}
public void setRows(int rows)