Added option to delete StringKV and FileKV fields from respective lists

This commit is contained in:
Rohit Awate 2018-02-21 17:14:10 +05:30
parent 91f5ab9326
commit 9eb149492d
10 changed files with 63 additions and 15 deletions

1
.gitignore vendored
View file

@ -6,5 +6,4 @@ classes/
src/main/java/META-INF/ src/main/java/META-INF/
dependency-reduced-pom.xml dependency-reduced-pom.xml
history.sqlite history.sqlite
themes/
/config/restaurant.state /config/restaurant.state

View file

@ -380,6 +380,10 @@ public class DashboardController implements Initializable {
controller.setKeyField(key); controller.setKeyField(key);
controller.setValueField(value); controller.setValueField(value);
paramsControllers.add(controller); paramsControllers.add(controller);
controller.deleteButton.setOnAction(e -> {
paramsBox.getChildren().remove(headerField);
paramsControllers.remove(controller);
});
paramsBox.getChildren().add(headerField); paramsBox.getChildren().add(headerField);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -16,6 +16,7 @@
package com.rohitawate.restaurant.homewindow; package com.rohitawate.restaurant.homewindow;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXCheckBox; import com.jfoenix.controls.JFXCheckBox;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -33,6 +34,8 @@ public class FileKeyValueFieldController implements Initializable {
private TextField fileKeyField, fileValueField; private TextField fileKeyField, fileValueField;
@FXML @FXML
private JFXCheckBox checkBox; private JFXCheckBox checkBox;
@FXML
protected JFXButton deleteButton;
/* /*
Set to true when user manually un-checks the field Set to true when user manually un-checks the field

View file

@ -32,7 +32,7 @@ import java.util.ResourceBundle;
public class FormDataTabController implements Initializable { public class FormDataTabController implements Initializable {
@FXML @FXML
private VBox headersBox; private VBox fieldsBox;
private List<StringKeyValueFieldController> stringControllers; private List<StringKeyValueFieldController> stringControllers;
private List<FileKeyValueFieldController> fileControllers; private List<FileKeyValueFieldController> fileControllers;
@ -69,13 +69,17 @@ public class FormDataTabController implements Initializable {
try { try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/FileKeyValueField.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/FileKeyValueField.fxml"));
Parent headerField = loader.load(); Parent fileField = loader.load();
ThemeManager.setTheme(headerField); ThemeManager.setTheme(fileField);
FileKeyValueFieldController controller = loader.getController(); FileKeyValueFieldController controller = loader.getController();
controller.setFileKeyField(key); controller.setFileKeyField(key);
controller.setFileValueField(value); controller.setFileValueField(value);
controller.deleteButton.setOnAction(e -> {
fieldsBox.getChildren().remove(fileField);
fileControllers.remove(controller);
});
fileControllers.add(controller); fileControllers.add(controller);
headersBox.getChildren().add(headerField); fieldsBox.getChildren().add(fileField);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -104,12 +108,16 @@ public class FormDataTabController implements Initializable {
try { try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml"));
Parent headerField = loader.load(); Parent stringField = loader.load();
StringKeyValueFieldController controller = loader.getController(); StringKeyValueFieldController controller = loader.getController();
controller.setKeyField(key); controller.setKeyField(key);
controller.setValueField(value); controller.setValueField(value);
stringControllers.add(controller); 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) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -67,6 +67,10 @@ public class HeaderTabController implements Initializable {
controller.setKeyField(key); controller.setKeyField(key);
controller.setValueField(value); controller.setValueField(value);
controllers.add(controller); controllers.add(controller);
controller.deleteButton.setOnAction(e -> {
headersBox.getChildren().remove(headerField);
controllers.remove(controller);
});
headersBox.getChildren().add(headerField); headersBox.getChildren().add(headerField);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();

View file

@ -16,6 +16,7 @@
package com.rohitawate.restaurant.homewindow; package com.rohitawate.restaurant.homewindow;
import com.jfoenix.controls.JFXButton;
import com.jfoenix.controls.JFXCheckBox; import com.jfoenix.controls.JFXCheckBox;
import javafx.beans.binding.Bindings; import javafx.beans.binding.Bindings;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -31,6 +32,8 @@ public class StringKeyValueFieldController implements Initializable {
private TextField keyField, valueField; private TextField keyField, valueField;
@FXML @FXML
private JFXCheckBox checkBox; private JFXCheckBox checkBox;
@FXML
protected JFXButton deleteButton;
/* /*
Set to true when user manually un-checks the field Set to true when user manually un-checks the field

View file

@ -65,13 +65,17 @@ public class URLTabController implements Initializable {
try { try {
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml")); FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/homewindow/StringKeyValueField.fxml"));
Parent parent = loader.load(); Parent stringField = loader.load();
ThemeManager.setTheme(parent); ThemeManager.setTheme(stringField);
StringKeyValueFieldController controller = loader.getController(); StringKeyValueFieldController controller = loader.getController();
controller.setKeyField(key); controller.setKeyField(key);
controller.setValueField(value); controller.setValueField(value);
controller.deleteButton.setOnAction(e -> {
fieldsBox.getChildren().remove(stringField);
controllers.remove(controller);
});
controllers.add(controller); controllers.add(controller);
fieldsBox.getChildren().add(parent); fieldsBox.getChildren().add(stringField);
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }

View file

@ -20,9 +20,11 @@
<?import com.jfoenix.controls.JFXCheckBox?> <?import com.jfoenix.controls.JFXCheckBox?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.TextField?> <?import javafx.scene.control.TextField?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.HBox?> <?import javafx.scene.layout.HBox?>
<HBox fx:id="headerField" alignment="CENTER" spacing="10.0" stylesheets="@../../css/Adreana.css" <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"> fx:controller="com.rohitawate.restaurant.homewindow.FileKeyValueFieldController">
<children> <children>
<JFXCheckBox fx:id="checkBox" checkedColor="ORANGERED" unCheckedColor="#7a7a7a" HBox.hgrow="ALWAYS"/> <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" <TextField fx:id="fileValueField" layoutX="10.0" layoutY="10.0" prefWidth="400.0" promptText="FILE PATH"
HBox.hgrow="ALWAYS"/> HBox.hgrow="ALWAYS"/>
<JFXButton fx:id="browseButton" onAction="#browseFile" text="BROWSE"/> <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> </children>
<padding> <padding>
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/> <Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/>

View file

@ -23,7 +23,7 @@
<?import javafx.scene.image.ImageView?> <?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<VBox fx:id="headerTabContent" alignment="CENTER" stylesheets="@../../css/Adreana.css" <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"> fx:controller="com.rohitawate.restaurant.homewindow.FormDataTabController">
<children> <children>
<HBox alignment="CENTER" VBox.vgrow="NEVER"> <HBox alignment="CENTER" VBox.vgrow="NEVER">
@ -67,7 +67,7 @@
</HBox> </HBox>
<ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" VBox.vgrow="ALWAYS"> <ScrollPane fitToHeight="true" fitToWidth="true" hbarPolicy="NEVER" VBox.vgrow="ALWAYS">
<content> <content>
<VBox fx:id="headersBox" alignment="TOP_CENTER"/> <VBox fx:id="fieldsBox" alignment="TOP_CENTER"/>
</content> </content>
</ScrollPane> </ScrollPane>
</children> </children>

View file

@ -16,18 +16,30 @@
~ limitations under the License. ~ limitations under the License.
--> -->
<?import com.jfoenix.controls.JFXButton?>
<?import com.jfoenix.controls.JFXCheckBox?> <?import com.jfoenix.controls.JFXCheckBox?>
<?import javafx.geometry.Insets?> <?import javafx.geometry.Insets?>
<?import javafx.scene.control.TextField?> <?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" <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"> fx:controller="com.rohitawate.restaurant.homewindow.StringKeyValueFieldController">
<children> <children>
<JFXCheckBox fx:id="checkBox" checkedColor="ORANGERED" unCheckedColor="#7a7a7a" HBox.hgrow="ALWAYS"/> <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="keyField" prefWidth="400.0" promptText="KEY" HBox.hgrow="ALWAYS"/>
<TextField fx:id="valueField" layoutX="10.0" layoutY="10.0" prefWidth="400.0" promptText="VALUE" <TextField fx:id="valueField" layoutX="10.0" layoutY="10.0" prefWidth="400.0" promptText="VALUE"
HBox.hgrow="ALWAYS"/> 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> </children>
<padding> <padding>
<Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/> <Insets bottom="5.0" left="10.0" right="10.0" top="5.0"/>