Fixed the status log panel bug

The issue was the name of the panel not in capital latter
voting-station-gui
Vladimir Eliezer Tokarev 2016-07-02 16:11:22 +03:00
parent dab9ca1ed1
commit 8ac466e73a
3 changed files with 13 additions and 5 deletions

View File

@ -5,6 +5,8 @@ import javafx.event.EventHandler;
import javafx.scene.Parent; import javafx.scene.Parent;
import java.util.HashMap; import java.util.HashMap;
// TODO: add logging to the process
/** /**
* Created by Vladimir Eliezer Tokarev on 12/06/2016. * Created by Vladimir Eliezer Tokarev on 12/06/2016.
* EventHandlerMap maps events ids (that are part of polling station dashboard) * EventHandlerMap maps events ids (that are part of polling station dashboard)
@ -27,6 +29,12 @@ public class EventHandlerMap {
public void Handle(Event event) public void Handle(Event event)
{ {
try {
this.eventIdToHandler.get(((Parent) event.getSource()).getId()).handle(event); this.eventIdToHandler.get(((Parent) event.getSource()).getId()).handle(event);
} }
catch (RuntimeException e) {
System.out.println("The event map doesn't have this kind of event handler : " + e);
throw e;
}
}
} }

View File

@ -35,7 +35,7 @@ public class EventHandlerMapper {
StatusLogVisualUpdater statusLogVisualUpdater = StatusLogVisualUpdater statusLogVisualUpdater =
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 // map add voter to search button triggered
SearchHandler searchHandler = new SearchHandler(primaryStage, new DummyVotersFetcher()); SearchHandler searchHandler = new SearchHandler(primaryStage, new DummyVotersFetcher());

View File

@ -45,18 +45,18 @@ public class StatusLogVisualUpdater implements EventHandler {
} }
private void addStatusLog() { private void addStatusLog() {
Pane statusLog = (Pane) currentStage.getScene().lookup("#statusLog"); Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
statusLog.getChildren().add(this.statusLog); statusLog.getChildren().add(this.statusLog);
} }
private void removeStatusLog(){ private void removeStatusLog(){
Pane statusLog = (Pane) currentStage.getScene().lookup("#statusLog"); Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
statusLog.getChildren().remove(this.statusLog); statusLog.getChildren().remove(this.statusLog);
} }
private void SetStatusLogSize(int expansionWidth) { private void SetStatusLogSize(int expansionWidth) {
currentStage.setWidth(currentStage.getWidth() + expansionWidth); currentStage.setWidth(currentStage.getWidth() + expansionWidth);
Pane statusLog = (Pane) currentStage.getScene().lookup("#statusLog"); Pane statusLog = (Pane) currentStage.getScene().lookup("#StatusLog");
statusLog.setPrefWidth(expansionWidth); statusLog.setPrefWidth(expansionWidth);
} }