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
voting-station-gui
Vladimir Eliezer Tokarev 2016-07-09 14:17:13 +03:00
parent 35c90882c0
commit b64719b1d9
3 changed files with 23 additions and 9 deletions

View File

@ -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);
}
}

View File

@ -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;

View File

@ -34,7 +34,7 @@
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
<center>
<ImageView onTouchPressed="#AdvancedSearch" BorderPane.alignment="CENTER">
<ImageView BorderPane.alignment="CENTER">
<image>
<Image url="@../../images/toolbar_find.png" />
</image>
@ -50,21 +50,21 @@
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<children>
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<BorderPane onMousePressed="#RemoveAdvancedSearch" prefHeight="200.0" prefWidth="200.0" GridPane.rowIndex="1">
<top>
<Label text="search" BorderPane.alignment="CENTER">
<font>
<Font size="17.0" />
</font>
<padding>
<Insets right="25.0" />
<Insets right="5.0" />
</padding>
</Label>
</top>
</BorderPane>
<BorderPane prefHeight="200.0" prefWidth="200.0">
<BorderPane onMousePressed="#RemoveAdvancedSearch" prefHeight="200.0" prefWidth="200.0">
<bottom>
<Label text="Advanced" BorderPane.alignment="CENTER">
<Label text="Regular" BorderPane.alignment="CENTER">
<font>
<Font size="17.0" />
</font>