Removed the lodge appeal managment from event handler map
the lodge appeal object is sub flow of the submit voter flow which means that polling station dashboard should not know about its existance.voting-station-gui
parent
c7c6f26db1
commit
1fa38ddb5f
|
@ -34,7 +34,7 @@ public class EventHandlerMap {
|
||||||
}
|
}
|
||||||
catch (RuntimeException e) {
|
catch (RuntimeException e) {
|
||||||
System.out.println("The event map doesn't have this kind of event handler : " + e);
|
System.out.println("The event map doesn't have this kind of event handler : " + e);
|
||||||
throw e;
|
// add logs ...
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,12 +39,6 @@ public class EventHandlerMapper {
|
||||||
map.Add("StatusLogButton", statusLogVisualUpdater);
|
map.Add("StatusLogButton", statusLogVisualUpdater);
|
||||||
map.Add("StatusLog", statusLogVisualUpdater);
|
map.Add("StatusLog", statusLogVisualUpdater);
|
||||||
|
|
||||||
// maps lodge appeal object to lodge appeal visual updater
|
|
||||||
LodgeAppealLoader lodgeAppealLoader = new LodgeAppealLoader(primaryStage);
|
|
||||||
LodgeAppealVisualUpdater lodgeAppealVisualUpdater = new LodgeAppealVisualUpdater(
|
|
||||||
lodgeAppealLoader.GetSettingsInstance(), primaryStage);
|
|
||||||
map.Add("LodgeAppealButton", lodgeAppealVisualUpdater);
|
|
||||||
|
|
||||||
// map add voter to search button triggered
|
// map add voter to search button triggered
|
||||||
SearchHandler searchHandler = new SearchHandler(primaryStage, new DummyVotersFetcher());
|
SearchHandler searchHandler = new SearchHandler(primaryStage, new DummyVotersFetcher());
|
||||||
map.Add("SearchButton", searchHandler);
|
map.Add("SearchButton", searchHandler);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package polling_station_dashboard.search.submitVoter;
|
package polling_station_dashboard.search.submitVoter;
|
||||||
|
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealVisualUpdater;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by Vladimir Eliezer Tokarev on 18/06/2016.
|
* Created by Vladimir Eliezer Tokarev on 18/06/2016.
|
||||||
|
@ -11,12 +13,22 @@ import javafx.stage.Stage;
|
||||||
*/
|
*/
|
||||||
public class SubmitVoterController {
|
public class SubmitVoterController {
|
||||||
private Stage currentStage;
|
private Stage currentStage;
|
||||||
|
private LodgeAppealVisualUpdater lodgeAppealVisualUpdater;
|
||||||
|
|
||||||
public void SetStage(Stage primaryStage)
|
public void SetStage(Stage primaryStage)
|
||||||
{
|
{
|
||||||
this.currentStage = primaryStage;
|
this.currentStage = primaryStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void SetLodgeAppeal(GridPane lodgeAppeal){
|
||||||
|
this.lodgeAppealVisualUpdater = new LodgeAppealVisualUpdater(lodgeAppeal, currentStage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void AddLodgeAppeal(){
|
||||||
|
this.lodgeAppealVisualUpdater.UpdateLodgeAppeal();
|
||||||
|
}
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void RemoveSubmitVoterPanel()
|
private void RemoveSubmitVoterPanel()
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,6 +5,7 @@ import javafx.scene.Parent;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealLoader;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
@ -39,9 +40,13 @@ public class SubmitVoterLoader {
|
||||||
Parent root = this.fxmlLoader.load();
|
Parent root = this.fxmlLoader.load();
|
||||||
ResetVoterParams(voter, root);
|
ResetVoterParams(voter, root);
|
||||||
|
|
||||||
|
LodgeAppealLoader lodgeAppealLoader = new LodgeAppealLoader(currentStage);
|
||||||
|
|
||||||
SubmitVoterController controller = fxmlLoader.getController();
|
SubmitVoterController controller = fxmlLoader.getController();
|
||||||
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
||||||
addEditPane.getChildren().add(root);
|
addEditPane.getChildren().add(root);
|
||||||
|
|
||||||
controller.SetStage(currentStage);
|
controller.SetStage(currentStage);
|
||||||
|
controller.SetLodgeAppeal(lodgeAppealLoader.GetSettingsInstance());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package polling_station_dashboard.search.submitVoter.lodgeAppeal;
|
package polling_station_dashboard.search.submitVoter.lodgeAppeal;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -13,4 +15,12 @@ public class LodgeAppealController {
|
||||||
{
|
{
|
||||||
this.currentStage = primaryStage;
|
this.currentStage = primaryStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void HandleCancel(){
|
||||||
|
Pane addEditPane = (Pane) currentStage.getScene().lookup("#AddEditPane");
|
||||||
|
// the add edit pane have only one child at a time which mean removing the child in index 0 will
|
||||||
|
// clean the add edit pane
|
||||||
|
addEditPane.getChildren().remove(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
package polling_station_dashboard.search.submitVoter.lodgeAppeal;
|
package polling_station_dashboard.search.submitVoter.lodgeAppeal;
|
||||||
|
|
||||||
import javafx.event.Event;
|
|
||||||
import javafx.event.EventHandler;
|
|
||||||
import javafx.scene.layout.GridPane;
|
import javafx.scene.layout.GridPane;
|
||||||
import javafx.scene.layout.Pane;
|
import javafx.scene.layout.Pane;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
|
@ -11,7 +9,7 @@ import javafx.stage.Stage;
|
||||||
* LodgeAppealVisualUpdater is in response of add and remove the lodge appeal panel
|
* LodgeAppealVisualUpdater is in response of add and remove the lodge appeal panel
|
||||||
* to polling station dashboard
|
* to polling station dashboard
|
||||||
*/
|
*/
|
||||||
public class LodgeAppealVisualUpdater implements EventHandler {
|
public class LodgeAppealVisualUpdater {
|
||||||
|
|
||||||
private Stage currentStage;
|
private Stage currentStage;
|
||||||
private GridPane lodgeAppeal;
|
private GridPane lodgeAppeal;
|
||||||
|
@ -23,22 +21,26 @@ public class LodgeAppealVisualUpdater implements EventHandler {
|
||||||
this.currentStage = primalStage;
|
this.currentStage = primalStage;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateLodgeAppeal() {
|
public void UpdateLodgeAppeal() {
|
||||||
if (!lodgeAppealOpened) {
|
if (!lodgeAppealOpened) {
|
||||||
addLodgeAppeal();
|
ClearAddEditPanel();
|
||||||
|
AddLodgeAppeal();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
ClearAddEditPanel();
|
||||||
}
|
}
|
||||||
lodgeAppealOpened = !lodgeAppealOpened;
|
lodgeAppealOpened = !lodgeAppealOpened;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addLodgeAppeal() {
|
private void ClearAddEditPanel(){
|
||||||
|
Pane addEditPane = (Pane) currentStage.getScene().lookup("#AddEditPane");
|
||||||
|
// the add edit pane have only one child at a time which mean removing the child in index 0 will
|
||||||
|
// clean the add edit pane
|
||||||
|
addEditPane.getChildren().remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddLodgeAppeal() {
|
||||||
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
||||||
addEditPane.getChildren().add(lodgeAppeal);
|
addEditPane.getChildren().add(lodgeAppeal);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void handle(Event event) {
|
|
||||||
UpdateLodgeAppeal();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,8 +7,7 @@
|
||||||
<?import javafx.scene.image.*?>
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="500.0" prefWidth="753.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8"
|
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="435.0" prefWidth="753.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealController">
|
||||||
fx:controller="polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealController">
|
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
|
@ -429,7 +428,7 @@
|
||||||
<children>
|
<children>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
<BorderPane prefHeight="200.0" prefWidth="200.0">
|
||||||
<right>
|
<right>
|
||||||
<Button mnemonicParsing="false" prefHeight="37.0" prefWidth="111.0" text="cancel" BorderPane.alignment="CENTER" />
|
<Button mnemonicParsing="false" onMousePressed="#HandleCancel" prefHeight="37.0" prefWidth="111.0" text="cancel" BorderPane.alignment="CENTER" />
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
<!-- Created By Vladimir Eliezer Tokarev !-->
|
<!-- Created By Vladimir Eliezer Tokarev !-->
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.image.*?>
|
<?import javafx.scene.image.*?>
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
@ -37,7 +38,7 @@
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</left>
|
</left>
|
||||||
<center>
|
<center>
|
||||||
<TextField fx:id="SearchValue" prefHeight="56.0" prefWidth="536.0" BorderPane.alignment="CENTER" text="IDNumber: 123123123, FilterName2: value2 ..." />
|
<TextField fx:id="SearchValue" prefHeight="56.0" prefWidth="536.0" text="IDNumber: 123123123, FilterName2: value2 ..." BorderPane.alignment="CENTER" />
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</children>
|
</children>
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
</GridPane>
|
</GridPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="6">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2" GridPane.rowIndex="6">
|
||||||
<top>
|
<top>
|
||||||
<Button mnemonicParsing="false" text="Lodge appeal" BorderPane.alignment="CENTER" />
|
<Button mnemonicParsing="false" onMousePressed="#AddLodgeAppeal" text="Lodge appeal" BorderPane.alignment="CENTER" />
|
||||||
</top>
|
</top>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</children>
|
</children>
|
||||||
|
|
Loading…
Reference in New Issue