From e200bc0f8b6a6a832397196a3032bc1e94a9adf3 Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Sat, 27 Aug 2016 14:24:00 +0300 Subject: [PATCH] Converted TwoWayNode into abstract class Becuase all the classes that will extend this class will implelmett thisa same logic, so there is no reason to implement it as interface. --- .../voting-booth-gui/main/ChainBuilder.class | Bin 0 -> 928 bytes .../voting-booth-gui/main/Main.class | Bin 0 -> 821 bytes .../voting-booth-gui/main/TwoWayNode.class | Bin 0 -> 305 bytes .../main/welcome_splash/Main.class | Bin 870 -> 0 bytes .../WelcomeSplashController.class | Bin 0 -> 1141 bytes .../welcome_splash/WelcomeSplashLoader.class | Bin 1097 -> 1365 bytes .../welcome_splash/welcome_splash_screen.fxml | 2 +- voting-booth-gui/src/main/ChainBuilder.java | 6 ++- voting-booth-gui/src/main/Main.java | 7 +-- voting-booth-gui/src/main/TwoWayNode.java | 35 ++++++++++---- .../StraightChannelSectionController.java | 13 +++++ .../StraightChannelSectionLoader.java | 45 ++++++++++++++++++ .../WelcomeSplashController.java | 35 +------------- .../welcome_splash/WelcomeSplashLoader.java | 4 +- 14 files changed, 96 insertions(+), 51 deletions(-) create mode 100644 classes/production/voting-booth-gui/main/ChainBuilder.class create mode 100644 classes/production/voting-booth-gui/main/Main.class create mode 100644 classes/production/voting-booth-gui/main/TwoWayNode.class delete mode 100644 classes/production/voting-booth-gui/main/welcome_splash/Main.class create mode 100644 classes/production/voting-booth-gui/main/welcome_splash/WelcomeSplashController.class create mode 100644 voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionController.java create mode 100644 voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionLoader.java diff --git a/classes/production/voting-booth-gui/main/ChainBuilder.class b/classes/production/voting-booth-gui/main/ChainBuilder.class new file mode 100644 index 0000000000000000000000000000000000000000..a938de00d8f0dea342e6873f2dcfc017ae574a4e GIT binary patch literal 928 zcmah{T~8B16g|^!yRfV+ZNZ|T6u)Q-vVQP}@xexo$qFVV5T49*8R<0J-DYax%bSubI+Y$zkmD$u#IgC7Veu^wU9wgnKcs+=I{`YEadRm z!V|2UsGDdoR~JtNq>Hj9 zp4!-gqhQZWJh$-zFRAPeff?r2X~*ZmiL=+~2`?e3bV!EIhrLM?1bi=&DPag$AL}>O zc~MtMLkuPzRkEllHYVfI*ZssJ5hSG7Qaa!32{qtJgX!QIW@3@(UZApigX literal 0 HcmV?d00001 diff --git a/classes/production/voting-booth-gui/main/Main.class b/classes/production/voting-booth-gui/main/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..f7205a73815ef120cb19b9234afc5ae39ae03c37 GIT binary patch literal 821 zcmZuv%Wl&^6g`tTaq1eCNjRd{@4kPJ9>G;yGO7MoJB z-~;$5#2Gs@pw^4~^10`pJ2St2|M&^u2_AW<;kt))+^C`B;U;cbbK8T9J1*|JxF=A3 zsuP_(6DW5#4g{Q?bf5(4eVwQ`v+bmCFrM-j1Q#IHlG)rY^0|G%l)y`Nw`b1 zEl`ccz}mKw&3{)(I(01+5+qIUFBpF>nLvtpD$wSvVcPL>03EEdzZ|O_) z_1+0ey`X#yr+19Xf+m1tf77mTVuKVxPT4Bj=9Cr@V3pKsL_73NDr})WAM==%LgNXl c3vw?fX|kd9pUz9TOq#z`SJ--$c?sA40ELgJ6951J literal 0 HcmV?d00001 diff --git a/classes/production/voting-booth-gui/main/TwoWayNode.class b/classes/production/voting-booth-gui/main/TwoWayNode.class new file mode 100644 index 0000000000000000000000000000000000000000..c1cc023136af7d1d4bfc41537cabb2a6788a848f GIT binary patch literal 305 zcmZ8cyKcfj5S-;@3<0}{1fO6xTti2nG$#_QjIe*6OP1fGo=HZ5$~Fwm)D+s0k&Xmig-756PX zu&~Qec`8GhK4U0#_l_CN7tu&CH2N|WZ)Vd|p@#f4AjIuQJ`aw$k~%IxGo8qUVWU6g zGW5GLX;R&jq1An#<$D1S$3&`RIL=s2uEsRm>Vj(vd&D=0X37_@q*hnc z!yf4Q9N4Hc>@HGtk_#MU`uY(c38m9r5_cqo`pnbL+b9TVf(~iXqgvQ^(8EIqk5G4T zfHp&W5w-5muvu(~$8jM2jKO<8Ka(1rkW2l)j-o6_Ux%qsY8IzrbS1&PzIldfBGREu zwfwdG+g#saGKtRUjRbra`V(x^!>Q5h0!p9-qE6PK$Rp3lm-jEhzR|(J64^=y*04-x zCr>~FD-n#8|GcP9B3Rji|3^mK2vWrr5xpzYPAo AvH$=8 diff --git a/classes/production/voting-booth-gui/main/welcome_splash/WelcomeSplashController.class b/classes/production/voting-booth-gui/main/welcome_splash/WelcomeSplashController.class new file mode 100644 index 0000000000000000000000000000000000000000..361d8335f0c58aaa41c386aed7e2d5554a6cbe59 GIT binary patch literal 1141 zcmb7?%Wl(95QhJgCU!2SX-krpw$K7C~&RmEV~}*R$750y%QO_oF^~S(S=KW z_gX#a`u4T*oS>)927ONsF6`4d?dYr-_)!>mo(gFKv!kN6UaC}$OOLOEQ+dl19q<%+ zUin@3QaQBv@*fh~fe1(Ay%$Foj7qZfS+6UwTK$^~+{EgKZcm1{i7>}VZK}Z9q-fe~ zt}^g2mw;7A+J} z5NP~|!vaf;v_0vc+apVg8Zhx0kLj9aA?O08k>Z|oEmPc9pVV2O)SOO(bTl8u70PTn z1)Z7t7l=<o(Pi2~>qA`_N znqV0I0P6%2*!Tx9JquhX;Km%_W&(VON6CbT$%IC|afi$-YYQ1{PqB>ga0a%>G#+l7 t%#FAGjb+TTc8Ik*hxLS(Wft9tgf+4KGmMX9VG0x5YZ^0a`>s|!`vuMk)N23$ literal 0 HcmV?d00001 diff --git a/classes/production/voting-booth-gui/main/welcome_splash/WelcomeSplashLoader.class b/classes/production/voting-booth-gui/main/welcome_splash/WelcomeSplashLoader.class index ae33b2f8ca6daf844f38892194b516bd7085eca4..52a9f57dc3c432b01e157d2c082968c61fdd7274 100644 GIT binary patch literal 1365 zcma)6YflqF6g^Xlg|Y}#{Gw@g=H5H^apv4R{r%_1F91_mPNN;U6!K~xPhp}7lWFLx)r??__kY_7HBPaZY?m~VAFICq=04}_`Y<5Qeal7c7`!KhdO;Kl3`pK zmEJk5I)-Pym%c#Hv5zw9s$g_Nze_W=YX{E-y0gblXA_NW3M32OdlqUlY*(%xRJWzS zVQxFLWDL(TolVoXl^z?D!LD5s7&EG-?dl(;V|i6suI)Q!ZCBrl)KaLOV9@q`yK4HM zLhOV-e`v}5z~;46AjI}X8Jr6gxRQ0 z7BwuPm+d&6(c<==w1T*bZhQK2@uYVG4OulkO%)jw*nG}}>e^{=Xe6O+7fb>z3|W`8 zkY|CRXfV&cia3ue1O4^7!6Y5A)3GI-TZiM%2Xd}z1ep=73fDJ$(yj zc$*HdL$`2Fag$HJo&OIF=tBoG;Qgp2(8!Ms2xWF7+?f)+wD(ba7kU8wx$h9UpGdsT z)zOe?tmD#mq`sjkm;Z+5FJas@t{K(=^CX#}hZ%0*I)7lN6I}bL_j6a$0ILcNQciNe z$!`d^;;J?74LljieMM6p=_9llk*FP^b!9wX$K`Pvn(JsA|4hdORPio?1%}ar5z1NG k#+Wi60vL=E#sFFfZJ1shdbHs-MwwxdvByxdloJ^H3j?oGf&c&j delta 561 zcmZ9I%Wl(95Qe|wy0K#!D8Y4T!lf;@#w|6May6F}iUgvxs1cP|ArlUTDsrmEs=7fH zk5GBRE3id^6oCY6Va0|=;588AWCPXFjOPE(KmTavm-F3T`0?k{7hr~2haryV>4e2e zn^O)G)EojPEvAYLaN1(JP=Eba>UyWSg;&a{NhRaRr+3>)d?6y(fQkboF{7f-EF`xH@ ziB7{uOY>2!4_k4v5-vVn)y*_gRQjS_Go!h=+VVd$(|ARPjXW#tj!t{y73E#cIlZN$ z+A?Eu!6CVrL52O4kkxv~6h_vOTFLV%3qC056}EIh80?^eE=I}hGWe0gH>?N2 - + diff --git a/voting-booth-gui/src/main/ChainBuilder.java b/voting-booth-gui/src/main/ChainBuilder.java index c45e021..ba4dfef 100644 --- a/voting-booth-gui/src/main/ChainBuilder.java +++ b/voting-booth-gui/src/main/ChainBuilder.java @@ -1,5 +1,6 @@ package main; +import javafx.scene.Scene; import javafx.stage.Stage; import main.welcome_splash.WelcomeSplashLoader; @@ -19,7 +20,10 @@ public class ChainBuilder { WelcomeSplashLoader welcomeSplashLoader = new WelcomeSplashLoader(primaryStage); TwoWayNode welcomeSplashController = welcomeSplashLoader.GetWelcomeSplash(); - + /** + * all other two way nodes initilaized + */ + primaryStage.setScene(new Scene(welcomeSplashController.GetNode())); } } diff --git a/voting-booth-gui/src/main/Main.java b/voting-booth-gui/src/main/Main.java index 35672a0..93d7dd8 100644 --- a/voting-booth-gui/src/main/Main.java +++ b/voting-booth-gui/src/main/Main.java @@ -2,16 +2,17 @@ package main; import javafx.application.Application; import javafx.stage.Stage; -import main.welcome_splash.WelcomeSplashLoader; /** * Created by Vladimir Eliezer Tokarev on 8/27/2016. + * Main calls to ChainBuilder which initilizes all the TwoWayNode's */ public class Main extends Application { @Override - public void start(Stage primaryStage) throws Exception{ - new WelcomeSplashLoader(primaryStage); + public void start(Stage primaryStage) throws Exception + { + ChainBuilder.Build(primaryStage); primaryStage.setTitle("Meerkat Polling Station"); primaryStage.show(); } diff --git a/voting-booth-gui/src/main/TwoWayNode.java b/voting-booth-gui/src/main/TwoWayNode.java index e20e326..87c2b14 100644 --- a/voting-booth-gui/src/main/TwoWayNode.java +++ b/voting-booth-gui/src/main/TwoWayNode.java @@ -7,35 +7,50 @@ import javafx.stage.Stage; * Created by Vladimir Eliezer Tokarev on 8/27/2016. * Two Way node gives the ability to set next and previous objects */ -public interface TwoWayNode { +public abstract class TwoWayNode { - /** - * GetNode return the paren node that represents current object - * @return Paren object - */ - Parent GetNode(); + protected Parent next; + protected Parent previous; + protected Stage currentStage; + protected Parent currentNode; /** * Sets which next TwoWayNode * @param nextObject */ - void SetNext(TwoWayNode nextObject); + public void SetNext(TwoWayNode nextObject) { + this.next = nextObject.GetNode(); + } /** * Sets which previous TwoWayNode * @param previousObject */ - void SetPrevious(TwoWayNode previousObject); + public void SetPrevious(TwoWayNode previousObject) { + this.previous = previousObject.GetNode(); + } /** * Sets the stage of current object * @param primaryStage */ - void SetStage(Stage primaryStage); + public void SetStage(Stage primaryStage) { + this.currentStage = primaryStage; + } /** * Sets the current parent node * @param parent */ - void SetParent(Parent parent); + public void SetParent(Parent parent) { + this.currentNode = parent; + } + + /** + * GetNode return the paren node that represents current object + * @return Paren object + */ + public Parent GetNode() { + return this.currentNode; + } } diff --git a/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionController.java b/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionController.java new file mode 100644 index 0000000..7a56b36 --- /dev/null +++ b/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionController.java @@ -0,0 +1,13 @@ +package main.straight_channel_section; + +import javafx.scene.Parent; +import javafx.stage.Stage; +import main.TwoWayNode; + +/** + * Created by Vladimir Eliezer Tokarev on 8/27/2016. + * StraightChannelSectionController handle the behavior of welcome splash class + */ +public class StraightChannelSectionController extends TwoWayNode { + +} diff --git a/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionLoader.java b/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionLoader.java new file mode 100644 index 0000000..22ae227 --- /dev/null +++ b/voting-booth-gui/src/main/straight_channel_section/StraightChannelSectionLoader.java @@ -0,0 +1,45 @@ +package main.straight_channel_section; + +import javafx.fxml.FXMLLoader; +import javafx.scene.Parent; +import javafx.stage.Stage; +import main.TwoWayNode; +import main.welcome_splash.WelcomeSplashController; + +import java.io.IOException; + +/** + * Created by Vladimir Eliezer Tokarev on 8/27/2016. + * StraightChannelSectionLoader creates starlight channel section object and sets its controller + */ +public class StraightChannelSectionLoader { + private static final String STRAIGHT_CHANNEL_LOADER_FXML_PATH = "straight_channel_section.fxml"; + + private Stage currentStage; + private FXMLLoader fxmlLoader; + + public StraightChannelSectionLoader(Stage primaryStage) throws IOException + { + // Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPLASH_SCREEN_ON_BOOT_FXML_PATH)); + fxmlLoader = new FXMLLoader(getClass().getResource(STRAIGHT_CHANNEL_LOADER_FXML_PATH)); + currentStage = primaryStage; + // currentStage.setScene(new Scene(splashScreenOnBootRoot)); + } + + /** + * Creates welcome splash parent node and sets it to the controller + * @return TwoWayNode + * @throws IOException + */ + public TwoWayNode GetStraightChannelSection() throws IOException { + Parent straightChannelSection = fxmlLoader.load(); + StraightChannelSectionController controller = fxmlLoader.getController(); + + // set the controller to be functional TwoWayNode + controller.SetParent(welcomeSplash); + controller.SetStage(currentStage); + + return controller; + } + +} diff --git a/voting-booth-gui/src/main/welcome_splash/WelcomeSplashController.java b/voting-booth-gui/src/main/welcome_splash/WelcomeSplashController.java index 999a510..51f8c14 100644 --- a/voting-booth-gui/src/main/welcome_splash/WelcomeSplashController.java +++ b/voting-booth-gui/src/main/welcome_splash/WelcomeSplashController.java @@ -8,38 +8,5 @@ import main.TwoWayNode; * Created by Vladimir Eliezer Tokarev on 8/27/2016. * WelcomeSplashController handle the behavior of welcome splash class */ -public class WelcomeSplashController implements TwoWayNode { - - private Parent next; - private Parent previous; - private Stage currentSrage; - private Parent currentNode; - - - @Override - public void SetNext(TwoWayNode nextObject) { - this.next = nextObject.GetNode(); - } - - @Override - public void SetPrevious(TwoWayNode previousObject) { - this.previous = previousObject.GetNode(); - } - - @Override - public void SetStage(Stage primaryStage) { - this.currentSrage = primaryStage; - } - - @Override - public void SetParent(Parent parent) { - this.currentNode = parent; - } - - @Override - public Parent GetNode() { - return this.currentNode; - } - - +public class WelcomeSplashController extends TwoWayNode { } diff --git a/voting-booth-gui/src/main/welcome_splash/WelcomeSplashLoader.java b/voting-booth-gui/src/main/welcome_splash/WelcomeSplashLoader.java index 085a8cb..ed8ba64 100644 --- a/voting-booth-gui/src/main/welcome_splash/WelcomeSplashLoader.java +++ b/voting-booth-gui/src/main/welcome_splash/WelcomeSplashLoader.java @@ -14,7 +14,7 @@ import java.io.IOException; * WelcomeSplashLoader creates welcome spalash object and sets its controller */ public class WelcomeSplashLoader { - private static final String SPLASH_SCREEN_ON_BOOT_FXML_PATH = "welcome_splash_screen.fxml"; + private static final String WELCOME_SPLASH_FXML_PATH = "welcome_splash_screen.fxml"; private Stage currentStage; private FXMLLoader fxmlLoader; @@ -22,7 +22,7 @@ public class WelcomeSplashLoader { public WelcomeSplashLoader(Stage primaryStage) throws IOException { // Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPLASH_SCREEN_ON_BOOT_FXML_PATH)); - fxmlLoader = new FXMLLoader(getClass().getResource(SPLASH_SCREEN_ON_BOOT_FXML_PATH)); + fxmlLoader = new FXMLLoader(getClass().getResource(WELCOME_SPLASH_FXML_PATH)); currentStage = primaryStage; // currentStage.setScene(new Scene(splashScreenOnBootRoot)); }