From b64719b1d9c2b9a99ac2cff0891d87924a55fef1 Mon Sep 17 00:00:00 2001 From: Vladimir Eliezer Tokarev Date: Sat, 9 Jul 2016 14:17:13 +0300 Subject: [PATCH] Pressing on the regular search return it Now when in advanced search mode when pressing the regular search label the regular label is being returned --- .../advancedSearch/AdvancedSearchController.java | 16 ++++++++++++---- .../advancedSearch/AdvancedSearchLoader.java | 6 ++++++ .../view/dashboard/advanced_search.fxml | 10 +++++----- 3 files changed, 23 insertions(+), 9 deletions(-) diff --git a/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchController.java b/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchController.java index ea41bad..f87cc95 100644 --- a/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchController.java +++ b/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchController.java @@ -1,7 +1,8 @@ package polling_station_dashboard.search.advancedSearch; import javafx.fxml.FXML; -import javafx.scene.layout.GridPane; +import javafx.scene.layout.BorderPane; +import javafx.scene.layout.Pane; import javafx.stage.Stage; /** @@ -13,14 +14,21 @@ public class AdvancedSearchController { private Stage currentStage; - private GridPane regularSearch; + private BorderPane regularSearch; public void SetStage(Stage stage){ this.currentStage = stage; } - public void SetRegulartSearch(GridPane regularSearch) { this.regularSearch = regularSearch; } + public void SetRegularSearch(BorderPane regularSearch) { this.regularSearch = regularSearch; } @FXML - private void AdvancedSearch(){} + private void RemoveAdvancedSearch(){ + // the only object in this container by now is the advanced search + Pane searchContainer = (Pane) this.currentStage.getScene().lookup("#SearchContainer"); + searchContainer.getChildren().remove(0); + + // after removed the advanced search we need to return the regular one + searchContainer.getChildren().add(this.regularSearch); + } } diff --git a/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchLoader.java b/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchLoader.java index 6a11919..b90b641 100644 --- a/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchLoader.java +++ b/polling-station-gui/src/main/java/polling_station_dashboard/search/advancedSearch/AdvancedSearchLoader.java @@ -1,7 +1,9 @@ package polling_station_dashboard.search.advancedSearch; import javafx.fxml.FXMLLoader; +import javafx.scene.layout.BorderPane; import javafx.scene.layout.GridPane; +import javafx.scene.layout.Pane; import javafx.stage.Stage; import polling_station_dashboard.settings.settingsController; @@ -26,6 +28,10 @@ public class AdvancedSearchLoader { public GridPane GetSettingsInstance() throws IOException { GridPane settings = fxmlLoader.load(); AdvancedSearchController controller = fxmlLoader.getController(); + Pane searchContainer = (Pane) currentStage.getScene().lookup("#SearchContainer"); + BorderPane regularSearch = (BorderPane) searchContainer.getChildren().get(0); + + controller.SetRegularSearch(regularSearch); controller.SetStage(currentStage); return settings; diff --git a/polling-station-gui/src/main/resources/view/dashboard/advanced_search.fxml b/polling-station-gui/src/main/resources/view/dashboard/advanced_search.fxml index 4fced60..2c41e86 100644 --- a/polling-station-gui/src/main/resources/view/dashboard/advanced_search.fxml +++ b/polling-station-gui/src/main/resources/view/dashboard/advanced_search.fxml @@ -34,7 +34,7 @@
- + @@ -50,21 +50,21 @@ - + - + -