Skip to content

Commit dec5edb

Browse files
committed
New dummy form added for testing
1 parent fcd9e5d commit dec5edb

6 files changed

Lines changed: 382 additions & 54 deletions

File tree

.idea/workspace.xml

Lines changed: 250 additions & 37 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
* Copyright (c) 2012, Stephen Chin
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
* * Redistributions of source code must retain the above copyright
8+
* notice, this list of conditions and the following disclaimer.
9+
* * Redistributions in binary form must reproduce the above copyright
10+
* notice, this list of conditions and the following disclaimer in the
11+
* documentation and/or other materials provided with the distribution.
12+
* * Neither the name of the <organization> nor the
13+
* names of its contributors may be used to endorse or promote products
14+
* derived from this software without specific prior written permission.
15+
*
16+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
17+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
19+
* DISCLAIMED. IN NO EVENT SHALL STEPHEN CHIN OR ORACLE CORPORATION BE LIABLE FOR ANY
20+
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
21+
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
22+
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
23+
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25+
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26+
*/
27+
28+
package steveonjava.client;
29+
30+
import javafx.fxml.FXML;
31+
import javafx.scene.control.TextField;
32+
import org.springframework.beans.factory.annotation.Autowired;
33+
34+
public class CustomerEditorController implements DialogController {
35+
@Autowired
36+
private CustomerModel model;
37+
private FXMLDialog dialog;
38+
private ScreensConfiguration screens;
39+
40+
public void setDialog(FXMLDialog dialog) {
41+
this.dialog = dialog;
42+
}
43+
44+
@FXML
45+
TextField firstName;
46+
@FXML
47+
TextField lastName;
48+
49+
@FXML
50+
public void register() {
51+
model.addCustomer(firstName.getText(), lastName.getText());
52+
dialog.close();
53+
}
54+
55+
@FXML
56+
public void close() {
57+
dialog.close();
58+
}
59+
60+
@FXML
61+
public void cancel() {
62+
dialog.close();
63+
}
64+
}

client/src/main/java/steveonjava/client/LoginController.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,12 @@ public void login() {
7474
screens.showScreen(screens.customerDataScreen());
7575
}
7676

77+
@FXML
78+
public void register() {
79+
dialog.close();
80+
screens.registerDialog().show();
81+
}
82+
7783
@FXML
7884
public void employee() {
7985
username.setText("employee");

client/src/main/java/steveonjava/client/ScreensConfiguration.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,24 @@ AddCustomerController addCustomerController() {
8484
return new AddCustomerController();
8585
}
8686

87+
@Bean
88+
@Scope("prototype")
89+
CustomerEditorController customerEditorController() {
90+
return new CustomerEditorController();
91+
}
92+
8793
@Bean
8894
@Scope("prototype")
8995
FXMLDialog loginDialog() {
9096
return new FXMLDialog(loginController(), getClass().getResource("Login.fxml"), primaryStage, StageStyle.UNDECORATED);
9197
}
9298

99+
@Bean
100+
@Scope("prototype")
101+
FXMLDialog registerDialog() {
102+
return new FXMLDialog(customerEditorController(), getClass().getResource("customer_editor.fxml"), primaryStage, StageStyle.UNDECORATED);
103+
}
104+
93105
@Bean
94106
@Scope("prototype")
95107
LoginController loginController() {
Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,20 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22

3-
<?import java.lang.*?>
4-
<?import java.util.*?>
5-
<?import javafx.scene.control.*?>
6-
<?import javafx.scene.image.*?>
7-
<?import javafx.scene.layout.*?>
8-
<?import javafx.scene.paint.*?>
9-
<?import javafx.scene.text.*?>
10-
<?import javafx.collections.FXCollections ?>
3+
<?import javafx.scene.control.Button?>
4+
<?import javafx.scene.control.Hyperlink?>
5+
<?import javafx.scene.control.Label?>
6+
<?import javafx.scene.control.PasswordField?>
7+
<?import javafx.scene.control.TextField?>
8+
<?import javafx.scene.image.Image?>
9+
<?import javafx.scene.image.ImageView?>
10+
<?import javafx.scene.layout.AnchorPane?>
11+
<?import javafx.scene.layout.ColumnConstraints?>
12+
<?import javafx.scene.layout.GridPane?>
13+
<?import javafx.scene.layout.RowConstraints?>
14+
<?import javafx.scene.paint.Color?>
15+
<?import javafx.scene.text.Font?>
1116

12-
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity"
13-
minWidth="-Infinity" prefHeight="235.0" prefWidth="482.0" style="-fx-background-color: lightblue"
14-
xmlns:fx="http://javafx.com/fxml"
15-
fx:controller="steveonjava.client.LoginController">
17+
<AnchorPane id="AnchorPane" maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="235.0" prefWidth="482.0" style="-fx-background-color: lightblue" xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1" fx:controller="steveonjava.client.LoginController">
1618
<children>
1719
<GridPane id="GridPane" layoutX="48.0" layoutY="115.0">
1820
<children>
@@ -25,6 +27,10 @@
2527
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
2628
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" />
2729
</columnConstraints>
30+
<rowConstraints>
31+
<RowConstraints />
32+
<RowConstraints />
33+
</rowConstraints>
2834
<!--
2935
<hgap>
3036
<Long fx:value="10" />
@@ -43,20 +49,21 @@
4349
</font>
4450
</Label>
4551
<Label fx:id="header" layoutX="48.0" layoutY="82.0" text="Please login with your credentials:" textFill="GREY" />
46-
<ImageView fitHeight="111.25471620029381" fitWidth="106.24324035644531" layoutX="343.0" layoutY="83.0" pickOnBounds="true" preserveRatio="true">
52+
<ImageView fitHeight="111.25471620029381" fitWidth="106.24324035644531" layoutX="344.0" layoutY="74.0" pickOnBounds="true" preserveRatio="true">
4753
<image>
48-
<Image url="@logo.png" preserveRatio="false" smooth="false" />
54+
<Image preserveRatio="false" smooth="false" url="@logo.png" />
4955
</image>
5056
</ImageView>
51-
<Button defaultButton="true" layoutX="264.0" layoutY="187.0" mnemonicParsing="false" onAction="#login" text="Login" />
52-
<Hyperlink layoutX="119.0" layoutY="187.0" onAction="#employee" text="Employee">
57+
<Button defaultButton="true" layoutX="241.0" layoutY="186.0" mnemonicParsing="false" onAction="#login" text="Login" />
58+
<Button defaultButton="true" layoutX="302.0" layoutY="186.0" mnemonicParsing="false" onAction="#register" text="Register" />
59+
<Hyperlink layoutX="101.0" layoutY="187.0" onAction="#employee" text="Employee">
5360
<font>
5461
<Font size="12.0" fx:id="x1" />
5562
</font>
5663
<textFill>
5764
<Color blue="0.800" green="0.512" red="0.000" fx:id="x2" />
5865
</textFill>
5966
</Hyperlink>
60-
<Hyperlink font="$x1" layoutX="188.0" layoutY="187.0" onAction="#manager" text="Manager" textFill="$x2" />
67+
<Hyperlink font="$x1" layoutX="175.0" layoutY="187.0" onAction="#manager" text="Manager" textFill="$x2" />
6168
</children>
6269
</AnchorPane>
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.control.Button?>
4+
<?import javafx.scene.control.Label?>
5+
<?import javafx.scene.control.TextField?>
6+
<?import javafx.scene.layout.AnchorPane?>
7+
<?import javafx.scene.layout.Pane?>
8+
9+
<AnchorPane prefHeight="400.0" prefWidth="600.0" style="-fx-background-color: lightblue" xmlns="http://javafx.com/javafx/8.0.121" xmlns:fx="http://javafx.com/fxml/1" fx:controller="steveonjava.client.CustomerEditorController">
10+
<children>
11+
<Pane layoutX="21.0" layoutY="26.0" prefHeight="277.0" prefWidth="384.0">
12+
<children>
13+
<Label layoutX="38.0" layoutY="49.0" prefHeight="17.0" prefWidth="166.0" text="First Name" />
14+
<TextField id="firstName" layoutX="185.0" layoutY="45.0" />
15+
<Label layoutX="38.0" layoutY="89.0" text="Last Name" />
16+
<Label layoutX="38.0" layoutY="132.0" text="Email Address" />
17+
<Label layoutX="38.0" layoutY="175.0" text="Contact Number" />
18+
<TextField layoutX="185.0" layoutY="85.0" />
19+
<TextField layoutX="185.0" layoutY="128.0" />
20+
<TextField layoutX="185.0" layoutY="171.0" />
21+
<Button layoutX="185.0" layoutY="215.0" mnemonicParsing="false" onAction="#register" text="Register" />
22+
<Button layoutX="289.0" layoutY="215.0" mnemonicParsing="false" onAction="#close" text="Close" />
23+
</children>
24+
</Pane>
25+
</children>
26+
</AnchorPane>

0 commit comments

Comments
 (0)