server

Clone or download

Updated default, fix client #67

Modified Files

package com.stream_pi.server.window.dashboard.actiongridpane;
package com.stream_pi.server.window.dashboard.actiongridpane;
import com.stream_pi.action_api.action.Action;
import com.stream_pi.action_api.action.Action;
import com.stream_pi.action_api.action.ActionType;
import com.stream_pi.action_api.action.ActionType;
import com.stream_pi.action_api.action.DisplayTextAlignment;
import com.stream_pi.action_api.action.DisplayTextAlignment;
import com.stream_pi.action_api.action.Location;
import com.stream_pi.action_api.action.Location;
import com.stream_pi.action_api.actionproperty.ClientProperties;
import com.stream_pi.action_api.actionproperty.ClientProperties;
import com.stream_pi.action_api.externalplugin.ExternalPlugin;
import com.stream_pi.action_api.externalplugin.ExternalPlugin;
import com.stream_pi.server.controller.ActionDataFormats;
import com.stream_pi.server.controller.ActionDataFormats;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.ExceptionAndAlertHandler;
import com.stream_pi.server.window.dashboard.actiondetailpane.ActionDetailsPaneListener;
import com.stream_pi.server.window.dashboard.actiondetailpane.ActionDetailsPaneListener;
import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.exception.MinorException;
import javafx.application.Platform;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.concurrent.Task;
import javafx.geometry.Pos;
import javafx.geometry.Pos;
import javafx.scene.CacheHint;
import javafx.scene.CacheHint;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.Label;
import javafx.scene.control.Label;
import javafx.scene.control.Menu;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuItem;
import javafx.scene.control.MenuItem;
import javafx.scene.image.Image;
import javafx.scene.image.Image;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseButton;
import javafx.scene.input.TransferMode;
import javafx.scene.input.TransferMode;
import javafx.scene.layout.Background;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.BackgroundImage;
import javafx.scene.layout.BackgroundPosition;
import javafx.scene.layout.BackgroundPosition;
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundRepeat;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.BackgroundSize;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.StackPane;
import javafx.scene.text.TextAlignment;
import javafx.scene.text.TextAlignment;
import org.kordamp.ikonli.javafx.FontIcon;
import org.kordamp.ikonli.javafx.FontIcon;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream;
import java.nio.ByteBuffer;
import java.nio.ByteBuffer;
import java.util.HashMap;
import java.util.HashMap;
public class ActionBox extends StackPane{
public class ActionBox extends StackPane{
private Label displayTextLabel;
private Label displayTextLabel;
private int row;
private int row;
private int col;
private int col;
public void setRow(int row) {
public void setRow(int row) {
this.row = row;
this.row = row;
}
}
public void setCol(int col) {
public void setCol(int col) {
this.col = col;
this.col = col;
}
}
public int getRow() {
public int getRow() {
return row;
return row;
}
}
public int getCol() {
public int getCol() {
return col;
return col;
}
}
private ActionDetailsPaneListener actionDetailsPaneListener;
private ActionDetailsPaneListener actionDetailsPaneListener;
public void clear()
public void clear()
{
{
setStyle(null);
setStyle(null);
setAction(null);
setAction(null);
getStyleClass().clear();
getStyleClass().clear();
setBackground(Background.EMPTY);
setBackground(Background.EMPTY);
removeFontIcon();
removeFontIcon();
getChildren().clear();
getChildren().clear();
baseInit();
baseInit();
}
}
public void baseInit()
public void baseInit()
{
{
displayTextLabel = new Label();
displayTextLabel = new Label();
displayTextLabel.setWrapText(true);
displayTextLabel.setWrapText(true);
displayTextLabel.setTextAlignment(TextAlignment.CENTER);
displayTextLabel.setTextAlignment(TextAlignment.CENTER);
displayTextLabel.getStyleClass().add("action_box_display_text_label");
displayTextLabel.getStyleClass().add("action_box_display_text_label");
displayTextLabel.prefHeightProperty().bind(heightProperty());
displayTextLabel.prefHeightProperty().bind(heightProperty());
displayTextLabel.prefWidthProperty().bind(widthProperty());
displayTextLabel.prefWidthProperty().bind(widthProperty());
getChildren().addAll(displayTextLabel);
getChildren().addAll(displayTextLabel);
setMinSize(size, size);
setMinSize(size, size);
setMaxSize(size, size);
setMaxSize(size, size);
getStyleClass().add("action_box");
getStyleClass().add("action_box");
setIcon(null);
setIcon(null);
getStyleClass().add("action_box_valid");
getStyleClass().add("action_box_valid");
setOnDragOver(dragEvent ->
setOnDragOver(dragEvent ->
{
{
if(dragEvent.getDragboard().hasContent(ActionDataFormats.ACTION_TYPE))
if(dragEvent.getDragboard().hasContent(ActionDataFormats.ACTION_TYPE))
{
{
dragEvent.acceptTransferModes(TransferMode.ANY);
dragEvent.acceptTransferModes(TransferMode.ANY);
dragEvent.consume();
dragEvent.consume();
}
}
});
});
setOnDragDropped(dragEvent ->
setOnDragDropped(dragEvent ->
{
{
try
try
{
{
if(action == null)
if(action == null)
{
{
Dragboard db = dragEvent.getDragboard();
Dragboard db = dragEvent.getDragboard();
ActionType actionType = (ActionType) db.getContent(ActionDataFormats.ACTION_TYPE);
ActionType actionType = (ActionType) db.getContent(ActionDataFormats.ACTION_TYPE);
if(actionType == ActionType.NORMAL || actionType == ActionType.TOGGLE)
if(actionType == ActionType.NORMAL || actionType == ActionType.TOGGLE)
{
{
String moduleName = (String) dragEvent.getDragboard().getContent(ActionDataFormats.MODULE_NAME);
String moduleName = (String) dragEvent.getDragboard().getContent(ActionDataFormats.MODULE_NAME);
ExternalPlugin newAction = actionGridPaneListener.createNewActionFromExternalPlugin(moduleName);
ExternalPlugin newAction = actionGridPaneListener.createNewActionFromExternalPlugin(moduleName);
boolean isNew = (boolean) db.getContent(ActionDataFormats.IS_NEW);
boolean isNew = (boolean) db.getContent(ActionDataFormats.IS_NEW);
if(isNew)
if(isNew)
{
{
newAction.getClientProperties().resetToDefaults();
newAction.getClientProperties().resetToDefaults();
newAction.setDisplayText(newAction.getName());
newAction.setDisplayText(newAction.getName());
if(newAction.getActionType() == ActionType.TOGGLE)
if(newAction.getActionType() == ActionType.TOGGLE)
{
{
newAction.setShowDisplayText(false);
newAction.setShowDisplayText(false);
newAction.setDisplayTextAlignment(DisplayTextAlignment.BOTTOM);
newAction.setDisplayTextAlignment(DisplayTextAlignment.BOTTOM);
}
}
else
else
{
{
newAction.setShowDisplayText(true);
newAction.setShowDisplayText(true);
newAction.setDisplayTextAlignment(DisplayTextAlignment.CENTER);
newAction.setDisplayTextAlignment(DisplayTextAlignment.CENTER);
}
}
if(actionType == ActionType.TOGGLE)
if(actionType == ActionType.TOGGLE)
newAction.setCurrentIconState("false__false");
newAction.setCurrentIconState("false__false");
}
}
else
else
{
{
newAction.setClientProperties((ClientProperties) db.getContent(ActionDataFormats.CLIENT_PROPERTIES));
newAction.setClientProperties((ClientProperties) db.getContent(ActionDataFormats.CLIENT_PROPERTIES));
newAction.setIcons((HashMap<String, byte[]>) db.getContent(ActionDataFormats.ICONS));
newAction.setIcons((HashMap<String, byte[]>) db.getContent(ActionDataFormats.ICONS));
newAction.setCurrentIconState((String) db.getContent(ActionDataFormats.CURRENT_ICON_STATE));
newAction.setCurrentIconState((String) db.getContent(ActionDataFormats.CURRENT_ICON_STATE));
newAction.setBgColourHex((String) db.getContent(ActionDataFormats.BACKGROUND_COLOUR));
newAction.setBgColourHex((String) db.getContent(ActionDataFormats.BACKGROUND_COLOUR));
newAction.setDisplayTextFontColourHex((String) db.getContent(ActionDataFormats.DISPLAY_TEXT_FONT_COLOUR));
newAction.setDisplayTextFontColourHex((String) db.getContent(ActionDataFormats.DISPLAY_TEXT_FONT_COLOUR));
newAction.setDisplayText((String) db.getContent(ActionDataFormats.DISPLAY_TEXT));
newAction.setDisplayText((String) db.getContent(ActionDataFormats.DISPLAY_TEXT));
newAction.setDisplayTextAlignment((DisplayTextAlignment) db.getContent(ActionDataFormats.DISPLAY_TEXT_ALIGNMENT));
newAction.setDisplayTextAlignment((DisplayTextAlignment) db.getContent(ActionDataFormats.DISPLAY_TEXT_ALIGNMENT));
newAction.setShowDisplayText((boolean) db.getContent(ActionDataFormats.DISPLAY_TEXT_SHOW));
newAction.setShowDisplayText((boolean) db.getContent(ActionDataFormats.DISPLAY_TEXT_SHOW));
}
}
newAction.setLocation(new Location(getRow(),
newAction.setLocation(new Location(getRow(),
getCol()));
getCol()));
newAction.setParent(actionGridPaneListener.getCurrentParent());
newAction.setParent(actionGridPaneListener.getCurrentParent());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
try
try
{
{
newAction.onActionCreate();
newAction.onActionCreate();
}
}
catch (Exception e)
catch (Exception e)
{
{
exceptionAndAlertHandler.handleMinorException(new MinorException("Error","onCreate() failed for "+action.getModuleName()+"\n\n"+e.getMessage()));
exceptionAndAlertHandler.handleMinorException(new MinorException("Error","onCreate() failed for "+action.getModuleName()+"\n\n"+e.getMessage()));
}
}
newAction.setProfileID(actionGridPaneListener.getCurrentProfile().getID());
newAction.setProfileID(actionGridPaneListener.getCurrentProfile().getID());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
actionGridPaneListener.addActionToCurrentClientProfile(newAction);
actionGridPaneListener.addActionToCurrentClientProfile(newAction);
setAction(newAction);
setAction(newAction);
init();
init();
actionDetailsPaneListener.onActionClicked(newAction, this);
actionDetailsPaneListener.onActionClicked(newAction, this);
if(newAction.isHasIcon())
if(newAction.isHasIcon())
actionDetailsPaneListener.setSendIcon(true);
actionDetailsPaneListener.setSendIcon(true);
actionDetailsPaneListener.saveAction(true, false);
actionDetailsPaneListener.saveAction(true, false);
}
}
else
else
{
{
Action newAction = actionGridPaneListener.createNewOtherAction(actionType);
Action newAction = actionGridPaneListener.createNewOtherAction(actionType);
newAction.setLocation(new Location(getRow(),
newAction.setLocation(new Location(getRow(),
getCol()));
getCol()));
newAction.setParent(actionGridPaneListener.getCurrentParent());
newAction.setParent(actionGridPaneListener.getCurrentParent());
newAction.setProfileID(actionGridPaneListener.getCurrentProfile().getID());
newAction.setProfileID(actionGridPaneListener.getCurrentProfile().getID());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
newAction.setSocketAddressForClient(actionGridPaneListener.getClientConnection().getRemoteSocketAddress());
actionGridPaneListener.addActionToCurrentClientProfile(newAction);
actionGridPaneListener.addActionToCurrentClientProfile(newAction);
setAction(newAction);
setAction(newAction);
init();
init();
actionDetailsPaneListener.onActionClicked(newAction, this);
actionDetailsPaneListener.onActionClicked(newAction, this);
if(newAction.isHasIcon())
if(newAction.isHasIcon())
actionDetailsPaneListener.setSendIcon(true);
actionDetailsPaneListener.setSendIcon(true);
actionDetailsPaneListener.saveAction(true, false);
actionDetailsPaneListener.saveAction(true, false);
}
}
}
}
}
}
catch (MinorException e)
catch (MinorException e)
{
{
exceptionAndAlertHandler.handleMinorException(e);
exceptionAndAlertHandler.handleMinorException(e);
e.printStackTrace();
e.printStackTrace();
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
});
});
setOnDragDetected(mouseEvent -> {
setOnDragDetected(mouseEvent -> {
if(getAction()!=null)
if(getAction()!=null)
{
{
if(getAction().getActionType() == ActionType.NORMAL)
if(getAction().getActionType() == ActionType.NORMAL)
{
{
Dragboard db = startDragAndDrop(TransferMode.ANY);
Dragboard db = startDragAndDrop(TransferMode.ANY);
ClipboardContent content = new ClipboardContent();
ClipboardContent content = new ClipboardContent();
content.put(ActionDataFormats.CLIENT_PROPERTIES, getAction().getClientProperties());
content.put(ActionDataFormats.CLIENT_PROPERTIES, getAction().getClientProperties());
content.put(ActionDataFormats.ICONS, getAction().getIcons());
content.put(ActionDataFormats.ICONS, getAction().getIcons());
content.put(ActionDataFormats.CURRENT_ICON_STATE, getAction().getCurrentIconState());
content.put(ActionDataFormats.CURRENT_ICON_STATE, getAction().getCurrentIconState());
content.put(ActionDataFormats.BACKGROUND_COLOUR, getAction().getBgColourHex());
content.put(ActionDataFormats.BACKGROUND_COLOUR, getAction().getBgColourHex());
content.put(ActionDataFormats.DISPLAY_TEXT_FONT_COLOUR, getAction().getDisplayTextFontColourHex());
content.put(ActionDataFormats.DISPLAY_TEXT_FONT_COLOUR, getAction().getDisplayTextFontColourHex());
content.put(ActionDataFormats.DISPLAY_TEXT, getAction().getDisplayText());
content.put(ActionDataFormats.DISPLAY_TEXT, getAction().getDisplayText());
content.put(ActionDataFormats.DISPLAY_TEXT_ALIGNMENT, getAction().getDisplayTextAlignment());
content.put(ActionDataFormats.DISPLAY_TEXT_ALIGNMENT, getAction().getDisplayTextAlignment());
content.put(ActionDataFormats.DISPLAY_TEXT_SHOW, getAction().isShowDisplayText());
content.put(ActionDataFormats.DISPLAY_TEXT_SHOW, getAction().isShowDisplayText());
content.put(ActionDataFormats.IS_NEW, false);
content.put(ActionDataFormats.IS_NEW, false);
content.put(ActionDataFormats.ACTION_TYPE, getAction().getActionType());
content.put(ActionDataFormats.ACTION_TYPE, getAction().getActionType());
content.put(ActionDataFormats.MODULE_NAME, getAction().getModuleName());
content.put(ActionDataFormats.MODULE_NAME, getAction().getModuleName());
db.setContent(content);
db.setContent(content);
mouseEvent.consume();
mouseEvent.consume();
}
}
}
}
});
});
setOnMouseClicked(mouseEvent -> {
setOnMouseClicked(mouseEvent -> {
if(action != null)
if(action != null)
{
{
if(mouseEvent.getClickCount() == 2 && getAction().getActionType() == ActionType.FOLDER)
if(mouseEvent.getClickCount() == 2 && getAction().getActionType() == ActionType.FOLDER)
{
{
getActionDetailsPaneListener().onOpenFolderButtonClicked();
getActionDetailsPaneListener().onOpenFolderButtonClicked();
}
}
else
else
{
{
try
try
{
{
actionDetailsPaneListener.onActionClicked(action, this);
actionDetailsPaneListener.onActionClicked(action, this);
if(mouseEvent.getButton().equals(MouseButton.SECONDARY))
if(mouseEvent.getButton().equals(MouseButton.SECONDARY))
{
{
actionContextMenu.show(this, mouseEvent.getScreenX(),
actionContextMenu.show(this, mouseEvent.getScreenX(),
mouseEvent.getScreenY());
mouseEvent.getScreenY());
}
}
}
}
catch (MinorException e)
catch (MinorException e)
{
{
exceptionAndAlertHandler.handleMinorException(e);
exceptionAndAlertHandler.handleMinorException(e);
e.printStackTrace();
e.printStackTrace();
}
}
}
}
}
}
});
});
actionContextMenu = new ContextMenu();
actionContextMenu = new ContextMenu();
MenuItem deleteActionMenuItem = new MenuItem("Delete Action");
MenuItem deleteActionMenuItem = new MenuItem("Delete Action");
deleteActionMenuItem.getStyleClass().add("action_box_delete_menu_item");
deleteActionMenuItem.getStyleClass().add("action_box_delete_menu_item");
FontIcon deleteIcon = new FontIcon("fas-trash");
FontIcon deleteIcon = new FontIcon("fas-trash");
deleteIcon.getStyleClass().add("action_box_delete_menu_item_icon");
deleteIcon.getStyleClass().add("action_box_delete_menu_item_icon");
deleteActionMenuItem.setGraphic(deleteIcon);
deleteActionMenuItem.setGraphic(deleteIcon);
deleteActionMenuItem.setOnAction(event-> deleteAction());
deleteActionMenuItem.setOnAction(event-> deleteAction());
showToggleOffMenuItem = new MenuItem("Show Toggle OFF");
showToggleOffMenuItem = new MenuItem("Show Toggle OFF");
showToggleOffMenuItem.getStyleClass().add("action_box_toggle_on_menu_item");
showToggleOffMenuItem.getStyleClass().add("action_box_toggle_on_menu_item");
FontIcon toggleOffIcon = new FontIcon("fas-toggle-on");
FontIcon toggleOffIcon = new FontIcon("fas-toggle-on");
toggleOffIcon.getStyleClass().add("action_box_toggle_on_menu_item_icon");
toggleOffIcon.getStyleClass().add("action_box_toggle_on_menu_item_icon");
showToggleOffMenuItem.setGraphic(toggleOffIcon);
showToggleOffMenuItem.setGraphic(toggleOffIcon);
showToggleOffMenuItem.setOnAction(event-> fakeToggle(false));
showToggleOffMenuItem.setOnAction(event-> fakeToggle(false));
showToggleOnMenuItem = new MenuItem("Show Toggle OFF");
showToggleOnMenuItem = new MenuItem("Show Toggle OFF");
showToggleOnMenuItem.getStyleClass().add("action_box_toggle_off_menu_item");
showToggleOnMenuItem.getStyleClass().add("action_box_toggle_off_menu_item");
FontIcon toggleOnIcon = new FontIcon("fas-toggle-off");
FontIcon toggleOnIcon = new FontIcon("fas-toggle-off");
toggleOnIcon.getStyleClass().add("action_box_toggle_off_menu_item_icon");
toggleOnIcon.getStyleClass().add("action_box_toggle_off_menu_item_icon");
showToggleOnMenuItem.setGraphic(toggleOnIcon);
showToggleOnMenuItem.setGraphic(toggleOnIcon);
showToggleOnMenuItem.setOnAction(event-> fakeToggle(true));
showToggleOnMenuItem.setOnAction(event-> fakeToggle(true));
actionContextMenu.getItems().addAll(deleteActionMenuItem, showToggleOffMenuItem, showToggleOnMenuItem);
actionContextMenu.getItems().addAll(deleteActionMenuItem, showToggleOffMenuItem, showToggleOnMenuItem);
setCache(true);
setCache(true);
setCacheHint(CacheHint.QUALITY);
setCacheHint(CacheHint.QUALITY);
}
}
private MenuItem showToggleOffMenuItem;
private MenuItem showToggleOffMenuItem;
private MenuItem showToggleOnMenuItem;
private MenuItem showToggleOnMenuItem;
private void deleteAction()
private void deleteAction()
{
{
actionDetailsPaneListener.onDeleteButtonClicked();
actionDetailsPaneListener.onDeleteButtonClicked();
}
}
ContextMenu actionContextMenu;
ContextMenu actionContextMenu;
public void setInvalid(boolean invalid)
public void setInvalid(boolean invalid)
{
{
if(invalid)
if(invalid)
{
{
getStyleClass().remove("action_box_valid");
getStyleClass().remove("action_box_valid");
getStyleClass().add("action_box_invalid");
getStyleClass().add("action_box_invalid");
}
}
else
else
{
{
getStyleClass().remove("action_box_invalid");
getStyleClass().remove("action_box_invalid");
getStyleClass().add("action_box_valid");
getStyleClass().add("action_box_valid");
}
}
}
}
public ActionDetailsPaneListener getActionDetailsPaneListener() {
public ActionDetailsPaneListener getActionDetailsPaneListener() {
return actionDetailsPaneListener;
return actionDetailsPaneListener;
}
}
public ActionGridPaneListener getActionGridPaneListener() {
public ActionGridPaneListener getActionGridPaneListener() {
return actionGridPaneListener;
return actionGridPaneListener;
}
}
private int size;
private int size;
private ActionGridPaneListener actionGridPaneListener;
private ActionGridPaneListener actionGridPaneListener;
public ActionBox(int size, ActionDetailsPaneListener actionDetailsPaneListener, ActionGridPaneListener actionGridPaneListener,
public ActionBox(int size, ActionDetailsPaneListener actionDetailsPaneListener, ActionGridPaneListener actionGridPaneListener,
int col, int row)
int col, int row)
{
{
this.actionGridPaneListener = actionGridPaneListener;
this.actionGridPaneListener = actionGridPaneListener;
this.actionDetailsPaneListener = actionDetailsPaneListener;
this.actionDetailsPaneListener = actionDetailsPaneListener;
this.size = size;
this.size = size;
this.col = col;
this.col = col;
this.row = row;
this.row = row;
baseInit();
baseInit();
}
}
public void setIcon(byte[] iconByteArray)
public void setIcon(byte[] iconByteArray)
{
{
removeFontIcon();
removeFontIcon();
if(iconByteArray == null)
if(iconByteArray == null)
{
{
getStyleClass().remove("action_box_icon_present");
getStyleClass().remove("action_box_icon_present");
getStyleClass().add("action_box_icon_not_present");
getStyleClass().add("action_box_icon_not_present");
setBackground(null);
setBackground(null);
}
}
else
else
{
{
getStyleClass().add("action_box_icon_present");
getStyleClass().add("action_box_icon_present");
getStyleClass().remove("action_box_icon_not_present");
getStyleClass().remove("action_box_icon_not_present");
setBackground(
setBackground(
new Background(
new Background(
new BackgroundImage(new Image(
new BackgroundImage(new Image(
new ByteArrayInputStream(iconByteArray), size, size, false, true
new ByteArrayInputStream(iconByteArray), size, size, false, true
), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER,
new BackgroundSize(100, 100, true, true, true, false))
new BackgroundSize(100, 100, true, true, true, false))
)
)
);
);
}
}
}
}
public void setDefaultToggleIcon(boolean isToggleOn)
public void setDefaultToggleIcon(boolean isToggleOn)
{
{
String styleClass;
String styleClass;
if(isToggleOn)
if(isToggleOn)
{
{
styleClass = "action_box_toggle_on";
styleClass = "action_box_toggle_on";
}
}
else
else
{
{
styleClass = "action_box_toggle_off";
styleClass = "action_box_toggle_off";
}
}
setBackground(null);
setBackground(null);
if(fontIcon!=null)
if(fontIcon!=null)
{
{
fontIcon.getStyleClass().clear();
fontIcon.getStyleClass().removeIf(s -> s.equals("action_box_toggle_off") || s.equals("action_box_toggle_on"));
}
}
else
else
{
{
fontIcon = new FontIcon();
fontIcon = new FontIcon();
fontIcon.setIconSize((int) (size * 0.8));
fontIcon.setIconSize((int) (size * 0.8));
getChildren().add(fontIcon);
getChildren().add(fontIcon);
}
}
fontIcon.getStyleClass().add(styleClass);
fontIcon.getStyleClass().add(styleClass);
fontIcon.toBack();
fontIcon.toBack();
}
}
public void removeFontIcon()
public void removeFontIcon()
{
{
if(fontIcon!=null)
if(fontIcon!=null)
{
{
getChildren().remove(fontIcon);
getChildren().remove(fontIcon);
fontIcon = null;
fontIcon = null;
}
}
}
}
FontIcon fontIcon = null;
FontIcon fontIcon = null;
private Action action = null;
private Action action = null;
private ExceptionAndAlertHandler exceptionAndAlertHandler;
private ExceptionAndAlertHandler exceptionAndAlertHandler;
public ActionBox(int size, Action action, ActionDetailsPaneListener actionDetailsPaneListener, ExceptionAndAlertHandler exceptionAndAlertHandler, ActionGridPaneListener actionGridPaneListener,
public ActionBox(int size, Action action, ActionDetailsPaneListener actionDetailsPaneListener, ExceptionAndAlertHandler exceptionAndAlertHandler, ActionGridPaneListener actionGridPaneListener,
int col, int row)
int col, int row)
{
{
this.actionGridPaneListener = actionGridPaneListener;
this.actionGridPaneListener = actionGridPaneListener;
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
this.exceptionAndAlertHandler = exceptionAndAlertHandler;
this.action = action;
this.action = action;
this.actionDetailsPaneListener = actionDetailsPaneListener;
this.actionDetailsPaneListener = actionDetailsPaneListener;
this.size = size;
this.size = size;
this.col = col;
this.col = col;
this.row = row;
this.row = row;
baseInit();
baseInit();
init();
init();
}
}
public Action getAction() {
public Action getAction() {
return action;
return action;
}
}
public void setAction(Action action)
public void setAction(Action action)
{
{
this.action = action;
this.action = action;
}
}
public void init()
public void init()
{
{
init(false);
init(false);
}
}
public void init(boolean start)
public void init(boolean start)
{
{
setBackground(null);
setBackground(null);
setStyle(null);
setStyle(null);
showToggleOffMenuItem.setVisible(getAction().getActionType() == ActionType.TOGGLE);
showToggleOffMenuItem.setVisible(getAction().getActionType() == ActionType.TOGGLE);
showToggleOnMenuItem.setVisible(getAction().getActionType() == ActionType.TOGGLE);
showToggleOnMenuItem.setVisible(getAction().getActionType() == ActionType.TOGGLE);
if(getAction().isShowDisplayText())
if(getAction().isShowDisplayText())
setDisplayTextLabel(getAction().getDisplayText());
setDisplayTextLabel(getAction().getDisplayText());
else
else
setDisplayTextLabel("");
setDisplayTextLabel("");
setDisplayTextAlignment(action.getDisplayTextAlignment());
setDisplayTextAlignment(action.getDisplayTextAlignment());
setBackgroundColour(action.getBgColourHex());
setBackgroundColour(action.getBgColourHex());
setDisplayTextFontColour(action.getDisplayTextFontColourHex());
setDisplayTextFontColour(action.getDisplayTextFontColourHex());
setInvalid(action.isInvalid());
setInvalid(action.isInvalid());
Platform.runLater(()->{
Platform.runLater(()->{
try {
try {
if(action.getActionType() == ActionType.TOGGLE)
if(action.getActionType() == ActionType.TOGGLE)
{
{
fakeToggle(start);
fakeToggle(start);
}
}
else
else
{
{
if(action.isHasIcon())
if(action.isHasIcon())
{
{
if(!action.getCurrentIconState().isBlank())
if(!action.getCurrentIconState().isBlank())
{
{
setIcon(action.getCurrentIcon());
setIcon(action.getCurrentIcon());
}
}
}
}
else
else
{
{
setIcon(null);
setIcon(null);
}
}
}
}
}
}
catch (Exception e)
catch (Exception e)
{
{
e.printStackTrace();
e.printStackTrace();
}
}
});
});
}
}
public void fakeToggle(boolean isON)
public void fakeToggle(boolean isON)
{
{
String[] toggleStatesHiddenStatus = action.getCurrentIconState().split("__");
String[] toggleStatesHiddenStatus = action.getCurrentIconState().split("__");
boolean isToggleOffHidden = toggleStatesHiddenStatus[0].equals("true");
boolean isToggleOffHidden = toggleStatesHiddenStatus[0].equals("true");
boolean isToggleOnHidden = toggleStatesHiddenStatus[1].equals("true");
boolean isToggleOnHidden = toggleStatesHiddenStatus[1].equals("true");
if(isON) // ON
if(isON) // ON
{
{
if(action.isHasIcon())
if(action.isHasIcon())
{
{
boolean isToggleOnPresent = action.getIcons().containsKey("toggle_on");
boolean isToggleOnPresent = action.getIcons().containsKey("toggle_on");
if(isToggleOnPresent)
if(isToggleOnPresent)
{
{
if(isToggleOnHidden)
if(isToggleOnHidden)
{
{
setDefaultToggleIcon(true);
setDefaultToggleIcon(true);
}
}
else
else
{
{
setIcon(action.getIcons().get("toggle_on"));
setIcon(action.getIcons().get("toggle_on"));
}
}
}
}
else
else
{
{
setDefaultToggleIcon(true);
setDefaultToggleIcon(true);
}
}
}
}
else
else
{
{
setDefaultToggleIcon(true);
setDefaultToggleIcon(true);
}
}
}
}
else // OFF
else // OFF
{
{
if(action.isHasIcon())
if(action.isHasIcon())
{
{
boolean isToggleOffPresent = action.getIcons().containsKey("toggle_off");
boolean isToggleOffPresent = action.getIcons().containsKey("toggle_off");
if(isToggleOffPresent)
if(isToggleOffPresent)
{
{
if(isToggleOffHidden)
if(isToggleOffHidden)
{
{
setDefaultToggleIcon(false);
setDefaultToggleIcon(false);
}
}
else
else
{
{
setIcon(action.getIcons().get("toggle_off"));
setIcon(action.getIcons().get("toggle_off"));
}
}
}
}
else
else
{
{
setDefaultToggleIcon(false);
setDefaultToggleIcon(false);
}
}
}
}
else
else
{
{
setDefaultToggleIcon(false);
setDefaultToggleIcon(false);
}
}
}
}
}
}
public void setDisplayTextLabel(String text)
public void setDisplayTextLabel(String text)
{
{
displayTextLabel.setText(text);
displayTextLabel.setText(text);
}
}
public void setDisplayTextAlignment(DisplayTextAlignment displayTextAlignment)
public void setDisplayTextAlignment(DisplayTextAlignment displayTextAlignment)
{
{
if(displayTextAlignment == DisplayTextAlignment.CENTER)
if(displayTextAlignment == DisplayTextAlignment.CENTER)
displayTextLabel.setAlignment(Pos.CENTER);
displayTextLabel.setAlignment(Pos.CENTER);
else if (displayTextAlignment == DisplayTextAlignment.BOTTOM)
else if (displayTextAlignment == DisplayTextAlignment.BOTTOM)
displayTextLabel.setAlignment(Pos.BOTTOM_CENTER);
displayTextLabel.setAlignment(Pos.BOTTOM_CENTER);
else if (displayTextAlignment == DisplayTextAlignment.TOP)
else if (displayTextAlignment == DisplayTextAlignment.TOP)
displayTextLabel.setAlignment(Pos.TOP_CENTER);
displayTextLabel.setAlignment(Pos.TOP_CENTER);
}
}
public void setDisplayTextFontColour(String colour)
public void setDisplayTextFontColour(String colour)
{
{
if(!colour.isEmpty())
if(!colour.isEmpty())
displayTextLabel.setStyle("-fx-text-fill : "+colour+";");
displayTextLabel.setStyle("-fx-text-fill : "+colour+";");
}
}
public void setBackgroundColour(String colour)
public void setBackgroundColour(String colour)
{
{
if(!colour.isEmpty())
if(!colour.isEmpty())
setStyle("-fx-background-color : "+colour);
setStyle("-fx-background-color : "+colour);
}
}
public void setSelected(boolean status)
public void setSelected(boolean status)
{
{
if(status)
if(status)
{
{
getStyleClass().add("action_box_selected");
getStyleClass().add("action_box_selected");
}
}
else
else
{
{
getStyleClass().remove("action_box_selected");
getStyleClass().remove("action_box_selected");
}
}
}
}
}
}
PKYRC
PKYRC
config.xmluSn +,8&=Wjb v0Xmcڜ<zcހd9/ g6Nj۝?/ͳ8ιu#`CA!UP[+=zٳ`pg|;B rr bᚱ6A "
config.xmluSn +,8&=Wjb v0Xmcڜ<zcހd9/ g6Nj۝?/ͳ8ιu#`CA!UP[+=zٳ`pg|;B rr bᚱ6A "
tC07/W[Ky|rE!0꼖7$/ a8U+܉W gob֌+tjGcДaZARb4a>j+}%iҩ\1un2];&ʣbͨ6rRuu8tWWWF-:Rȉ6{z8;i;Гt$uͰN |v|9y+LP@ނ3VEo"K Z܌~WpyH>"*1޸[1CPKꜟQPlugins/PKꜟQT[mPlugins/config.xml]= @S4
tC07/W[Ky|rE!0꼖7$/ a8U+܉W gob֌+tjGcДaZARb4a>j+}%iҩ\1un2];&ʣbͨ6rRuu8tWWWF-:Rȉ6{z8;i;Гt$uͰN |v|9y+LP@ނ3VEo"K Z܌~WpyH>"*1޸[1CPKꜟQPlugins/PKꜟQT[mPlugins/config.xml]= @S4
n@@ xNrV7c+k`pz@jSȂ&+$SMWdˬTQnPKPRThemes/PKDR!Themes/com.stream_pi.defaultdark/PKeR%Themes/com.stream_pi.defaultdark/res/PKeRM
n@@ xNrV7c+k`pz@jSȂ&+$SMWdˬTQnPKPRThemes/PKDR!Themes/com.stream_pi.defaultdark/PKeR%Themes/com.stream_pi.defaultdark/res/PKeRM
.Themes/com.stream_pi.defaultdark/res/style.cssVm0)wU$[u?&`1T޽H#u)͌M'I$662|8M-=\VIQWh֜sW9J5@W׫j#YrìJV ="UOT
.Themes/com.stream_pi.defaultdark/res/style.cssVm0)wU$[u?&`1T޽H#u)͌M'I$662|8M-=\VIQWh֜sW9J5@W׫j#YrìJV ="UOT
U֫5L%֔Y~՞h8G }qݍm;'1A,˰\=1ԛɴ!n~&pmu$e_B+MY&) [LюthÄS&UҳE\C7qY4OH+k72
U֫5L%֔Y~՞h8G }qݍm;'1A,˰\=1ԛɴ!n~&pmu$e_B+MY&) [LюthÄS&UҳE\C7qY4OH+k72
/1BXct0=+nJw"ͻKnlq gYVfG@>kwΩ,)gƢ͉y75p<|=CѾPq ~Qҥ;َxվQ.V!cPZ5)6nSu'l5lZ3@n\-gR\4A)t;gc &99sbWlhpb @3PKDR}*Themes/com.stream_pi.defaultdark/theme.xmlmP0 R8`Rʅ'~AikbXC3١S JQ'Ym.ge#N#TVJ6};jn Fis^qBvlGtJ[,VB% hδBM%?)( O2iX`ȼƕ1,LhE^wd] PKͺDR)Themes/com.stream_pi.defaulthighcontrast/PKeR-Themes/com.stream_pi.defaulthighcontrast/res/PKeRzLqg 6Themes/com.stream_pi.defaulthighcontrast/res/style.cssUK0 .`ƹB qQ$C'{0`|#:
/1BXct0=+nJw"ͻKnlq gYVfG@>kwΩ,)gƢ͉y75p<|=CѾPq ~Qҥ;َxվQ.V!cPZ5)6nSu'l5lZ3@n\-gR\4A)t;gc &99sbWlhpb @3PKDR}*Themes/com.stream_pi.defaultdark/theme.xmlmP0 R8`Rʅ'~AikbXC3١S JQ'Ym.ge#N#TVJ6};jn Fis^qBvlGtJ[,VB% hδBM%?)( O2iX`ȼƕ1,LhE^wd] PKͺDR)Themes/com.stream_pi.defaulthighcontrast/PKeR-Themes/com.stream_pi.defaulthighcontrast/res/PKeRzLqg 6Themes/com.stream_pi.defaulthighcontrast/res/style.cssUK0 .`ƹB qQ$C'{0`|#:
Y[Xɤܟ{v1Ż:kɆACX3ʻp<bm pPhix4 Irh#$4hf휓{L#I5ghR
Y[Xɤܟ{v1Ż:kɆACX3ʻp<bm pPhix4 Irh#$4hf휓{L#I5ghR
P=W㋨M;kZS[T_{0O/cpmʸuܨ2x
P=W㋨M;kZS[T_{0O/cpmʸuܨ2x
VP\8ͩ$x
VP\8ͩ$x
}hۆ|E
}hۆ|E
w
w
FDXP ,{fJA N^O:ր3sxA:6 Ry-(3ŧOڇ]Y 3E5qULx+Yb};-OBYǰ'ǵu}ξOoF\;V5F#S[L76~̚!m'E|YPuN[2K--9n,.T;ϏJO$wj Xq#ựPKͺDRGzK2Themes/com.stream_pi.defaulthighcontrast/theme.xmlmP10 ܑC 40 L h~O7ߝO瓫[]+:Y&t04=iS,aقORÁ̬u8  #ʭykW:ݶE^/#nFV%[[C<y,E'ϡ+gG<IbW~*)@񓽌tЗ?/zZ{):&^moEPKDR"Themes/com.stream_pi.defaultlight/PKeR&Themes/com.stream_pi.defaultlight/res/PKBeR`8'J
FDXP ,{fJA N^O:ր3sxA:6 Ry-(3ŧOڇ]Y 3E5qULx+Yb};-OBYǰ'ǵu}ξOoF\;V5F#S[L76~̚!m'E|YPuN[2K--9n,.T;ϏJO$wj Xq#ựPKͺDRGzK2Themes/com.stream_pi.defaulthighcontrast/theme.xmlmP10 ܑC 40 L h~O7ߝO瓫[]+:Y&t04=iS,aقORÁ̬u8  #ʭykW:ݶE^/#nFV%[[C<y,E'ϡ+gG<IbW~*)@񓽌tЗ?/zZ{):&^moEPKDR"Themes/com.stream_pi.defaultlight/PKeR&Themes/com.stream_pi.defaultlight/res/PKBeR`8'J
/Themes/com.stream_pi.defaultlight/res/style.cssVˊ0JҖ8eVWl1d$y2Z?"[ֽ:o73hro/&X3V_zhz4}xzWP<9W>_aɿNX.l60$ywb9(=vW4A5_ox^5Ԛ8k ̈́D'r@R*pk$-.ko}^vQX xDh<ܹ<Hth%)Tr-, JՅ.dy!H͘ 1!)J0ol[:Ҏ0/ƅ<XSϨ4&TO=J#]\Efni\x"U5J5kQf~K ױFvoR\*c9%ڵNFD8*K]! ٗ,bnbf.÷ rtrw]:&|Er_ޟhיc%v7& #TYZCA՟;]:L%_Ln4m tqp}1vR'iȗ{wJb19SdW(P*abk WPKDR|+Themes/com.stream_pi.defaultlight/theme.xmlmPA0{L0)ă/@hM1qo;3;?<:et%." S*]gzi?$"nxatJr?[̄waALȸXZv PɾErVuL=z\X-yJ~R-cp$Z¡kJXpl\9f&bkwl PK?YRC
/Themes/com.stream_pi.defaultlight/res/style.cssVˊ0JҖ8eVWl1d$y2Z?"[ֽ:o73hro/&X3V_zhz4}xzWP<9W>_aɿNX.l60$ywb9(=vW4A5_ox^5Ԛ8k ̈́D'r@R*pk$-.ko}^vQX xDh<ܹ<Hth%)Tr-, JՅ.dy!H͘ 1!)J0ol[:Ҏ0/ƅ<XSϨ4&TO=J#]\Efni\x"U5J5kQf~K ױFvoR\*c9%ڵNFD8*K]! ٗ,bnbf.÷ rtrw]:&|Er_ޟhיc%v7& #TYZCA՟;]:L%_Ln4m tqp}1vR'iȗ{wJb19SdW(P*abk WPKDR|+Themes/com.stream_pi.defaultlight/theme.xmlmPA0{L0)ă/@hM1qo;3;?<:et%." S*]gzi?$"nxatJr?[̄waALȸXZv PɾErVuL=z\X-yJ~R-cp$Z¡kJXpl\9f&bkwl PK?YRC
$ config.xml
$ config.xml
ovRS偌RSKSPK?ꜟQ$Plugins/
ovRS偌RSKSPK?ꜟQ$Plugins/
~PKSPKSPK?ꜟQT[m$Plugins/config.xml
~PKSPKSPK?ꜟQT[m$Plugins/config.xml
~KSPKSPK?PR$Themes/
~KSPKSPK?PR$Themes/
mKS]5KSPK?DR!$Themes/com.stream_pi.defaultdark/
mKS]5KSPK?DR!$Themes/com.stream_pi.defaultdark/
 KS~\KSPK?eR%$Themes/com.stream_pi.defaultdark/res/
 KS~\KSPK?eR%$Themes/com.stream_pi.defaultdark/res/
E%KS~\KSPK?eRM
E%KS~\KSPK?eRM
.$+Themes/com.stream_pi.defaultdark/res/style.css
.$+Themes/com.stream_pi.defaultdark/res/style.css
%KS%PK?DR}*$Themes/com.stream_pi.defaultdark/theme.xml
%KS%PK?DR}*$Themes/com.stream_pi.defaultdark/theme.xml
 ;KSKSPK?ͺDR)$Themes/com.stream_pi.defaulthighcontrast/
 ;KSKSPK?ͺDR)$Themes/com.stream_pi.defaulthighcontrast/
iuKSKSPK?eR-$Themes/com.stream_pi.defaulthighcontrast/res/
iuKSKSPK?eR-$Themes/com.stream_pi.defaulthighcontrast/res/
L%KSKSPK?eRzLqg 6$`Themes/com.stream_pi.defaulthighcontrast/res/style.css
L%KSKSPK?eRzLqg 6$`Themes/com.stream_pi.defaulthighcontrast/res/style.css
L%{KSKSPK?ͺDRGzK2$ Themes/com.stream_pi.defaulthighcontrast/theme.xml
L%{KSKSPK?ͺDRGzK2$ Themes/com.stream_pi.defaulthighcontrast/theme.xml
iuKSKSPK?DR"$
iuKSKSPK?DR"$
Themes/com.stream_pi.defaultlight/
Themes/com.stream_pi.defaultlight/
 nKSKSPK?eR&$ Themes/com.stream_pi.defaultlight/res/
 nKSKSPK?eR&$ Themes/com.stream_pi.defaultlight/res/
V%FKSFKSPK?BeR`8'J
V%FKSFKSPK?BeR`8'J
/$O Themes/com.stream_pi.defaultlight/res/style.css
/$O Themes/com.stream_pi.defaultlight/res/style.css
%fKS%PK?DR|+$ Themes/com.stream_pi.defaultlight/theme.xml
%fKS%PK?DR|+$ Themes/com.stream_pi.defaultlight/theme.xml
 KSnKSPKI
 KSnKSPKI