util

Clone or download

Modified Files

--- 'a/src/main/java/com/StreamPi/Util/FormHelper/HBoxInputBox.java'
+++ /dev/null
@@ -1,52 +0,0 @@
-package com.StreamPi.Util.FormHelper;
-
-import javafx.geometry.Insets;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextField;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.Region;
-
-public class HBoxInputBox extends HBox {
- private TextField textField;
- public HBoxInputBox(String labelText, TextField textField, int prefWidth, CheckBox enablerCheckBox)
- {
- textField.setPrefWidth(prefWidth);
-
- Label label = new Label(labelText);
-
-
- getChildren().addAll(label, new SpaceFiller(SpaceFiller.FillerType.HBox), textField);
-
- if(enablerCheckBox != null)
- {
- textField.disableProperty().bind(enablerCheckBox.selectedProperty());
- HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
- getChildren().add(enablerCheckBox);
- }
-
- this.textField = textField;
- }
-
- public HBoxInputBox(String labelText, TextField textField, CheckBox enablerCheckBox)
- {
- this(labelText, textField, 100, enablerCheckBox);
- }
-
- public HBoxInputBox(String labelText, TextField textField)
- {
- this(labelText, textField, 100, null);
- }
-
- public HBoxInputBox(String labelText, TextField textField, int prefWidth)
- {
- this(labelText, textField, prefWidth, null);
- }
-
-
- public TextField getTextField()
- {
- return textField;
- }
-}
--- 'a/src/main/java/com/StreamPi/Util/FormHelper/HBoxInputBoxWithFileChooser.java'
+++ /dev/null
@@ -1,60 +0,0 @@
-package com.StreamPi.Util.FormHelper;
-
-import javafx.geometry.Insets;
-import javafx.scene.control.Button;
-import javafx.scene.control.CheckBox;
-import javafx.scene.control.Label;
-import javafx.scene.control.TextField;
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.Region;
-import javafx.stage.FileChooser;
-import javafx.stage.Window;
-import org.kordamp.ikonli.javafx.FontIcon;
-
-import java.io.File;
-
-public class HBoxInputBoxWithFileChooser extends HBox {
- public HBoxInputBoxWithFileChooser(String labelText, TextField textField, CheckBox enablerCheckBox, FileChooser.ExtensionFilter extensionFilter)
- {
- textField.setDisable(true);
-
- HBoxInputBox hBoxInputBox = new HBoxInputBox(labelText, textField, 300);
- setHgrow(hBoxInputBox, Priority.ALWAYS);
- getChildren().addAll(hBoxInputBox);
- setSpacing(5.0);
-
- Button button = new Button();
- FontIcon fontIcon = new FontIcon("far-folder");
- //fontIcon.setIconColor(Paint.valueOf(iconColorHex));
- //fontIcon.setIconSize(iconSize);
- button.setGraphic(fontIcon);
-
- button.setOnAction(event -> {
- FileChooser fileChooser = new FileChooser();
-
- fileChooser.getExtensionFilters().addAll(
- extensionFilter
- );
-
-
- try {
- File selectedDirectory = fileChooser.showOpenDialog(button.getScene().getWindow());
- textField.setText(selectedDirectory.getAbsolutePath());
- }
- catch (NullPointerException e)
- {
- // No folder selected
- }
- });
-
- getChildren().add(button);
-
- if(enablerCheckBox!=null)
- {
- button.disableProperty().bind(enablerCheckBox.selectedProperty());
- HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
- getChildren().add(enablerCheckBox);
- }
- }
-}
--- 'a/src/main/java/com/StreamPi/Util/FormHelper/SpaceFiller.java'
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.StreamPi.Util.FormHelper;
-
-import javafx.scene.layout.HBox;
-import javafx.scene.layout.Priority;
-import javafx.scene.layout.Region;
-import javafx.scene.layout.VBox;
-
-public class SpaceFiller extends Region {
-
- public SpaceFiller(FillerType fillerType)
- {
- if(fillerType == FillerType.HBox)
- {
- HBox.setHgrow(this, Priority.ALWAYS);
- }
- else if(fillerType == FillerType.VBox)
- {
- VBox.setVgrow(this, Priority.ALWAYS);
- }
- }
-
- public enum FillerType
- {
- HBox, VBox
- }
-}
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/UIHelper/HBoxInputBox.java
@@ -0,0 +1,52 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.geometry.Insets;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+
+public class HBoxInputBox extends HBox {
+ private TextField textField;
+ public HBoxInputBox(String labelText, TextField textField, int prefWidth, CheckBox enablerCheckBox)
+ {
+ textField.setPrefWidth(prefWidth);
+
+ Label label = new Label(labelText);
+
+
+ getChildren().addAll(label, new SpaceFiller(SpaceFiller.FillerType.HBox), textField);
+
+ if(enablerCheckBox != null)
+ {
+ textField.disableProperty().bind(enablerCheckBox.selectedProperty());
+ HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
+ getChildren().add(enablerCheckBox);
+ }
+
+ this.textField = textField;
+ }
+
+ public HBoxInputBox(String labelText, TextField textField, CheckBox enablerCheckBox)
+ {
+ this(labelText, textField, 100, enablerCheckBox);
+ }
+
+ public HBoxInputBox(String labelText, TextField textField)
+ {
+ this(labelText, textField, 100, null);
+ }
+
+ public HBoxInputBox(String labelText, TextField textField, int prefWidth)
+ {
+ this(labelText, textField, prefWidth, null);
+ }
+
+
+ public TextField getTextField()
+ {
+ return textField;
+ }
+}
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/UIHelper/HBoxInputBoxWithFileChooser.java
@@ -0,0 +1,60 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.geometry.Insets;
+import javafx.scene.control.Button;
+import javafx.scene.control.CheckBox;
+import javafx.scene.control.Label;
+import javafx.scene.control.TextField;
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+import javafx.stage.FileChooser;
+import javafx.stage.Window;
+import org.kordamp.ikonli.javafx.FontIcon;
+
+import java.io.File;
+
+public class HBoxInputBoxWithFileChooser extends HBox {
+ public HBoxInputBoxWithFileChooser(String labelText, TextField textField, CheckBox enablerCheckBox, FileChooser.ExtensionFilter extensionFilter)
+ {
+ textField.setDisable(true);
+
+ HBoxInputBox hBoxInputBox = new HBoxInputBox(labelText, textField, 300);
+ setHgrow(hBoxInputBox, Priority.ALWAYS);
+ getChildren().addAll(hBoxInputBox);
+ setSpacing(5.0);
+
+ Button button = new Button();
+ FontIcon fontIcon = new FontIcon("far-folder");
+ //fontIcon.setIconColor(Paint.valueOf(iconColorHex));
+ //fontIcon.setIconSize(iconSize);
+ button.setGraphic(fontIcon);
+
+ button.setOnAction(event -> {
+ FileChooser fileChooser = new FileChooser();
+
+ fileChooser.getExtensionFilters().addAll(
+ extensionFilter
+ );
+
+
+ try {
+ File selectedDirectory = fileChooser.showOpenDialog(button.getScene().getWindow());
+ textField.setText(selectedDirectory.getAbsolutePath());
+ }
+ catch (NullPointerException e)
+ {
+ // No folder selected
+ }
+ });
+
+ getChildren().add(button);
+
+ if(enablerCheckBox!=null)
+ {
+ button.disableProperty().bind(enablerCheckBox.selectedProperty());
+ HBox.setMargin(enablerCheckBox, new Insets(0, 0, 0, 45));
+ getChildren().add(enablerCheckBox);
+ }
+ }
+}
--- /dev/null
+++ b/src/main/java/com/StreamPi/Util/UIHelper/SpaceFiller.java
@@ -0,0 +1,26 @@
+package com.StreamPi.Util.FormHelper;
+
+import javafx.scene.layout.HBox;
+import javafx.scene.layout.Priority;
+import javafx.scene.layout.Region;
+import javafx.scene.layout.VBox;
+
+public class SpaceFiller extends Region {
+
+ public SpaceFiller(FillerType fillerType)
+ {
+ if(fillerType == FillerType.HBox)
+ {
+ HBox.setHgrow(this, Priority.ALWAYS);
+ }
+ else if(fillerType == FillerType.VBox)
+ {
+ VBox.setVgrow(this, Priority.ALWAYS);
+ }
+ }
+
+ public enum FillerType
+ {
+ HBox, VBox
+ }
+}