Skip to content

Commit d594ae6

Browse files
rodel-talampasrodel-talampas
authored andcommitted
Updated SQL Script
1 parent d628099 commit d594ae6

File tree

6 files changed

+77
-12
lines changed

6 files changed

+77
-12
lines changed

README.md

Lines changed: 53 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ This basically assumes that each Screen has its own FXML file and each having it
1616

1717
The framework is not limited to Buttons though. Every navigation object such as HyperLink or DropDown can be configured as such.
1818

19+
This framework was designed for a Desktop Application. If in case for web, I believe there are a bunch of Web UI Framework out there suitable for the same task. But if this is useful in someone's case, I am glad that I can help.
20+
1921
Technologies / Components
2022
-------------------------
2123
1. Java Annotations (Java 8)
@@ -35,8 +37,8 @@ Resources
3537
2. The project also used some concepts of Spring-Reflection
3638
- http://techo-ecco.com/blog/spring-custom-annotations/
3739
38-
The Code
39-
---------
40+
The Code and the Default Navigation
41+
-----------------------------------
4042
The `ScreenFlowSample` Maven Module contains the basic Java FX Screen / Controller pairing that uses the RT FX's Screen Navigation Framework.
4143

4244
It is compose of 3 FXML files:
@@ -49,29 +51,74 @@ With their corresponding FX Controllers:
4951
- NextScreen01Controller.java
5052
- NextScreen02Controller.java
5153

54+
A typical code for an FX Controller will be like the following below:
5255

5356
```java
57+
/**
58+
* This '@Screen' line describes that this FX Controller is tied to a Screen (FXML) called 'main'
59+
* With a default FXML File /rt/fx/sample/mainScreen.fxml
60+
*/
5461
@Screen(id="main", fileContext="/rt/fx/sample/mainScreen.fxml")
5562
public class MainScreenController extends AController
5663
{
5764

5865
@FXML
66+
/**
67+
* This '@Navigation' line describes that this FX Control Button is tied to a Navigation called 'btnMain'
68+
* With a default target next screen to be 'screen02'
69+
*/
5970
@Navigation(id="btnMain", defaultTarget = "screen02")
6071
Button btnMain;
6172

6273
@FXML
6374
private void validate(ActionEvent event){
6475
Button btn = (Button)event.getSource();
6576
System.out.println(btn.getId());
77+
/**
78+
* Using Angela's Screen Framework, setting the next screen would be easy as its controlled
79+
* by the ScreenLoader Navigation Framework. Even if you have more than 1 Button,
80+
* as long as you configured the Navigation Object using the Framework's annotation,
81+
* only 1 line of code is enough
82+
*/
6683
myController.setScreen(ScreenLoader.getNavigation("main", btn.getId()));
6784
}
6885

6986
}
7087

71-
72-
73-
74-
88+
```
89+
Without the ScreenLoader (RT FX's Screen Navigation Framework), the transition screen code would look like this
90+
91+
```java
92+
private void validate(ActionEvent event) {
93+
Button btn = (Button) event.getSource();
94+
switch (btn.getId()) {
95+
case "btnMain":
96+
myController.setScreen("screen02");
97+
break;
98+
// if you have other buttons to declare
99+
// you need to add the some piece of code below
100+
case "btnCancel":
101+
myController.setScreen("cancel");
102+
break;
103+
case "btnBack":
104+
myController.setScreen("back");
105+
break;
106+
default:
107+
break;
108+
}
109+
}
110+
```
111+
112+
Overriding the Default Navigation
113+
---------------------------------
114+
There are some instances that the default next screen wont be the next screen the customer (operator of the app) wants. E.g. Instead of going to the default Item Selection Screen first, the customer wants to have another screen before that, Season Screen [Summer, Winter, Fall, Autumn]. Instead of modifying the Screen Controller that redirect to Item Selection Screen, overrite the Controller's Navigation defaultTarget through a series SQL Scripts.
115+
116+
```sql
117+
'This lines of SQL Script will Override the defaultTarget screen id of btnMain navigation object. The default
118+
'is screen02. Now this script will make it as screen01
119+
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('main', '/rt/fx/sample/mainScreen.fxml')
120+
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnMain', 'main', 'screen01')
121+
```
75122

76123

77124

core/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/pom.xml.versionsBackup

core/ScreenFlowBase/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
/target/
2+
/pom.xml.versionsBackup

core/ScreenFlowBase/src/main/resources/config.db.sql

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ ALTER TABLE SCREEN_NAVIGATOR ADD CONSTRAINT SCREEN_NAVIGATOR_PK PRIMARY KEY ( id
1515
ALTER TABLE SCREEN_NAVIGATOR ADD CONSTRAINT SCREEN_NAVIGATOR_SCREEN_CONTROLLER_FK FOREIGN KEY ( owner_id ) REFERENCES SCREEN_CONTROLLER ( id ) ;
1616
ALTER TABLE SCREEN_NAVIGATOR ADD CONSTRAINT SCREEN_NAVIGATOR_SCREEN_CONTROLLER_FK2 FOREIGN KEY ( target_id ) REFERENCES SCREEN_CONTROLLER ( id ) ;
1717

18-
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('main', '/rt/fx/sample/mainScreen.fxml')
19-
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('screen01', '/rt/fx/sample/nextScreen01.fxml')
20-
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('screen02', '/rt/fx/sample/nextScreen02.fxml')
18+
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('main', '/rt/fx/sample/mainScreen.fxml');
19+
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('screen01', '/rt/fx/sample/nextScreen01.fxml');
20+
insert into "APP"."SCREEN_CONTROLLER" ("ID", "FILE_CONTEXT") values('screen02', '/rt/fx/sample/nextScreen02.fxml');
2121

22-
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnMain', 'main', 'screen01')
23-
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnScreen01', 'screen01', 'screen02')
24-
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnScreen02', 'screen02', 'main')
22+
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnMain', 'main', 'screen01');
23+
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnScreen01', 'screen01', 'screen02');
24+
insert into "APP"."SCREEN_NAVIGATOR" ("ID", "OWNER_ID", "TARGET_ID") values('btnScreen02', 'screen02', 'main');

core/ScreenFlowSample/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
/target/
2+
/pom.xml.versionsBackup
3+
/derby.log

core/ScreenFlowSample/src/main/java/rt/fx/sample/MainScreenController.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,18 @@
3838
*
3939
*/
4040

41+
/**
42+
* This '@Screen' line describes that this FX Controller is tied to a Screen (FXML) called 'main'
43+
* With a default FXML File /rt/fx/sample/mainScreen.fxml
44+
*/
4145
@Screen(id="main", fileContext="/rt/fx/sample/mainScreen.fxml")
4246
public class MainScreenController extends AController{
4347

4448
@FXML
49+
/**
50+
* This '@Navigation' line describes that this FX Control Button is tied to a Navigation called 'btnMain'
51+
* With a default target next screen to be 'screen02'
52+
*/
4553
@Navigation(id="btnMain", defaultTarget = "screen02")
4654
Button btnMain;
4755

@@ -54,6 +62,12 @@ public void initialize(URL location, ResourceBundle resources) {
5462
private void validate(ActionEvent event){
5563
Button btn = (Button)event.getSource();
5664
System.out.println(btn.getId());
65+
/**
66+
* Using Angela's Screen Framework, setting the next screen would be easy as its controlled
67+
* by the ScreenLoader Navigation Framework. Even if you have more than 1 Button,
68+
* as long as you configured the Navigation Object using the Framework's annotation,
69+
* only 1 line of code is enough
70+
*/
5771
myController.setScreen(ScreenLoader.getNavigation("main", btn.getId()));
5872
}
5973

0 commit comments

Comments
 (0)