Ended the fxml of uploading to bulletin board

ended its fxml and addedexternal loadinig pane class
voting-station-gui
Vladimir ELazar Tokarev 2016-05-21 09:54:21 +03:00
parent 6d01be0d13
commit ac2fc3a83d
6 changed files with 398 additions and 19 deletions

View File

@ -0,0 +1,68 @@
package ExternalClasses;
import javafx.animation.KeyFrame;
import javafx.animation.KeyValue;
import javafx.animation.Timeline;
import javafx.beans.property.DoubleProperty;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.scene.Parent;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.text.Text;
import javafx.util.Duration;
public class LoadingIndicator extends Parent{
private Timeline timeline = new Timeline();
private DoubleProperty stroke = new SimpleDoubleProperty(100.0);
public LoadingIndicator(){
super();
timeline.setCycleCount(Timeline.INDEFINITE);
final KeyValue kv = new KeyValue(stroke, 0);
final KeyFrame kf = new KeyFrame(Duration.millis(1500), kv);
timeline.getKeyFrames().add(kf);
timeline.play();
VBox root = new VBox(3);
StackPane progressIndicator = new StackPane();
Rectangle bar = new Rectangle(350,13);
bar.setFill(Color.TRANSPARENT);
bar.setStroke(Color.WHITE);
bar.setArcHeight(15);
bar.setArcWidth(15);
bar.setStrokeWidth(2);
Rectangle progress = new Rectangle(342,6);
progress.setFill(Color.WHITE);
progress.setStroke(Color.WHITE);
progress.setArcHeight(8);
progress.setArcWidth(8);
progress.setStrokeWidth(1.5);
progress.getStrokeDashArray().addAll(3.0,7.0,3.0,7.0);
progress.strokeDashOffsetProperty().bind(stroke);
progressIndicator.getChildren().add(progress);
progressIndicator.getChildren().add(bar);
root.getChildren().add(progressIndicator);
Text label = new Text("Loading...");
label.setFill(Color.WHITE);
root.getChildren().add(label);
getChildren().add(root);
}
}

View File

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?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.Controller">
<columnConstraints>
<ColumnConstraints />
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
<children>
<AnchorPane prefHeight="348.0" prefWidth="547.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<GridPane layoutX="-4.0" layoutY="-14.0" prefHeight="358.0" prefWidth="558.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="177.0" minHeight="10.0" prefHeight="78.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="213.0" minHeight="10.0" prefHeight="75.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="175.0" minHeight="10.0" prefHeight="175.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="36.0" minHeight="10.0" prefHeight="25.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<bottom>
<Label prefHeight="17.0" prefWidth="214.0" text=" Election Parameters being loaded...." BorderPane.alignment="CENTER" />
</bottom>
</BorderPane>
<GridPane prefHeight="42.0" prefWidth="566.0" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="116.0" minWidth="10.0" prefWidth="68.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="455.0" minWidth="10.0" prefWidth="422.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="181.0" minWidth="10.0" prefWidth="65.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="41.0" prefWidth="428.0" GridPane.columnIndex="1">
<center>
<Separator prefHeight="2.0" prefWidth="446.0" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children>
</GridPane>
<GridPane prefHeight="7.0" prefWidth="558.0" GridPane.rowIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="291.0" minWidth="10.0" prefWidth="269.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="180.0" minWidth="10.0" prefWidth="103.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="20.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
<top>
<Label text="Station Fingerprit:" BorderPane.alignment="CENTER" />
</top>
</BorderPane>
</children>
</GridPane>
</children>
</GridPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<center>
<GridPane BorderPane.alignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="32.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="497.0" minWidth="10.0" prefWidth="497.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="429.0" minWidth="10.0" prefWidth="32.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="25.0" minHeight="8.0" prefHeight="8.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="72.0" minHeight="10.0" prefHeight="72.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="24.0" minHeight="9.0" prefHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #a9a9a9;" GridPane.columnIndex="1" GridPane.rowIndex="1">
<center>
<Label prefHeight="36.0" prefWidth="486.0" style="-fx-background-color: #a9a9a9;" text="43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8" BorderPane.alignment="CENTER">
<font>
<Font size="24.0" />
</font></Label>
</center>
</BorderPane>
</children>
</GridPane>
</center>
</BorderPane>
<GridPane GridPane.rowIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="183.0" minWidth="10.0" prefWidth="161.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="340.0" minWidth="10.0" prefWidth="246.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="179.0" minWidth="10.0" prefWidth="151.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="54.0" minHeight="10.0" prefHeight="28.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="89.0" minHeight="10.0" prefHeight="89.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
<top>
<Label text="Waiting for Verification" BorderPane.alignment="CENTER" />
</top>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<top>
<ImageView fx:id="LoadingGif" BorderPane.alignment="CENTER">
<image>
<Image url="@../gifs/VerticalLoading.gif" />
</image>
</ImageView>
</top>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="2">
<center>
<Button mnemonicParsing="false" text="Override" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children>
</GridPane>
</children>
</GridPane>
</children>
</AnchorPane>
<Separator prefWidth="200.0" GridPane.columnIndex="1" />
</children>
</GridPane>

View File

@ -10,8 +10,7 @@
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<GridPane alignment="center" hgap="10" vgap="10" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8" fx:controller="splash_screen_on_boot.Controller">
<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.Controller">
<columnConstraints>
<ColumnConstraints />
<ColumnConstraints />
@ -42,11 +41,6 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<Label prefHeight="17.0" prefWidth="573.0" text="Initializing Polling Station">
<padding>
<Insets left="220.0" />
</padding>
</Label>
<GridPane GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
@ -59,18 +53,28 @@
<children>
<AnchorPane GridPane.columnIndex="1">
<children>
<ImageView fx:id="LoadingGif" AnchorPane.leftAnchor="65.0" AnchorPane.rightAnchor="65.0" GridPane.columnIndex="1">
<image>
<Image url="@../../gifs/loadingGif.gif" />
</image>
<GridPane.margin>
<Insets left="60.0" />
</GridPane.margin>
</ImageView>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<center>
<ImageView fx:id="LoadingGif" BorderPane.alignment="CENTER">
<image>
<Image url="@../gifs/loadingGif.gif" />
</image>
</ImageView>
</center>
</BorderPane>
</children>
</AnchorPane>
</children>
</GridPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<center>
<Label prefHeight="17.0" prefWidth="573.0" text="Initializing Polling Station" BorderPane.alignment="CENTER">
<padding>
<Insets left="220.0" />
</padding>
</Label>
</center>
</BorderPane>
</children>
</GridPane>
<GridPane>

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.text.*?>
<?import javafx.scene.image.*?>
<?import javafx.geometry.*?>
<?import javafx.scene.control.*?>
<?import java.lang.*?>
<?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.Controller">
<columnConstraints>
<ColumnConstraints />
<ColumnConstraints />
</columnConstraints>
<rowConstraints>
<RowConstraints />
<RowConstraints />
<RowConstraints />
</rowConstraints>
<children>
<AnchorPane prefHeight="348.0" prefWidth="547.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<children>
<GridPane layoutX="-4.0" layoutY="-14.0" prefHeight="358.0" prefWidth="558.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="177.0" minHeight="10.0" prefHeight="78.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="213.0" minHeight="10.0" prefHeight="75.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="175.0" minHeight="10.0" prefHeight="175.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<GridPane>
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="36.0" minHeight="10.0" prefHeight="25.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="10.0" prefHeight="40.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<bottom>
<Label prefHeight="17.0" prefWidth="214.0" text=" Election Parameters being loaded...." BorderPane.alignment="CENTER" />
</bottom>
</BorderPane>
<GridPane prefHeight="42.0" prefWidth="566.0" GridPane.rowIndex="1">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="116.0" minWidth="10.0" prefWidth="68.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="455.0" minWidth="10.0" prefWidth="422.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="181.0" minWidth="10.0" prefWidth="65.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="41.0" prefWidth="428.0" GridPane.columnIndex="1">
<center>
<Separator prefHeight="2.0" prefWidth="446.0" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children>
</GridPane>
<GridPane prefHeight="7.0" prefWidth="558.0" GridPane.rowIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="291.0" minWidth="10.0" prefWidth="269.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="180.0" minWidth="10.0" prefWidth="103.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="20.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
<top>
<Label text="Station Fingerprit:" BorderPane.alignment="CENTER" />
</top>
</BorderPane>
</children>
</GridPane>
</children>
</GridPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<center>
<GridPane BorderPane.alignment="CENTER">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="280.0" minWidth="10.0" prefWidth="32.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="497.0" minWidth="10.0" prefWidth="497.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="429.0" minWidth="10.0" prefWidth="32.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="25.0" minHeight="8.0" prefHeight="8.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="72.0" minHeight="10.0" prefHeight="72.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="24.0" minHeight="9.0" prefHeight="10.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" style="-fx-background-color: #a9a9a9;" GridPane.columnIndex="1" GridPane.rowIndex="1">
<center>
<Label prefHeight="36.0" prefWidth="486.0" style="-fx-background-color: #a9a9a9;" text="43:51:43:a1:b5:fc:8b:b7:0a:3a:a9:b1:0f:66:73:a8" BorderPane.alignment="CENTER">
<font>
<Font size="24.0" />
</font></Label>
</center>
</BorderPane>
</children>
</GridPane>
</center>
</BorderPane>
<GridPane GridPane.rowIndex="2">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="183.0" minWidth="10.0" prefWidth="161.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="340.0" minWidth="10.0" prefWidth="246.0" />
<ColumnConstraints hgrow="SOMETIMES" maxWidth="179.0" minWidth="10.0" prefWidth="151.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="54.0" minHeight="10.0" prefHeight="28.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="89.0" minHeight="10.0" prefHeight="89.0" vgrow="SOMETIMES" />
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
<top>
<Label text="Waiting for Verification" BorderPane.alignment="CENTER" />
</top>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1" GridPane.rowIndex="1">
<top>
<ImageView fx:id="LoadingGif" BorderPane.alignment="CENTER">
<image>
<Image url="@../gifs/VerticalLoading.gif" />
</image>
</ImageView>
</top>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="2">
<center>
<Button mnemonicParsing="false" text="Override" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children>
</GridPane>
</children>
</GridPane>
</children>
</AnchorPane>
</children>
</GridPane>

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -15,7 +15,8 @@ import java.util.concurrent.ThreadFactory;
public class Main extends Application {
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "fxmls/spalsh_screen_on_boot.fxml";
private static final String SPALSH_SCREEN_ON_BOOT_FXML_PATH = "../fxmls/spalsh_screen_on_boot.fxml";
private static final String FXMLS_DIRECTORY_PATH = "../fxmls/";
private List<String> listFilesForFolder(File folder) {
List<String> filesNames = new ArrayList<>();
@ -28,7 +29,7 @@ public class Main extends Application {
}
private List<String> getNamesOfAllFxmls() throws IOException {
String fxmlsFolderPath = getClass().getResource("fxmls/").getPath().replace("%20", " ");
String fxmlsFolderPath = getClass().getResource(FXMLS_DIRECTORY_PATH).getPath().replace("%20", " ");
List<String> filesNames = listFilesForFolder(new File(fxmlsFolderPath));
return filesNames;
}
@ -38,7 +39,7 @@ public class Main extends Application {
private void loadAllFxmls() throws IOException, InterruptedException {
Boards = new ArrayList<>();
for (String filename : getNamesOfAllFxmls()) {
Boards.add(FXMLLoader.load(getClass().getResource("fxmls/" + filename)));
Boards.add(FXMLLoader.load(getClass().getResource(FXMLS_DIRECTORY_PATH + filename)));
}
}
@ -58,8 +59,9 @@ public class Main extends Application {
@Override
public void start(Stage primaryStage) throws Exception{
Parent root = loadStartingPanel(primaryStage);
System.out.println(0);
loadAllFxmls();
removeLoadingGif(root);
//removeLoadingGif(root);
}
public static void main(String[] args) throws InterruptedException {