diff --git a/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml b/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml
index b870502..2916c59 100644
--- a/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml
+++ b/voting-station-gui/src/polling_station_dashboard/fxml/polling_station_dashboard.fxml
@@ -25,7 +25,7 @@
-
+
@@ -67,16 +67,17 @@
-
+
-
+
+
diff --git a/voting-station-gui/src/polling_station_dashboard/java/EventHandlerMapper.java b/voting-station-gui/src/polling_station_dashboard/java/EventHandlerMapper.java
index 8efdee0..dc0ea24 100644
--- a/voting-station-gui/src/polling_station_dashboard/java/EventHandlerMapper.java
+++ b/voting-station-gui/src/polling_station_dashboard/java/EventHandlerMapper.java
@@ -1,6 +1,8 @@
package polling_station_dashboard.java;
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.settingsLoader;
import polling_station_dashboard.statusLog.java.StatusLogLoader;
@@ -34,6 +36,10 @@ public class EventHandlerMapper {
new StatusLogVisualUpdater(statusLogLoader.GetStatusLogInstance(), primaryStage);
map.Add("StatusLogButton", statusLogVisualUpdater);
map.Add("StatusLog", statusLogVisualUpdater);
+
+ // map add voter to search button triggered
+ SearchHandler searchHandler = new SearchHandler(primaryStage);
+ map.Add("SearchButton", searchHandler);
return map;
}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/SearchHandler.java b/voting-station-gui/src/polling_station_dashboard/search/SearchHandler.java
index 8abf1b9..68e847d 100644
--- a/voting-station-gui/src/polling_station_dashboard/search/SearchHandler.java
+++ b/voting-station-gui/src/polling_station_dashboard/search/SearchHandler.java
@@ -2,19 +2,37 @@ package polling_station_dashboard.search;
import javafx.event.Event;
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.
* SearchHandler trying to fetch wanted users by given strings (VotersFetcher) and then
* 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
public void handle(Event event) {
+ try {
+ AddVoterLoader addVoterLoader = new AddVoterLoader(currentStage);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ @Override
+ public Object FetchVoters(List filters) {
+ return null;
}
}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/VotersFetcher/VotersFetcher.java b/voting-station-gui/src/polling_station_dashboard/search/VotersFetcher/VotersFetcher.java
index 74e9e83..94723ae 100644
--- a/voting-station-gui/src/polling_station_dashboard/search/VotersFetcher/VotersFetcher.java
+++ b/voting-station-gui/src/polling_station_dashboard/search/VotersFetcher/VotersFetcher.java
@@ -8,5 +8,5 @@ import java.util.List;
*/
public interface VotersFetcher {
- Object FectchVoters(List filters);
+ Object FetchVoters(List filters);
}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/fxml/voter_edit.fxml b/voting-station-gui/src/polling_station_dashboard/search/addVoter/fxml/add_voter.fxml
similarity index 95%
rename from voting-station-gui/src/polling_station_dashboard/search/votersEdit/fxml/voter_edit.fxml
rename to voting-station-gui/src/polling_station_dashboard/search/addVoter/fxml/add_voter.fxml
index 4cd7d18..504918c 100644
--- a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/fxml/voter_edit.fxml
+++ b/voting-station-gui/src/polling_station_dashboard/search/addVoter/fxml/add_voter.fxml
@@ -7,7 +7,7 @@
-
+
@@ -90,7 +90,11 @@
-
+
+
+
+
+
@@ -99,7 +103,7 @@
-
+
diff --git a/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterController.java b/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterController.java
new file mode 100644
index 0000000..b7e16cd
--- /dev/null
+++ b/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterController.java
@@ -0,0 +1,7 @@
+package polling_station_dashboard.search.addVoter.java;
+
+/**
+ * Created by Vladimir Eliezer Tokarev on 11/06/2016.
+ */
+public class AddVoterController {
+}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterLoader.java b/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterLoader.java
new file mode 100644
index 0000000..170ef66
--- /dev/null
+++ b/voting-station-gui/src/polling_station_dashboard/search/addVoter/java/AddVoterLoader.java
@@ -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);
+ }
+}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditController.java b/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditController.java
deleted file mode 100644
index 0c0c1bf..0000000
--- a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditController.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package polling_station_dashboard.search.votersEdit.java;
-
-/**
- * Created by Vladimir Eliezer Tokarev on 11/06/2016.
- */
-public class VoterEditController {
-}
diff --git a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditLoader.java b/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditLoader.java
deleted file mode 100644
index c7ce4b0..0000000
--- a/voting-station-gui/src/polling_station_dashboard/search/votersEdit/java/VoterEditLoader.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package polling_station_dashboard.search.votersEdit.java;
-
-/**
- * Created by Vladimir Eliezer Tokarev on 11/06/2016.
- */
-public class VoterEditLoader {
-}