Added the add voter panel to the PSD

The ad voter panel gives the ability to add new voter
voting-station-gui
Vladimir ELazar Tokarev 2016-06-18 13:17:46 +03:00
parent 3766478ffa
commit 9825b3409b
9 changed files with 75 additions and 23 deletions

View File

@ -25,7 +25,7 @@
<children> <children>
<BorderPane prefHeight="102.0" prefWidth="714.0"> <BorderPane prefHeight="102.0" prefWidth="714.0">
<right> <right>
<Button mnemonicParsing="false" onMousePressed="#SearchTrigered" prefHeight="50.0" prefWidth="112.0" text="Search" BorderPane.alignment="CENTER" /> <Button fx:id="SearchButton" mnemonicParsing="false" onMousePressed="#SearchTrigered" prefHeight="50.0" prefWidth="112.0" text="Search" BorderPane.alignment="CENTER" />
</right> </right>
<bottom> <bottom>
<Separator prefWidth="200.0" BorderPane.alignment="CENTER" /> <Separator prefWidth="200.0" BorderPane.alignment="CENTER" />
@ -67,16 +67,17 @@
<Separator orientation="VERTICAL" prefHeight="200.0" BorderPane.alignment="CENTER" /> <Separator orientation="VERTICAL" prefHeight="200.0" BorderPane.alignment="CENTER" />
</right> </right>
</BorderPane> </BorderPane>
<Pane fx:id="StatusLog" onMousePressed="#OnStatusLogPressed" layoutX="788.0" layoutY="12.0" prefHeight="544.0" prefWidth="42.0"> <Pane fx:id="StatusLog" layoutX="788.0" layoutY="12.0" onMousePressed="#OnStatusLogPressed" prefHeight="544.0" prefWidth="42.0">
<children> <children>
<Button fx:id="StatusLogButton" layoutX="-251.0" layoutY="250.0" mnemonicParsing="false" onMousePressed="#OnStatusLogPressed" prefHeight="43.0" prefWidth="545.0" rotate="-90.0" text="Status Log" /> <Button fx:id="StatusLogButton" layoutX="-251.0" layoutY="250.0" mnemonicParsing="false" onMousePressed="#OnStatusLogPressed" prefHeight="43.0" prefWidth="545.0" rotate="-90.0" text="Status Log" />
</children> </children>
</Pane> </Pane>
<Pane fx:id="Settings" onMousePressed="#OnSettingsPressed" layoutX="20" layoutY="557.0" prefHeight="34.0" prefWidth="830.0"> <Pane fx:id="Settings" layoutX="20" layoutY="557.0" onMousePressed="#OnSettingsPressed" prefHeight="34.0" prefWidth="830.0">
<children> <children>
<Button fx:id="SettingsButton" mnemonicParsing="false" onMousePressed="#OnSettingsPressed" prefHeight="34.0" prefWidth="790.0" text="Settings" /> <Button fx:id="SettingsButton" mnemonicParsing="false" onMousePressed="#OnSettingsPressed" prefHeight="34.0" prefWidth="790.0" text="Settings" />
</children> </children>
</Pane> </Pane>
<Pane fx:id="AddEditPane" layoutX="17.0" layoutY="120.0" prefHeight="428.0" prefWidth="749.0" />
</children> </children>
</AnchorPane> </AnchorPane>
</children> </children>

View File

@ -1,6 +1,8 @@
package polling_station_dashboard.java; package polling_station_dashboard.java;
import javafx.stage.Stage; import javafx.stage.Stage;
import polling_station_dashboard.search.SearchHandler;
import polling_station_dashboard.search.addVoter.java.AddVoterLoader;
import polling_station_dashboard.settings.java.SettingsVisualUpdater; import polling_station_dashboard.settings.java.SettingsVisualUpdater;
import polling_station_dashboard.settings.java.settingsLoader; import polling_station_dashboard.settings.java.settingsLoader;
import polling_station_dashboard.statusLog.java.StatusLogLoader; import polling_station_dashboard.statusLog.java.StatusLogLoader;
@ -34,6 +36,10 @@ public class EventHandlerMapper {
new StatusLogVisualUpdater(statusLogLoader.GetStatusLogInstance(), primaryStage); new StatusLogVisualUpdater(statusLogLoader.GetStatusLogInstance(), primaryStage);
map.Add("StatusLogButton", statusLogVisualUpdater); map.Add("StatusLogButton", statusLogVisualUpdater);
map.Add("StatusLog", statusLogVisualUpdater); map.Add("StatusLog", statusLogVisualUpdater);
// map add voter to search button triggered
SearchHandler searchHandler = new SearchHandler(primaryStage);
map.Add("SearchButton", searchHandler);
return map; return map;
} }

View File

@ -2,19 +2,37 @@ package polling_station_dashboard.search;
import javafx.event.Event; import javafx.event.Event;
import javafx.event.EventHandler; import javafx.event.EventHandler;
import javafx.stage.Stage;
import polling_station_dashboard.search.VotersFetcher.VotersFetcher;
import polling_station_dashboard.search.addVoter.java.AddVoterLoader;
import java.io.IOException;
import java.util.List;
/** /**
* Created by Vladimir Eliezer Tokarev on 12/06/2016. * Created by Vladimir Eliezer Tokarev on 12/06/2016.
* SearchHandler trying to fetch wanted users by given strings (VotersFetcher) and then * SearchHandler trying to fetch wanted users by given strings (VotersFetcher) and then
* Starts the eddit/add panel based on what the VotersFetcher Have fetched. * Starts the eddit/add panel based on what the VotersFetcher Have fetched.
*/ */
public class SearchHandler implements EventHandler { public class SearchHandler implements EventHandler, VotersFetcher {
private Stage currentStage;
public SearchHandler(Stage primaryStage){
this.currentStage = primaryStage;
}
@Override @Override
public void handle(Event event) { public void handle(Event event) {
try {
AddVoterLoader addVoterLoader = new AddVoterLoader(currentStage);
} catch (IOException e) {
e.printStackTrace();
}
}
@Override
public Object FetchVoters(List<String> filters) {
return null;
} }
} }

View File

@ -8,5 +8,5 @@ import java.util.List;
*/ */
public interface VotersFetcher { public interface VotersFetcher {
Object FectchVoters(List<String> filters); Object FetchVoters(List<String> filters);
} }

View File

@ -7,7 +7,7 @@
<?import java.lang.*?> <?import java.lang.*?>
<?import javafx.scene.layout.*?> <?import javafx.scene.layout.*?>
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="250.0" prefWidth="783.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8"> <GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="250.0" prefWidth="753.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1">
<columnConstraints> <columnConstraints>
<ColumnConstraints /> <ColumnConstraints />
<ColumnConstraints /> <ColumnConstraints />
@ -90,7 +90,11 @@
<ComboBox prefWidth="150.0" promptText="No" GridPane.columnIndex="1" GridPane.rowIndex="1" /> <ComboBox prefWidth="150.0" promptText="No" GridPane.columnIndex="1" GridPane.rowIndex="1" />
<ComboBox prefWidth="150.0" promptText="Provisional" GridPane.columnIndex="1" GridPane.rowIndex="2" /> <ComboBox prefWidth="150.0" promptText="Provisional" GridPane.columnIndex="1" GridPane.rowIndex="2" />
<ComboBox prefWidth="150.0" promptText="IDC Maths" GridPane.columnIndex="1" GridPane.rowIndex="3" /> <ComboBox prefWidth="150.0" promptText="IDC Maths" GridPane.columnIndex="1" GridPane.rowIndex="3" />
<TextArea prefHeight="200.0" prefWidth="200.0" text="42342342" GridPane.columnIndex="1" /> <BorderPane minHeight="40.0" prefHeight="40.0" prefWidth="200.0" GridPane.columnIndex="1">
<center>
<TextField text="434575845" BorderPane.alignment="CENTER" />
</center>
</BorderPane>
</children> </children>
</GridPane> </GridPane>
</children> </children>
@ -99,7 +103,7 @@
<center> <center>
<ImageView BorderPane.alignment="CENTER"> <ImageView BorderPane.alignment="CENTER">
<image> <image>
<Image url="@../../../pictures/profile.png" /> <Image url="@../../../../pictures/profile.png" />
</image> </image>
</ImageView> </ImageView>
</center> </center>

View File

@ -0,0 +1,7 @@
package polling_station_dashboard.search.addVoter.java;
/**
* Created by Vladimir Eliezer Tokarev on 11/06/2016.
*/
public class AddVoterController {
}

View File

@ -0,0 +1,30 @@
package polling_station_dashboard.search.addVoter.java;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;
import java.io.IOException;
/**
* Created by Vladimir Eliezer Tokarev on 11/06/2016.
* This class loads the add voter panel (which adds voters)
*/
public class AddVoterLoader {
private static final String POLLING_STATION_DASHBOARD_FXML_PATH = "../fxml/add_voter.fxml";
private Stage currentStage;
public AddVoterLoader (Stage primaryStage) throws IOException
{
currentStage = primaryStage;
FXMLLoader fxmlLoader = new FXMLLoader(getClass().getResource(POLLING_STATION_DASHBOARD_FXML_PATH));
Parent root = fxmlLoader.load();
AddVoterController controller = fxmlLoader.getController();
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
addEditPane.getChildren().add(root);
}
}

View File

@ -1,7 +0,0 @@
package polling_station_dashboard.search.votersEdit.java;
/**
* Created by Vladimir Eliezer Tokarev on 11/06/2016.
*/
public class VoterEditController {
}

View File

@ -1,7 +0,0 @@
package polling_station_dashboard.search.votersEdit.java;
/**
* Created by Vladimir Eliezer Tokarev on 11/06/2016.
*/
public class VoterEditLoader {
}