server
Clone or download
Modified Files
package com.stream_pi.server.uipropertybox;
package com.stream_pi.server.uipropertybox;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.ControlType;
import com.stream_pi.action_api.actionproperty.property.Type;
import com.stream_pi.action_api.actionproperty.property.Type;
import java.util.List;
import java.util.List;
import javafx.scene.Node;
import javafx.scene.Node;
import javafx.scene.control.ComboBox;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Slider;
import javafx.scene.control.Slider;
import javafx.scene.control.TextField;
import javafx.scene.control.TextField;
import org.controlsfx.control.ToggleSwitch;
import org.controlsfx.control.ToggleSwitch;
public class UIPropertyBox
public class UIPropertyBox
{
{
private Node controlNode;
private Node controlNode;
private boolean canBeBlank;
private boolean canBeBlank;
private String displayName;
private String displayName;
public String getDisplayName() {
public String getDisplayName() {
return displayName;
return displayName;
}
}
public boolean isCanBeBlank() {
public boolean isCanBeBlank() {
return canBeBlank;
return canBeBlank;
}
}
private int index;
private int index;
private ControlType controlType;
private ControlType controlType;
private Type type;
private Type type;
public UIPropertyBox(int index, String displayName, Node controlNode, ControlType controlType, Type type, boolean canBeBlank)
public UIPropertyBox(int index, String displayName, Node controlNode, ControlType controlType, Type type, boolean canBeBlank)
{
{
this.index = index;
this.index = index;
this.displayName = displayName;
this.displayName = displayName;
this.controlNode = controlNode;
this.controlNode = controlNode;
this.controlType = controlType;
this.controlType = controlType;
this.type = type;
this.type = type;
this.canBeBlank = canBeBlank;
this.canBeBlank = canBeBlank;
}
}
public ControlType getControlType()
public ControlType getControlType()
{
{
return controlType;
return controlType;
}
}
public Node getControlNode()
public Node getControlNode()
{
{
return controlNode;
return controlNode;
}
}
public int getIndex() {
public int getIndex() {
return index;
return index;
}
}
public Type getType()
public Type getType()
{
{
return type;
return type;
}
}
public String getRawValue()
public String getRawValue()
{
{
String rawValue = null;
String rawValue = null;
if (List.of(ControlType.TEXT_FIELD, ControlType.TEXT_FIELD_MASKED, ControlType.FILE_PATH)
if (List.of(ControlType.TEXT_FIELD, ControlType.TEXT_FIELD_MASKED, ControlType.FILE_PATH)
.contains(controlType))
.contains(controlType))
rawValue = ((TextField) controlNode).getText();
rawValue = ((TextField) controlNode).getText();
else if (controlType == ControlType.COMBO_BOX)
else if (controlType == ControlType.COMBO_BOX)
rawValue = ((ComboBox<String>) controlNode).getSelectionModel().getSelectedIndex() + "";
rawValue = ((ComboBox<String>) controlNode).getSelectionModel().getSelectedIndex() + "";
else if (controlType == ControlType.SLIDER_DOUBLE)
else if (controlType == ControlType.SLIDER_DOUBLE)
rawValue = ((Slider) controlNode).getValue() + "";
rawValue = ((Slider) controlNode).getValue() + "";
else if (controlType == ControlType.SLIDER_INTEGER)
else if (controlType == ControlType.SLIDER_INTEGER)
rawValue = Math.round(((Slider) controlNode).getValue()) + "";
rawValue = Math.round(((Slider) controlNode).getValue()) + "";
else if (controlType == ControlType.TOGGLE) {
else if (controlType == ControlType.TOGGLE) {
ToggleSwitch toggleSwitch = ((ToggleSwitch) controlNode);
ToggleSwitch toggleSwitch = ((ToggleSwitch) controlNode);
if (toggleButton.isSelected())
if (toggleSwitch.isSelected())
rawValue = "true";
rawValue = "true";
else
else
rawValue = "false";
rawValue = "false";
}
}
return rawValue;
return rawValue;
}
}
}
}