The exchange of regular search to advanced is done
Created the advanced search now when the ! is pressed the advanced search takes place of the regular search.voting-station-gui
parent
b644f8b500
commit
35c90882c0
|
@ -2,6 +2,8 @@ package polling_station_dashboard;
|
||||||
|
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import polling_station_dashboard.search.SearchHandler;
|
import polling_station_dashboard.search.SearchHandler;
|
||||||
|
import polling_station_dashboard.search.advancedSearch.AdvancedSearchHandler;
|
||||||
|
import polling_station_dashboard.search.advancedSearch.AdvancedSearchLoader;
|
||||||
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealLoader;
|
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealLoader;
|
||||||
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealVisualUpdater;
|
import polling_station_dashboard.search.submitVoter.lodgeAppeal.LodgeAppealVisualUpdater;
|
||||||
import polling_station_dashboard.search.votersFetcher.DummyVotersFetcher;
|
import polling_station_dashboard.search.votersFetcher.DummyVotersFetcher;
|
||||||
|
@ -39,6 +41,12 @@ public class EventHandlerMapper {
|
||||||
map.Add("StatusLogButton", statusLogVisualUpdater);
|
map.Add("StatusLogButton", statusLogVisualUpdater);
|
||||||
map.Add("StatusLog", statusLogVisualUpdater);
|
map.Add("StatusLog", statusLogVisualUpdater);
|
||||||
|
|
||||||
|
// map advanced search object to its handler
|
||||||
|
AdvancedSearchLoader advancedSearchLoader = new AdvancedSearchLoader(primaryStage);
|
||||||
|
AdvancedSearchHandler advancedSearchHandler = new AdvancedSearchHandler(
|
||||||
|
advancedSearchLoader.GetSettingsInstance(), primaryStage);
|
||||||
|
map.Add("ExpandAdvanceSearch", advancedSearchHandler);
|
||||||
|
|
||||||
// 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());
|
||||||
map.Add("SearchButton", searchHandler);
|
map.Add("SearchButton", searchHandler);
|
||||||
|
|
|
@ -1,9 +1,26 @@
|
||||||
package polling_station_dashboard.search.advancedSearch;
|
package polling_station_dashboard.search.advancedSearch;
|
||||||
|
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by dasha on 7/9/2016.
|
* Created by dasha on 7/9/2016.
|
||||||
* AdvancedSearchController controls the behavior of the adnvaced search panel
|
* AdvancedSearchController controls the behavior of the adnvaced search panel
|
||||||
* for example searching by tag type
|
* for example searching by tag type
|
||||||
*/
|
*/
|
||||||
public class AdvancedSearchController {
|
public class AdvancedSearchController {
|
||||||
|
|
||||||
|
private Stage currentStage;
|
||||||
|
|
||||||
|
private GridPane regularSearch;
|
||||||
|
|
||||||
|
public void SetStage(Stage stage){
|
||||||
|
this.currentStage = stage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetRegulartSearch(GridPane regularSearch) { this.regularSearch = regularSearch; }
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void AdvancedSearch(){}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,10 @@ package polling_station_dashboard.search.advancedSearch;
|
||||||
|
|
||||||
import javafx.event.Event;
|
import javafx.event.Event;
|
||||||
import javafx.event.EventHandler;
|
import javafx.event.EventHandler;
|
||||||
|
import javafx.scene.layout.BorderPane;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.scene.layout.Pane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by dasha on 7/9/2016.
|
* Created by dasha on 7/9/2016.
|
||||||
|
@ -9,8 +13,33 @@ import javafx.event.EventHandler;
|
||||||
*/
|
*/
|
||||||
public class AdvancedSearchHandler implements EventHandler {
|
public class AdvancedSearchHandler implements EventHandler {
|
||||||
|
|
||||||
|
private GridPane advancedSearch;
|
||||||
|
private Stage currentStage;
|
||||||
|
|
||||||
|
public AdvancedSearchHandler(GridPane advancedSearch, Stage primalStage)
|
||||||
|
{
|
||||||
|
this.advancedSearch = advancedSearch;
|
||||||
|
this.currentStage = primalStage;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void UpdateAdvancedSearch() {
|
||||||
|
RemoveRegularSearch();
|
||||||
|
AddAdvancedSearch();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void AddAdvancedSearch() {
|
||||||
|
Pane searchContainer = (Pane) currentStage.getScene().lookup("#SearchContainer");
|
||||||
|
searchContainer.getChildren().add(advancedSearch);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void RemoveRegularSearch() {
|
||||||
|
// the only element that is in this container is the regular search
|
||||||
|
Pane searchContainer = (Pane) currentStage.getScene().lookup("#SearchContainer");
|
||||||
|
searchContainer.getChildren().remove(0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void handle(Event event) {
|
public void handle(Event event) {
|
||||||
|
UpdateAdvancedSearch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,33 @@
|
||||||
package polling_station_dashboard.search.advancedSearch;
|
package polling_station_dashboard.search.advancedSearch;
|
||||||
|
|
||||||
|
import javafx.fxml.FXMLLoader;
|
||||||
|
import javafx.scene.layout.GridPane;
|
||||||
|
import javafx.stage.Stage;
|
||||||
|
import polling_station_dashboard.settings.settingsController;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by dasha on 7/9/2016.
|
* Created by dasha on 7/9/2016.
|
||||||
* AdvancedSearchLoader loads the advanced search panel
|
* AdvancedSearchLoader loads the advanced search panel
|
||||||
*/
|
*/
|
||||||
public class AdvancedSearchLoader {
|
public class AdvancedSearchLoader {
|
||||||
|
private static final String ADVANCED_SEARCH_FXML_PATH = "/view/dashboard/advanced_search.fxml";
|
||||||
|
|
||||||
|
private Stage currentStage;
|
||||||
|
private FXMLLoader fxmlLoader;
|
||||||
|
|
||||||
|
public AdvancedSearchLoader(Stage primaryStage) throws IOException
|
||||||
|
{
|
||||||
|
currentStage = primaryStage;
|
||||||
|
fxmlLoader = new FXMLLoader(getClass().getResource(ADVANCED_SEARCH_FXML_PATH));
|
||||||
|
}
|
||||||
|
|
||||||
|
public GridPane GetSettingsInstance() throws IOException {
|
||||||
|
GridPane settings = fxmlLoader.load();
|
||||||
|
AdvancedSearchController controller = fxmlLoader.getController();
|
||||||
|
controller.SetStage(currentStage);
|
||||||
|
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<?import java.lang.*?>
|
<?import java.lang.*?>
|
||||||
<?import javafx.scene.layout.*?>
|
<?import javafx.scene.layout.*?>
|
||||||
|
|
||||||
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="99.0" prefWidth="714.0" xmlns:fx="http://javafx.com/fxml/1" xmlns="http://javafx.com/javafx/8">
|
<GridPane maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="99.0" prefWidth="714.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="polling_station_dashboard.search.advancedSearch.AdvancedSearchController">
|
||||||
<columnConstraints>
|
<columnConstraints>
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="176.0" minWidth="10.0" prefWidth="107.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="176.0" minWidth="10.0" prefWidth="107.0" />
|
||||||
<ColumnConstraints hgrow="SOMETIMES" maxWidth="498.0" minWidth="10.0" prefWidth="414.0" />
|
<ColumnConstraints hgrow="SOMETIMES" maxWidth="498.0" minWidth="10.0" prefWidth="414.0" />
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="1">
|
||||||
<center>
|
<center>
|
||||||
<TextField prefHeight="47.0" prefWidth="417.0" BorderPane.alignment="CENTER" />
|
<TextField prefHeight="47.0" prefWidth="417.0" text="name or ID number" BorderPane.alignment="CENTER" />
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
<BorderPane prefHeight="200.0" prefWidth="200.0" GridPane.columnIndex="2">
|
||||||
|
|
|
@ -29,7 +29,9 @@
|
||||||
<Separator prefWidth="200.0" BorderPane.alignment="CENTER" />
|
<Separator prefWidth="200.0" BorderPane.alignment="CENTER" />
|
||||||
</bottom>
|
</bottom>
|
||||||
<center>
|
<center>
|
||||||
<BorderPane fx:id="SearchContainer" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
<Pane fx:id="SearchContainer" prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
|
||||||
|
<children>
|
||||||
|
<BorderPane prefHeight="102.0" prefWidth="714.0">
|
||||||
<center>
|
<center>
|
||||||
<TextField fx:id="SearchValue" prefHeight="56.0" prefWidth="479.0" text="IDNumber: 123123123, FilterName2: value2 ..." BorderPane.alignment="CENTER" />
|
<TextField fx:id="SearchValue" prefHeight="56.0" prefWidth="479.0" text="IDNumber: 123123123, FilterName2: value2 ..." BorderPane.alignment="CENTER" />
|
||||||
</center>
|
</center>
|
||||||
|
@ -44,6 +46,8 @@
|
||||||
<Button fx:id="SearchButton" mnemonicParsing="false" onMousePressed="#SearchTrigered" prefHeight="50.0" prefWidth="112.0" text="Search" BorderPane.alignment="CENTER" />
|
<Button fx:id="SearchButton" mnemonicParsing="false" onMousePressed="#SearchTrigered" prefHeight="50.0" prefWidth="112.0" text="Search" BorderPane.alignment="CENTER" />
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
|
</children>
|
||||||
|
</Pane>
|
||||||
</center>
|
</center>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
</children>
|
</children>
|
||||||
|
@ -83,7 +87,7 @@
|
||||||
</children>
|
</children>
|
||||||
</Pane>
|
</Pane>
|
||||||
<Pane fx:id="AddEditPane" layoutX="17.0" layoutY="120.0" prefHeight="428.0" prefWidth="749.0" />
|
<Pane fx:id="AddEditPane" layoutX="17.0" layoutY="120.0" prefHeight="428.0" prefWidth="749.0" />
|
||||||
<Label layoutX="746.0" layoutY="24.0" onMousePressed="#ExpandAdvanceSearch" text="!">
|
<Label fx:id="ExpandAdvanceSearch" layoutX="746.0" layoutY="24.0" onMousePressed="#ExpandAdvanceSearch" text="!">
|
||||||
<font>
|
<font>
|
||||||
<Font size="55.0" />
|
<Font size="55.0" />
|
||||||
</font>
|
</font>
|
||||||
|
|
Loading…
Reference in New Issue