Created lodge appeal visual updater
Lodge Appeal Visual Updter adds and removes lodge appeal pannel from and to the polling station dashboard.voting-station-gui
parent
43af4b016d
commit
ff4ad81cca
|
@ -2,6 +2,8 @@ package polling_station_dashboard;
|
|||
|
||||
import javafx.stage.Stage;
|
||||
import polling_station_dashboard.search.SearchHandler;
|
||||
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealLoader;
|
||||
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealVisualUpdater;
|
||||
import polling_station_dashboard.search.votersFetcher.DummyVotersFetcher;
|
||||
import polling_station_dashboard.settings.SettingsVisualUpdater;
|
||||
import polling_station_dashboard.settings.settingsLoader;
|
||||
|
@ -23,20 +25,26 @@ public class EventHandlerMapper {
|
|||
{
|
||||
EventHandlerMap map = new EventHandlerMap();
|
||||
|
||||
// Map status log objects to settings visual updater
|
||||
// maps status log object to settings visual updater
|
||||
settingsLoader settingsLoader = new settingsLoader(primaryStage);
|
||||
SettingsVisualUpdater settingsVisualUpdater =
|
||||
new SettingsVisualUpdater(settingsLoader.GetSettingsInstance(), primaryStage);
|
||||
map.Add("SettingsButton", settingsVisualUpdater);
|
||||
map.Add("Settings", settingsVisualUpdater);
|
||||
|
||||
// map settings objects to status log visual updater
|
||||
// maps settings object to status log visual updater
|
||||
StatusLogLoader statusLogLoader = new StatusLogLoader(primaryStage);
|
||||
StatusLogVisualUpdater statusLogVisualUpdater =
|
||||
new StatusLogVisualUpdater(statusLogLoader.GetStatusLogInstance(), primaryStage);
|
||||
map.Add("StatusLogButton", 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
|
||||
SearchHandler searchHandler = new SearchHandler(primaryStage, new DummyVotersFetcher());
|
||||
map.Add("SearchButton", searchHandler);
|
||||
|
|
|
@ -0,0 +1,44 @@
|
|||
package polling_station_dashboard.search.submitVoter.lodgeAppeal;
|
||||
|
||||
import javafx.event.Event;
|
||||
import javafx.event.EventHandler;
|
||||
import javafx.scene.layout.GridPane;
|
||||
import javafx.scene.layout.Pane;
|
||||
import javafx.stage.Stage;
|
||||
|
||||
/**
|
||||
* Created by dasha on 7/2/2016.
|
||||
* LodgeAppealVisualUpdater is in response of add and remove the lodge appeal panel
|
||||
* to polling station dashboard
|
||||
*/
|
||||
public class LodgeAppealVisualUpdater implements EventHandler {
|
||||
|
||||
private Stage currentStage;
|
||||
private GridPane lodgeAppeal;
|
||||
private boolean lodgeAppealOpened = false;
|
||||
|
||||
public LodgeAppealVisualUpdater(GridPane lodgeAppeal, Stage primalStage)
|
||||
{
|
||||
this.lodgeAppeal = lodgeAppeal;
|
||||
this.currentStage = primalStage;
|
||||
}
|
||||
|
||||
private void UpdateLodgeAppeal() {
|
||||
if (!lodgeAppealOpened) {
|
||||
addLodgeAppeal();
|
||||
}
|
||||
else {
|
||||
}
|
||||
lodgeAppealOpened = !lodgeAppealOpened;
|
||||
}
|
||||
|
||||
private void addLodgeAppeal() {
|
||||
Pane addEditPane = (Pane)currentStage.getScene().lookup("#AddEditPane");
|
||||
addEditPane.getChildren().add(lodgeAppeal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(Event event) {
|
||||
UpdateLodgeAppeal();
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue