server
Clone or download
Modified Files
--- 'a/src/main/java/com/stream_pi/server/controller/Controller.java'
+++ b/src/main/java/com/stream_pi/server/controller/Controller.java
@@ -387,8 +387,7 @@ public class Controller extends Base imp
getLogger().log(Level.SEVERE, e.getShortMessage(), e);
e.printStackTrace();
-
- Platform.runLater(()-> new StreamPiAlert(e.getTitle(), e.getShortMessage(), StreamPiAlertType.WARNING).show());
+ new StreamPiAlert(e.getTitle(), e.getShortMessage(), StreamPiAlertType.WARNING).show();
}
@Override
@@ -397,21 +396,19 @@ public class Controller extends Base imp
getLogger().log(Level.SEVERE, e.getShortMessage(), e);
e.printStackTrace();
- Platform.runLater(()->{
- StreamPiAlert alert = new StreamPiAlert(e.getTitle(), e.getShortMessage(), StreamPiAlertType.ERROR);
+ StreamPiAlert alert = new StreamPiAlert(e.getTitle(), e.getShortMessage(), StreamPiAlertType.ERROR);
- alert.setOnClicked(new StreamPiAlertListener()
+ alert.setOnClicked(new StreamPiAlertListener()
+ {
+ @Override
+ public void onClick(String txt)
{
- @Override
- public void onClick(String txt)
- {
- onQuitApp();
- exit();
- }
- });
-
- alert.show();
+ onQuitApp();
+ exit();
+ }
});
+
+ alert.show();
}
private AudioClip audioClip = null;
@@ -424,15 +421,11 @@ public class Controller extends Base imp
return;
}
- if(!audioFilePath.equals(getConfig().getSoundOnActionClickedFilePath()))
- {
- initSoundOnActionClicked();
- }
-
Platform.runLater(audioClip::play);
}
- private void initSoundOnActionClicked()
+ @Override
+ public void initSoundOnActionClicked()
{
audioFilePath = getConfig().getSoundOnActionClickedFilePath();
@@ -443,7 +436,9 @@ public class Controller extends Base imp
audioFilePath = null;
audioClip = null;
getConfig().setSoundOnActionClickedStatus(false);
+ getConfig().setSoundOnActionClickedFilePath("");
handleMinorException(new MinorException("The sound file for on action click sound is missing."));
+ return;
}
audioClip = new AudioClip(file.toURI().toString());
--- 'a/src/main/java/com/stream_pi/server/controller/ServerListener.java'
+++ b/src/main/java/com/stream_pi/server/controller/ServerListener.java
@@ -31,4 +31,6 @@ public interface ServerListener
void initLogger() throws SevereException;
void factoryReset();
+
+ void initSoundOnActionClicked();
}
M
src/main/java/com/stream_pi/server/window/dashboard/actiondetailpane/ActionDetailsPane.java
+3
−11
--- 'a/src/main/java/com/stream_pi/server/window/dashboard/actiondetailpane/ActionDetailsPane.java'
+++ b/src/main/java/com/stream_pi/server/window/dashboard/actiondetailpane/ActionDetailsPane.java
@@ -871,19 +871,11 @@ public class ActionDetailsPane extends V
if(!eachProperty.isVisible())
continue;
-
- Label label = new Label(eachProperty.getDisplayName());
-
- Node controlNode = Helper.getControlNode(eachProperty);
-
- HBoxWithSpaceBetween hBoxWithSpaceBetween = new HBoxWithSpaceBetween(label, controlNode);
-
- UIPropertyBox clientProperty = new UIPropertyBox(i, eachProperty.getDisplayName(), controlNode,
+ Helper.ControlNodePair controlNodePair = new Helper().getControlNode(eachProperty);
+ UIPropertyBox clientProperty = new UIPropertyBox(i, eachProperty.getDisplayName(), controlNodePair.getControlNode(),
eachProperty.getControlType(), eachProperty.getType(), eachProperty.isCanBeBlank());
-
actionClientProperties.add(clientProperty);
-
- clientPropertiesVBox.getChildren().add(hBoxWithSpaceBetween);
+ clientPropertiesVBox.getChildren().add(controlNodePair.getUINode());
}
}
--- 'a/src/main/java/com/stream_pi/server/window/helper/Helper.java'
+++ b/src/main/java/com/stream_pi/server/window/helper/Helper.java
@@ -1,17 +1,45 @@
package com.stream_pi.server.window.helper;
import com.stream_pi.action_api.actionproperty.property.ControlType;
+import com.stream_pi.action_api.actionproperty.property.FileExtensionFilter;
import com.stream_pi.action_api.actionproperty.property.ListValue;
import com.stream_pi.action_api.actionproperty.property.Property;
import com.stream_pi.util.exception.MinorException;
+import com.stream_pi.util.uihelper.HBoxInputBoxWithFileChooser;
+import com.stream_pi.util.uihelper.HBoxWithSpaceBetween;
import javafx.scene.Node;
import javafx.scene.control.*;
+import javafx.stage.FileChooser;
import javafx.util.Callback;
public class Helper
{
- public static Node getControlNode(Property property) throws MinorException
+ public class ControlNodePair
{
+ private Node controlNode = null;
+ private Node UINode = null;
+
+ public ControlNodePair(Node controlNode, Node UINode)
+ {
+ this.controlNode = controlNode;
+ this.UINode = UINode;
+ }
+
+ public Node getUINode()
+ {
+ return UINode;
+ }
+
+ public Node getControlNode()
+ {
+ return controlNode;
+ }
+ }
+
+ public ControlNodePair getControlNode(Property property) throws MinorException
+ {
+ Node UINode = null, controlNode = null;
+
if(property.getControlType() == ControlType.COMBO_BOX)
{
ComboBox<ListValue> comboBox = new ComboBox<>();
@@ -20,7 +48,6 @@ public class Helper
Callback<ListView<ListValue>, ListCell<ListValue>> clientsComboBoxFactory = new Callback<>() {
@Override
public ListCell<ListValue> call(ListView<ListValue> clientConnectionListView) {
-
return new ListCell<>() {
@Override
protected void updateItem(ListValue listValue, boolean b)
@@ -43,18 +70,19 @@ public class Helper
comboBox.setButtonCell(clientsComboBoxFactory.call(null));
comboBox.getSelectionModel().select(property.getSelectedIndex());
- return comboBox;
+
+ controlNode = comboBox;
}
else if(property.getControlType() == ControlType.TEXT_FIELD)
{
- return new TextField(property.getRawValue());
+ controlNode = new TextField(property.getRawValue());
}
else if(property.getControlType() == ControlType.TEXT_FIELD_MASKED)
{
PasswordField textField = new PasswordField();
textField.setText(property.getRawValue());
- return textField;
+ controlNode = textField;
}
else if(property.getControlType() == ControlType.TOGGLE)
{
@@ -73,7 +101,7 @@ public class Helper
toggleButton.setText("OFF");
});
- return toggleButton;
+ controlNode = toggleButton;
}
else if(property.getControlType() == ControlType.SLIDER_DOUBLE)
{
@@ -82,7 +110,7 @@ public class Helper
slider.setMax(property.getMaxDoubleValue());
slider.setMin(property.getMinDoubleValue());
- return slider;
+ controlNode = slider;
}
else if(property.getControlType() == ControlType.SLIDER_INTEGER)
{
@@ -94,9 +122,34 @@ public class Helper
slider.setBlockIncrement(1.0);
slider.setSnapToTicks(true);
- return slider;
+ controlNode = slider;
+ }
+ else if(property.getControlType() == ControlType.FILE_PATH)
+ {
+ TextField textField = new TextField(property.getRawValue());
+
+ FileExtensionFilter[] fileExtensionFilters = property.getExtensionFilters();
+ FileChooser.ExtensionFilter[] extensionFilters = new FileChooser.ExtensionFilter[fileExtensionFilters.length];
+
+ for(int x = 0;x<fileExtensionFilters.length;x++)
+ {
+ extensionFilters[x] = new FileChooser.ExtensionFilter(
+ fileExtensionFilters[x].getDescription(),
+ fileExtensionFilters[x].getExtensions()
+ );
+ }
+
+ UINode = new HBoxInputBoxWithFileChooser(property.getDisplayName(), textField, null,
+ extensionFilters);
+
+ controlNode =textField;
+ }
+
+ if(property.getControlType() != ControlType.FILE_PATH)
+ {
+ UINode = new HBoxWithSpaceBetween(new Label(property.getDisplayName()), controlNode);
}
- return null;
+ return new ControlNodePair(controlNode, UINode);
}
}
--- 'a/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java'
+++ b/src/main/java/com/stream_pi/server/window/settings/GeneralSettings.java
@@ -382,7 +382,15 @@ public class GeneralSettings extends VBo
config.setShowAlertsPopup(showAlertsPopup);
config.setStartupOnBoot(startOnBoot);
+ if(soundOnActionClicked)
+ {
+ serverListener.initSoundOnActionClicked();
+ }
+
config.setSoundOnActionClickedStatus(soundOnActionClicked);
+
+
+
config.setSoundOnActionClickedFilePath(soundOnActionClickedFilePath);
config.save();
--- 'a/src/main/java/com/stream_pi/server/window/settings/PluginsSettings.java'
+++ b/src/main/java/com/stream_pi/server/window/settings/PluginsSettings.java
@@ -253,20 +253,10 @@ public class PluginsSettings extends VBo
if(!eachProperty.isVisible())
continue;
-
-
- Label label = new Label(eachProperty.getDisplayName());
-
- Node controlNode = Helper.getControlNode(eachProperty);
-
- HBoxWithSpaceBetween hBoxWithSpaceBetween = new HBoxWithSpaceBetween(label, controlNode);
-
- UIPropertyBox serverProperty = new UIPropertyBox(j, eachProperty.getDisplayName(), controlNode, eachProperty.getControlType(), eachProperty.getType(), eachProperty.isCanBeBlank());
-
+ Helper.ControlNodePair controlNodePair = new Helper().getControlNode(eachProperty);
+ UIPropertyBox serverProperty = new UIPropertyBox(j, eachProperty.getDisplayName(), controlNodePair.getControlNode(), eachProperty.getControlType(), eachProperty.getType(), eachProperty.isCanBeBlank());
serverPropertyArrayList.add(serverProperty);
-
- serverPropertiesVBox.getChildren().add(hBoxWithSpaceBetween);
-
+ serverPropertiesVBox.getChildren().add(controlNodePair.getUINode());
}
PluginProperties pp = new PluginProperties(i, serverPropertyArrayList, action.getName());