Reformated the structure of single scene

The meerkat gui is an project consist of scenes every scene is an panel,
now every panel have the loader class which loads it content
and the handler object which handles the visual effects as mouse clicked
etc'...
voting-station-gui
Vladimir ELazar Tokarev 2016-05-28 17:45:34 +03:00
parent c08fbdfa76
commit 541a6666fc
11 changed files with 113 additions and 60 deletions

View File

@ -7,7 +7,7 @@
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController"> <GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootLoader">
<columnConstraints> <columnConstraints>
<ColumnConstraints /> <ColumnConstraints />
<ColumnConstraints /> <ColumnConstraints />

View File

@ -1,8 +0,0 @@
package set_up_complete;
/**
* Created by Vladimir Eliezer Tokarev on 28/05/2016.
*/
public class SetUpCompleteController {
}

View File

@ -2,18 +2,12 @@
<!-- Created By Vladimir Eliezer Tokarev !--> <!-- Created By Vladimir Eliezer Tokarev !-->
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.scene.text.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController"> <GridPane alignment="center" hgap="10" prefHeight="267.0" prefWidth="541.0" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="set_up_complete.java.SetUpCompleteController">
<columnConstraints> <columnConstraints>
<ColumnConstraints /> <ColumnConstraints />
<ColumnConstraints /> <ColumnConstraints />
@ -26,7 +20,7 @@
<children> <children>
<AnchorPane prefHeight="348.0" prefWidth="547.0" GridPane.columnIndex="1" GridPane.rowIndex="1"> <AnchorPane prefHeight="348.0" prefWidth="547.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children> <children>
<GridPane prefHeight="358.0" prefWidth="547.0"> <GridPane prefHeight="288.0" prefWidth="547.0">
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" /> <ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints> </columnConstraints>
@ -34,8 +28,6 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" /> <RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="143.0" minHeight="10.0" prefHeight="143.0" vgrow="SOMETIMES" /> <RowConstraints maxHeight="143.0" minHeight="10.0" prefHeight="143.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="66.0" minHeight="0.0" prefHeight="0.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints> </rowConstraints>
<children> <children>
<GridPane> <GridPane>

View File

@ -0,0 +1,18 @@
package set_up_complete.java;
import javafx.stage.Stage;
/**
* Created by Vladimir Eliezer Tokarev on 28/05/2016.
* SetUpCompleteController controls the behavior (buttons clicks mouse drags etc'...)
*/
public class SetUpCompleteController {
private Stage currentStage;
public void SetStage(Stage primaryStage)
{
this.currentStage = primaryStage;
}
}

View File

@ -0,0 +1,32 @@
package set_up_complete.java;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import uploading_to_bulletin_board.java.UploadingToBulletinBoardController;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 28/05/2016.
* SetUpCompleteLoader represent the end state of subscription to bulletin board
*/
public class SetUpCompleteLoader {
private static final String SET_UP_COMPLETE_PATH = "../fxml/set_up_complete.fxml";
private Stage currentStage;
public SetUpCompleteLoader (Stage primaryStage) throws IOException
{
currentStage = primaryStage;
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(SET_UP_COMPLETE_PATH));
Parent root = fxmlLoader.load();
SetUpCompleteController controller = fxmlLoader.getController();
controller.SetStage(currentStage);
currentStage.setTitle("Set Up Complete");
currentStage.setScene(new Scene(root, 560, 310));
currentStage.show();
}
}

View File

@ -5,14 +5,9 @@
<?import javafx.scene.image.*?> <?import javafx.scene.image.*?>
<?import javafx.geometry.*?> <?import javafx.geometry.*?>
<?import javafx.scene.control.*?> <?import javafx.scene.control.*?>
<?import java.lang.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<?import javafx.geometry.Insets?>
<?import javafx.scene.layout.GridPane?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController"> <GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints> <columnConstraints>
<ColumnConstraints /> <ColumnConstraints />
<ColumnConstraints /> <ColumnConstraints />

View File

@ -3,11 +3,15 @@ package splash_screen_on_boot.java;
import javafx.application.Application; import javafx.application.Application;
import javafx.stage.Stage; import javafx.stage.Stage;
/**
* Created by Vladimir Eliezer Tokarev on 28/05/2016.
*/
public class Main extends Application { public class Main extends Application {
@Override @Override
public void start(Stage primaryStage) throws Exception{ public void start(Stage primaryStage) throws Exception{
new SplashScreenOnBootController(primaryStage); new SplashScreenOnBootLoader(primaryStage);
primaryStage.setTitle("Meerkat"); primaryStage.setTitle("Meerkat");
primaryStage.show(); primaryStage.show();
} }

View File

@ -5,23 +5,22 @@ import javafx.fxml.FXMLLoader;
import javafx.scene.Parent; import javafx.scene.Parent;
import javafx.scene.Scene; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import uploading_to_bulletin_board.java.UploadingToBulletinBoardController; import uploading_to_bulletin_board.java.UploadingToBulletinBoardLoader;
import java.io.IOException; import java.io.IOException;
/** /**
* SplashScreenOnBootController starts the entry point into meerkat it displays the loading * Created by Vladimir Eliezer Tokarev on 28/05/2016.
* SplashScreenOnBootLoader starts the entry point into meerkat it displays the loading
*/ */
public class SplashScreenOnBootController { public class SplashScreenOnBootLoader {
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxml/spalsh_screen_on_boot.fxml"; private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxml/spalsh_screen_on_boot.fxml";
private static final int TWO_SECONDS_TIMEOUT_IN_MILLISECONDS = 2000; private static final int TWO_SECONDS_TIMEOUT_IN_MILLISECONDS = 1000;
/** The primary stage which displays data, should pass it to next controller **/
private Stage currentStage; private Stage currentStage;
public SplashScreenOnBootLoader(Stage primaryStage) throws IOException
public SplashScreenOnBootController(Stage primaryStage) throws IOException
{ {
Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH)); Parent splashScreenOnBootRoot = FXMLLoader.load(getClass().getResource(SPALSH_SCREEN_ON_BOOT_FXML_PATH));
currentStage = primaryStage; currentStage = primaryStage;
@ -46,7 +45,7 @@ public class SplashScreenOnBootController {
try { try {
StartUploadingToBulletinBoard(); StartUploadingToBulletinBoard();
} catch (IOException e) { } catch (IOException e) {
System.out.println("Could not create new uploading to bulletin board scene!"); e.printStackTrace();
} }
}); });
new Thread(sleeper).start(); new Thread(sleeper).start();
@ -55,12 +54,10 @@ public class SplashScreenOnBootController {
/** /**
* Creates instance of uploading to bulletin board and set it as the scene * Creates instance of uploading to bulletin board and set it as the scene
*/ */
private void StartUploadingToBulletinBoard() throws IOException { private void StartUploadingToBulletinBoard() throws IOException
new UploadingToBulletinBoardController(currentStage); {
new UploadingToBulletinBoardLoader(currentStage);
} }
/**
* Needed for normal output flow
*/
public SplashScreenOnBootController(){}
} }

View File

@ -13,7 +13,7 @@
<?import javafx.scene.control.Button?> <?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?> <?import javafx.scene.control.Label?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="splash_screen_on_boot.java.SplashScreenOnBootController"> <GridPane alignment="center" hgap="10" vgap="10" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="uploading_to_bulletin_board.java.UploadingToBulletinBoardController">
<columnConstraints> <columnConstraints>
<ColumnConstraints /> <ColumnConstraints />
<ColumnConstraints /> <ColumnConstraints />
@ -141,7 +141,7 @@
</BorderPane> </BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="2"> <BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="2">
<center> <center>
<Button mnemonicParsing="false" text="Override" BorderPane.alignment="CENTER" /> <Button mnemonicParsing="false" onMouseClicked="#Override" onMousePressed="#Override" text="Override" BorderPane.alignment="CENTER" />
</center> </center>
</BorderPane> </BorderPane>
</children> </children>

View File

@ -1,36 +1,27 @@
package uploading_to_bulletin_board.java; package uploading_to_bulletin_board.java;
import javafx.fxml.FXML; import javafx.fxml.FXML;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.stage.Stage;
import set_up_complete.java.SetUpCompleteLoader;
import java.io.IOException; import java.io.IOException;
/** /**
* Created by Vladimir Eliezer Tokarev on 28/05/2016. * Created by Vladimir Eliezer Tokarev on 28/05/2016.
* UploadingToBulletinBoardController controls the behavior (buttons clicks mouse drags etc'...)
*/ */
public class UploadingToBulletinBoardController { public class UploadingToBulletinBoardController {
private static final String UPLOADING_TO_BULLETIN_BOARD_FXM_PATH = "../fxml/uploading_to_bulletin_board.fxml";
protected Parent UploadToBulletinBoardRoot; private Stage currentStage;
public UploadingToBulletinBoardController(Stage primaryStage) throws IOException public void SetStage(Stage primaryStage)
{ {
UploadToBulletinBoardRoot = FXMLLoader.load(getClass().getResource(UPLOADING_TO_BULLETIN_BOARD_FXM_PATH)); this.currentStage = primaryStage;
primaryStage.setScene(new Scene(UploadToBulletinBoardRoot, 565, 365));
primaryStage.show();
} }
/**
* Method called when the override button had been clicked/pressed
*/
@FXML @FXML
private void Override() private void Override() throws IOException {
{ new SetUpCompleteLoader(currentStage);
} }
} }

View File

@ -0,0 +1,32 @@
package uploading_to_bulletin_board.java;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.stage.Stage;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 28/05/2016.
* UploadingToBulletinBoardLoader uploads the given code to the bulletin board
*/
public class UploadingToBulletinBoardLoader {
private static final String UPLOADING_TO_BULLETIN_BOARD_FXM_PATH = "../fxml/uploading_to_bulletin_board.fxml";
private Stage currentStage;
public UploadingToBulletinBoardLoader(Stage primaryStage) throws IOException
{
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(UPLOADING_TO_BULLETIN_BOARD_FXM_PATH));
Parent root = fxmlLoader.load();
UploadingToBulletinBoardController controller = fxmlLoader.getController();
currentStage = primaryStage;
currentStage.setTitle("Uploading To Bulletin Board");
currentStage.setScene(new Scene(root, 565, 365));
currentStage.show();
controller.SetStage(currentStage);
}
}