Class FilterDialogController
java.lang.Object
gov.llnl.gnem.apps.coda.calibration.gui.controllers.FilterDialogController
This is a front end GUI controller used to display and manage the filter
dialog that users will see when filtering table views. Used as a helper class
for the DataFilterController, it handles the display and actions of the
filter dialog.
- Author:
- downie4
- See Also:
-
DataFilterController
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected javafx.scene.control.RadioButton
protected javafx.scene.control.Button
protected javafx.scene.layout.GridPane
protected javafx.scene.control.Button
protected javafx.scene.control.RadioButton
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> void
addCustomRangeFilter
(String filterName, Map<String, Function<T, Double>> valuesFunctions, gov.llnl.gnem.apps.coda.calibration.gui.controllers.PredicateBuilder<T> predicateBuilder) void
addFilterOption
(String columnName, javafx.collections.ObservableList<Object> items, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onComboSelection, javafx.beans.value.ChangeListener<? super Object> onComboValueChange) Adds a filter field to the filter dialog so that users can filter the specified column.void
addFilterSlider
(String columnName, javafx.collections.ObservableList<Object> values, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onSliderSelection, javafx.beans.value.ChangeListener<? super Object> onSliderValueChange) Adds a filter field to the filter dialog so that users can filter the specified column.void
addFilterSlider
(javafx.scene.control.Slider customSlider, String columnName, javafx.collections.ObservableList<Object> values, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onSliderSelection, Consumer<String> sliderValueChangeAction) Adds a filter field to the filter dialog so that users can filter the specified column.void
This will clear all the filter drop downs and deselect the filter fields in the filter dialog.void
deactivateFields
(List<javafx.scene.control.Control> fields) Convenience method that will deactivate all the filter fields in the specified list.<T> Predicate<T>
getCustomPredicate
(Double selectedValue, Function<T, Double> valueFunction, String operation) void
hide()
Hides the Filter Dialog GUI.void
initModality
(javafx.stage.Modality modality) Gives the option of what modality to use when starting up the filter dialog.void
setAlwaysOnTop
(boolean onTop) void
setClearFiltersAction
(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler) Sets the handler for when the user cancels/clears the filter dialog.void
setFieldActiveState
(String columnName, boolean active) This will activate/deactivate a filter field and update the checkbox in the GUI to show whether the filter field is active.void
setFilterAction
(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler) Sets a handler for when the user clicks the 'Filter' button in the dialog.void
show()
Shows the Filter Dialog GUI, for example when a filter dialog button is clicked.void
toFront()
Show the Filter Dialog above other windows.void
updateSliders
(int sliderIdx, javafx.collections.ObservableList<Object> values) Updates the specified slider values that the user can select.boolean
-
Field Details
-
clearFiltersBtn
protected javafx.scene.control.Button clearFiltersBtn -
filterBtn
protected javafx.scene.control.Button filterBtn -
andOption
protected javafx.scene.control.RadioButton andOption -
orOption
protected javafx.scene.control.RadioButton orOption -
fieldRowGrid
protected javafx.scene.layout.GridPane fieldRowGrid
-
-
Constructor Details
-
FilterDialogController
public FilterDialogController()Instantiate the FilterDialogController.
-
-
Method Details
-
useAndPredicate
public boolean useAndPredicate()- Returns:
- True if the user has selected the 'And' filter in the GUI, otherwise false.
-
setFilterAction
public void setFilterAction(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler) Sets a handler for when the user clicks the 'Filter' button in the dialog.- Parameters:
eventHandler
- The event handler.
-
setClearFiltersAction
public void setClearFiltersAction(javafx.event.EventHandler<javafx.event.ActionEvent> eventHandler) Sets the handler for when the user cancels/clears the filter dialog.- Parameters:
eventHandler
- The event handler.
-
clearControlSelections
public void clearControlSelections()This will clear all the filter drop downs and deselect the filter fields in the filter dialog. -
setFieldActiveState
This will activate/deactivate a filter field and update the checkbox in the GUI to show whether the filter field is active.- Parameters:
columnName
- The string name of the column filter which should be activated/deactivated.active
- Set to true if the column filter should be active, false otherwise.
-
deactivateFields
Convenience method that will deactivate all the filter fields in the specified list.- Parameters:
fields
- The list of filter controls to deactivate.
-
addFilterOption
public void addFilterOption(String columnName, javafx.collections.ObservableList<Object> items, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onComboSelection, javafx.beans.value.ChangeListener<? super Object> onComboValueChange) Adds a filter field to the filter dialog so that users can filter the specified column. Creates a combo box to add to the filter dialog with the specified list items.- Parameters:
columnName
- The string name of the column which should be filtereditems
- An Observable list of valid items that can be selected for by the combo box.toggleGroup
- The toggle group to assign this filter to in the case where only one filter in the toggle group should be active at a time. If null, then it can be toggled active all the time.onComboSelection
- The action to perform when a selection is made on the filter combo.onComboValueChange
- The action to perform.
-
addFilterSlider
public void addFilterSlider(String columnName, javafx.collections.ObservableList<Object> values, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onSliderSelection, javafx.beans.value.ChangeListener<? super Object> onSliderValueChange) Adds a filter field to the filter dialog so that users can filter the specified column. Creates a slider controller to add to the filter dialog with the specified valid values. The slider is helpful for numerical lists.- Parameters:
columnName
- The string name of the column which should be filtered.values
- An Observable list of valid values that can be selected for by the slider.toggleGroup
- The toggle group to assign this filter to in the case where only one filter in the toggle group should be active at a time. If null, then it can be toggled active all the time.onSliderSelection
- The action to perform when a selection is made on the filter slider.onSliderValueChange
- The action to perform
-
addFilterSlider
public void addFilterSlider(javafx.scene.control.Slider customSlider, String columnName, javafx.collections.ObservableList<Object> values, javafx.scene.control.ToggleGroup toggleGroup, javafx.beans.value.ChangeListener<? super Boolean> onSliderSelection, Consumer<String> sliderValueChangeAction) Adds a filter field to the filter dialog so that users can filter the specified column. Creates a slider controller to add to the filter dialog with the specified valid values. The slider is helpful for numerical lists.- Parameters:
columnName
- The string name of the column which should be filtered.values
- An Observable list of valid values that can be selected for by the slider.toggleGroup
- The toggle group to assign this filter to in the case where only one filter in the toggle group should be active at a time. If null, then it can be toggled active all the time.onSliderSelection
- The action to perform when a selection is made on the filter slider.sliderValueChangeAction
- The action to perform when the slider value changes
-
getCustomPredicate
-
addCustomRangeFilter
-
updateSliders
Updates the specified slider values that the user can select.- Parameters:
sliderIdx
- The index of the slider to update.values
- The new values that the slider should display.
-
hide
public void hide()Hides the Filter Dialog GUI. For example when a filter is selected. -
show
public void show()Shows the Filter Dialog GUI, for example when a filter dialog button is clicked. -
initModality
public void initModality(javafx.stage.Modality modality) Gives the option of what modality to use when starting up the filter dialog.- Parameters:
modality
- The modality to use.
-
setAlwaysOnTop
public void setAlwaysOnTop(boolean onTop) -
toFront
public void toFront()Show the Filter Dialog above other windows. *
-