Added option to delete StringKV and FileKV fields from respective lists
This commit is contained in:
parent
91f5ab9326
commit
9eb149492d
10 changed files with 63 additions and 15 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,5 +6,4 @@ classes/
|
|||
src/main/java/META-INF/
|
||||
dependency-reduced-pom.xml
|
||||
history.sqlite
|
||||
themes/
|
||||
/config/restaurant.state
|
||||
|
|
|
@ -380,6 +380,10 @@ public class DashboardController implements Initializable {
|
|||
controller.setKeyField(key);
|
||||
controller.setValueField(value);
|
||||
paramsControllers.add(controller);
|
||||
controller.deleteButton.setOnAction(e -> {
|
||||
paramsBox.getChildren().remove(headerField);
|
||||
paramsControllers.remove(controller);
|
||||
});
|
||||
paramsBox.getChildren().add(headerField);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.rohitawate.restaurant.homewindow;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXCheckBox;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
|
@ -33,6 +34,8 @@ public class FileKeyValueFieldController implements Initializable {
|
|||
private TextField fileKeyField, fileValueField;
|
||||
@FXML
|
||||
private JFXCheckBox checkBox;
|
||||
@FXML
|
||||
protected JFXButton deleteButton;
|
||||
|
||||
/*
|
||||
Set to true when user manually un-checks the field
|
||||
|
|
|
@ -32,7 +32,7 @@ import java.util.ResourceBundle;
|
|||
|
||||
public class FormDataTabController implements Initializable {
|
||||
@FXML
|
||||
private VBox headersBox;
|
||||
private VBox fieldsBox;
|
||||
|
||||
private List<StringKeyValueFieldController> stringControllers;
|
||||
private List<FileKeyValueFieldController> fileControllers;
|
||||
|
@ -69,13 +69,17 @@ public class FormDataTabController implements Initializable {
|
|||
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/FileKeyValueField.fxml"));
|
||||
Parent headerField = loader.load();
|
||||
ThemeManager.setTheme(headerField);
|
||||
Parent fileField = loader.load();
|
||||
ThemeManager.setTheme(fileField);
|
||||
FileKeyValueFieldController controller = loader.getController();
|
||||
controller.setFileKeyField(key);
|
||||
controller.setFileValueField(value);
|
||||
controller.deleteButton.setOnAction(e -> {
|
||||
fieldsBox.getChildren().remove(fileField);
|
||||
fileControllers.remove(controller);
|
||||
});
|
||||
fileControllers.add(controller);
|
||||
headersBox.getChildren().add(headerField);
|
||||
fieldsBox.getChildren().add(fileField);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -104,12 +108,16 @@ public class FormDataTabController implements Initializable {
|
|||
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml"));
|
||||
Parent headerField = loader.load();
|
||||
Parent stringField = loader.load();
|
||||
StringKeyValueFieldController controller = loader.getController();
|
||||
controller.setKeyField(key);
|
||||
controller.setValueField(value);
|
||||
stringControllers.add(controller);
|
||||
headersBox.getChildren().add(headerField);
|
||||
controller.deleteButton.setOnAction(e -> {
|
||||
fieldsBox.getChildren().remove(stringField);
|
||||
stringControllers.remove(controller);
|
||||
});
|
||||
fieldsBox.getChildren().add(stringField);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -67,6 +67,10 @@ public class HeaderTabController implements Initializable {
|
|||
controller.setKeyField(key);
|
||||
controller.setValueField(value);
|
||||
controllers.add(controller);
|
||||
controller.deleteButton.setOnAction(e -> {
|
||||
headersBox.getChildren().remove(headerField);
|
||||
controllers.remove(controller);
|
||||
});
|
||||
headersBox.getChildren().add(headerField);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
package com.rohitawate.restaurant.homewindow;
|
||||
|
||||
import com.jfoenix.controls.JFXButton;
|
||||
import com.jfoenix.controls.JFXCheckBox;
|
||||
import javafx.beans.binding.Bindings;
|
||||
import javafx.fxml.FXML;
|
||||
|
@ -31,6 +32,8 @@ public class StringKeyValueFieldController implements Initializable {
|
|||
private TextField keyField, valueField;
|
||||
@FXML
|
||||
private JFXCheckBox checkBox;
|
||||
@FXML
|
||||
protected JFXButton deleteButton;
|
||||
|
||||
/*
|
||||
Set to true when user manually un-checks the field
|
||||
|
|
|
@ -65,13 +65,17 @@ public class URLTabController implements Initializable {
|
|||
|
||||
try {
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml"));
|
||||
Parent parent = loader.load();
|
||||
ThemeManager.setTheme(parent);
|
||||
Parent stringField = loader.load();
|
||||
ThemeManager.setTheme(stringField);
|
||||
StringKeyValueFieldController controller = loader.getController();
|
||||
controller.setKeyField(key);
|
||||
controller.setValueField(value);
|
||||
controller.deleteButton.setOnAction(e -> {
|
||||
fieldsBox.getChildren().remove(stringField);
|
||||
controllers.remove(controller);
|
||||
});
|
||||
controllers.add(controller);
|
||||
fieldsBox.getChildren().add(parent);
|
||||
fieldsBox.getChildren().add(stringField);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
@ -20,9 +20,11 @@
|
|||
<?import com.jfoenix.controls.JFXCheckBox?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<HBox fx:id="headerField" alignment="CENTER" spacing="10.0" stylesheets="@../../css/Adreana.css"
|
||||
xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.rohitawate.restaurant.homewindow.FileKeyValueFieldController">
|
||||
<children>
|
||||
<JFXCheckBox fx:id="checkBox" checkedColor="ORANGERED" unCheckedColor="#7a7a7a" HBox.hgrow="ALWAYS"/>
|
||||
|
@ -30,6 +32,15 @@
|
|||
<TextField fx:id="fileValueField" layoutX="10.0" layoutY="10.0" prefWidth="400.0" promptText="FILE PATH"
|
||||
HBox.hgrow="ALWAYS"/>
|
||||
<JFXButton fx:id="browseButton" onAction="#browseFile" text="BROWSE"/>
|
||||
<JFXButton fx:id="deleteButton" ripplerFill="WHITE">
|
||||
<graphic>
|
||||
<ImageView fitHeight="15.0" fitWidth="15.0" opacity="0.25" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../../assets/CrossMark.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/>
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<VBox fx:id="headerTabContent" alignment="CENTER" stylesheets="@../../css/Adreana.css"
|
||||
xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.rohitawate.restaurant.homewindow.FormDataTabController">
|
||||
<children>
|
||||
<HBox alignment="CENTER" VBox.vgrow="NEVER">
|
||||
|
@ -67,7 +67,7 @@
|
|||
</HBox>
|
||||
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" VBox.vgrow="ALWAYS">
|
||||
<content>
|
||||
<VBox fx:id="headersBox" alignment="TOP_CENTER"/>
|
||||
<VBox fx:id="fieldsBox" alignment="TOP_CENTER"/>
|
||||
</content>
|
||||
</ScrollPane>
|
||||
</children>
|
||||
|
|
|
@ -16,18 +16,30 @@
|
|||
~ limitations under the License.
|
||||
-->
|
||||
|
||||
<?import com.jfoenix.controls.JFXButton?>
|
||||
<?import com.jfoenix.controls.JFXCheckBox?>
|
||||
<?import javafx.geometry.Insets?>
|
||||
<?import javafx.scene.control.TextField?>
|
||||
<?import javafx.scene.layout.HBox?>
|
||||
<?import javafx.scene.image.Image?>
|
||||
<?import javafx.scene.image.ImageView?>
|
||||
<?import javafx.scene.layout.*?>
|
||||
<HBox fx:id="headerField" alignment="CENTER" spacing="10.0" stylesheets="@../../css/Adreana.css"
|
||||
xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1"
|
||||
xmlns="http://javafx.com/javafx/8.0.141" xmlns:fx="http://javafx.com/fxml/1"
|
||||
fx:controller="com.rohitawate.restaurant.homewindow.StringKeyValueFieldController">
|
||||
<children>
|
||||
<JFXCheckBox fx:id="checkBox" checkedColor="ORANGERED" unCheckedColor="#7a7a7a" HBox.hgrow="ALWAYS"/>
|
||||
<TextField fx:id="keyField" prefWidth="400.0" promptText="KEY" HBox.hgrow="ALWAYS"/>
|
||||
<TextField fx:id="valueField" layoutX="10.0" layoutY="10.0" prefWidth="400.0" promptText="VALUE"
|
||||
HBox.hgrow="ALWAYS"/>
|
||||
<JFXButton fx:id="deleteButton" ripplerFill="WHITE" HBox.hgrow="ALWAYS">
|
||||
<graphic>
|
||||
<ImageView fitHeight="15.0" fitWidth="15.0" opacity="0.25" pickOnBounds="true" preserveRatio="true">
|
||||
<image>
|
||||
<Image url="@../../assets/CrossMark.png"/>
|
||||
</image>
|
||||
</ImageView>
|
||||
</graphic>
|
||||
</JFXButton>
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/>
|
||||
|
|
Loading…
Reference in a new issue