Class SimpleFilterView
java.lang.Object
javafx.scene.Node
javafx.scene.Parent
javafx.scene.layout.Region
javafx.scene.layout.Pane
javafx.scene.layout.HBox
com.dlsc.gemsfx.SimpleFilterView
- All Implemented Interfaces:
javafx.css.Styleable, javafx.event.EventTarget
public class SimpleFilterView
extends javafx.scene.layout.HBox
A control for creating filters based on various other controls such as the
SelectionBox,
the DateRangePicker, the SearchTextField, etc...
The control automatically manages a list of ChipView instances based on the current selection.
These chip views can be displayed by the ChipsViewContainer. To do so bind the observable list
of chips views of the filter view with the one provided by the ChipsViewContainer.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enumeration of possible layouts supported by the filter view. -
Property Summary
PropertiesTypePropertyDescriptionfinal javafx.beans.property.ListProperty<ChipView<?>> An observable list containing the currently managed chip views.final javafx.beans.property.ObjectProperty<SimpleFilterView.LayoutMode> The layout used by the control, either "standard" or "compact" / "unified".final javafx.beans.property.ObjectProperty<Runnable> Will be invoked whenever anything changes within the filter settings.Properties inherited from class javafx.scene.layout.HBox
alignment, fillHeight, spacingProperties inherited from class javafx.scene.layout.Region
background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, widthProperties inherited from class javafx.scene.Parent
needsLayoutProperties inherited from class javafx.scene.Node
accessibleHelp, accessibleRoleDescription, accessibleRole, accessibleText, blendMode, boundsInLocal, boundsInParent, cacheHint, cache, clip, cursor, depthTest, disabled, disable, effectiveNodeOrientation, effect, eventDispatcher, focused, focusTraversable, focusVisible, focusWithin, hover, id, inputMethodRequests, layoutBounds, layoutX, layoutY, localToParentTransform, localToSceneTransform, managed, mouseTransparent, nodeOrientation, onContextMenuRequested, onDragDetected, onDragDone, onDragDropped, onDragEntered, onDragExited, onDragOver, onInputMethodTextChanged, onKeyPressed, onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragEntered, onMouseDragExited, onMouseDragged, onMouseDragOver, onMouseDragReleased, onMouseEntered, onMouseExited, onMouseMoved, onMousePressed, onMouseReleased, onRotate, onRotationFinished, onRotationStarted, onScrollFinished, onScroll, onScrollStarted, onSwipeDown, onSwipeLeft, onSwipeRight, onSwipeUp, onTouchMoved, onTouchPressed, onTouchReleased, onTouchStationary, onZoomFinished, onZoom, onZoomStarted, opacity, parent, pickOnBounds, pressed, rotate, rotationAxis, scaleX, scaleY, scaleZ, scene, style, translateX, translateY, translateZ, viewOrder, visible -
Field Summary
Fields inherited from class javafx.scene.layout.Region
USE_COMPUTED_SIZE, USE_PREF_SIZEFields inherited from class javafx.scene.Node
BASELINE_OFFSET_SAME_AS_HEIGHT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal CalendarPickeraddCalendarPicker(String text) Adds a calendar picker to the filter view with the specified prompt text.final javafx.scene.control.CheckBoxaddCheckBox(String text) Adds a new CheckBox with the specified text to the control.final javafx.scene.control.DatePickeraddDatePicker(String text) Adds a date picker to the filter view with the specified prompt text.final DateRangePickeraddDateRangePicker(String text) Adds a date range picker to the filter view and configures it with the specified prompt text.final SearchTextFieldaddSearchTextField(String promptText) Add a new instance of a search text field.final <T> SelectionBox<T> addSelectionBox(String text) Adds a selection box to the filter view with the specified prompt text.final <T extends Enum<T>>
SelectionBox<T> addSelectionBox(String text, Class<T> clz) Adds a selection box to the UI with the given prompt name and the values of the given enum type.final <T> SelectionBox<T> addSelectionBox(String text, Collection<T> values) Adds a selection box to the UI with the given prompt name and the list of the given values.final <T extends Enum<T>>
SelectionBox<T> addSelectionBox(String text, T... values) Adds a selection box to the UI with the given prompt name and the given values.final <T> SelectionBox<T> addSelectionBox(String text, T... values) Adds a selection box to the UI with the given prompt name and the list of the given values.final org.controlsfx.control.textfield.CustomTextFieldaddTextField(String promptText) Creates a new instance of a textfield.final javafx.beans.property.ListProperty<ChipView<?>> An observable list containing the currently managed chip views.final voidclear()Clears all selections and values in the filter view.protected CalendarPickerFactory method for creating a newCalendarPickerinstance.protected javafx.scene.control.CheckBoxprotected javafx.scene.control.DatePickerFactory method for creating a newDatePickerinstance.protected DateRangePickerFactory method for creating the date range picker that will be added to the view.protected SearchTextFieldFactory method for creating the search text field that will be added to the view.protected <T> SelectionBox<T> Creates a new instance of aSelectionBox.protected org.controlsfx.control.textfield.CustomTextFieldFactory method for creating a text field that will be added to the view.final javafx.collections.ObservableList<ChipView<?>> getChips()Gets the value of thechipsproperty.Gets the value of thelayoutModeproperty.final RunnableGets the value of theonChangeproperty.final javafx.beans.property.ObjectProperty<SimpleFilterView.LayoutMode> The layout used by the control, either "standard" or "compact" / "unified".final javafx.beans.property.ObjectProperty<Runnable> Will be invoked whenever anything changes within the filter settings.final voidSets the value of thechipsproperty.final voidsetLayoutMode(SimpleFilterView.LayoutMode layoutMode) Sets the value of thelayoutModeproperty.final voidsetOnChange(Runnable onChange) Sets the value of theonChangeproperty.Methods inherited from class javafx.scene.layout.HBox
alignmentProperty, clearConstraints, computeMinHeight, computeMinWidth, computePrefHeight, computePrefWidth, fillHeightProperty, getAlignment, getBaselineOffset, getClassCssMetaData, getContentBias, getCssMetaData, getHgrow, getMargin, getSpacing, isFillHeight, layoutChildren, requestLayout, setAlignment, setFillHeight, setHgrow, setMargin, setSpacing, spacingPropertyMethods inherited from class javafx.scene.layout.Pane
getChildrenMethods inherited from class javafx.scene.layout.Region
backgroundProperty, borderProperty, cacheShapeProperty, centerShapeProperty, computeMaxHeight, computeMaxWidth, getBackground, getBorder, getHeight, getInsets, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOpaqueInsets, getPadding, getPrefHeight, getPrefWidth, getShape, getWidth, heightProperty, insetsProperty, isCacheShape, isCenterShape, isResizable, isScaleShape, isSnapToPixel, layoutInArea, layoutInArea, layoutInArea, layoutInArea, maxHeight, maxHeightProperty, maxWidth, maxWidthProperty, minHeight, minHeightProperty, minWidth, minWidthProperty, opaqueInsetsProperty, paddingProperty, positionInArea, positionInArea, prefHeight, prefHeightProperty, prefWidth, prefWidthProperty, resize, scaleShapeProperty, setBackground, setBorder, setCacheShape, setCenterShape, setHeight, setMaxHeight, setMaxSize, setMaxWidth, setMinHeight, setMinSize, setMinWidth, setOpaqueInsets, setPadding, setPrefHeight, setPrefSize, setPrefWidth, setScaleShape, setShape, setSnapToPixel, setWidth, shapeProperty, snappedBottomInset, snappedLeftInset, snappedRightInset, snappedTopInset, snapPosition, snapPositionX, snapPositionY, snapSize, snapSizeX, snapSizeY, snapSpace, snapSpaceX, snapSpaceY, snapToPixelProperty, widthPropertyMethods inherited from class javafx.scene.Parent
getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestParentLayout, setNeedsLayout, updateBoundsMethods inherited from class javafx.scene.Node
accessibleHelpProperty, accessibleRoleDescriptionProperty, accessibleRoleProperty, accessibleTextProperty, addEventFilter, addEventHandler, applyCss, autosize, blendModeProperty, boundsInLocalProperty, boundsInParentProperty, buildEventDispatchChain, cacheHintProperty, cacheProperty, clipProperty, computeAreaInScreen, contains, contains, cursorProperty, depthTestProperty, disabledProperty, disableProperty, effectiveNodeOrientationProperty, effectProperty, eventDispatcherProperty, executeAccessibleAction, fireEvent, focusedProperty, focusTraversableProperty, focusVisibleProperty, focusWithinProperty, getAccessibleHelp, getAccessibleRole, getAccessibleRoleDescription, getAccessibleText, getBlendMode, getBoundsInLocal, getBoundsInParent, getCacheHint, getClip, getCursor, getDepthTest, getEffect, getEffectiveNodeOrientation, getEventDispatcher, getId, getInitialCursor, getInitialFocusTraversable, getInputMethodRequests, getLayoutBounds, getLayoutX, getLayoutY, getLocalToParentTransform, getLocalToSceneTransform, getNodeOrientation, getOnContextMenuRequested, getOnDragDetected, getOnDragDone, getOnDragDropped, getOnDragEntered, getOnDragExited, getOnDragOver, getOnInputMethodTextChanged, getOnKeyPressed, getOnKeyReleased, getOnKeyTyped, getOnMouseClicked, getOnMouseDragEntered, getOnMouseDragExited, getOnMouseDragged, getOnMouseDragOver, getOnMouseDragReleased, getOnMouseEntered, getOnMouseExited, getOnMouseMoved, getOnMousePressed, getOnMouseReleased, getOnRotate, getOnRotationFinished, getOnRotationStarted, getOnScroll, getOnScrollFinished, getOnScrollStarted, getOnSwipeDown, getOnSwipeLeft, getOnSwipeRight, getOnSwipeUp, getOnTouchMoved, getOnTouchPressed, getOnTouchReleased, getOnTouchStationary, getOnZoom, getOnZoomFinished, getOnZoomStarted, getOpacity, getParent, getProperties, getPseudoClassStates, getRotate, getRotationAxis, getScaleX, getScaleY, getScaleZ, getScene, getStyle, getStyleableParent, getStyleClass, getTransforms, getTranslateX, getTranslateY, getTranslateZ, getTypeSelector, getUserData, getViewOrder, hasProperties, hoverProperty, idProperty, inputMethodRequestsProperty, intersects, intersects, isCache, isDisable, isDisabled, isFocused, isFocusTraversable, isFocusVisible, isFocusWithin, isHover, isManaged, isMouseTransparent, isPickOnBounds, isPressed, isVisible, layoutBoundsProperty, layoutXProperty, layoutYProperty, localToParent, localToParent, localToParent, localToParent, localToParent, localToParentTransformProperty, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToScene, localToSceneTransformProperty, localToScreen, localToScreen, localToScreen, localToScreen, localToScreen, lookupAll, managedProperty, mouseTransparentProperty, nodeOrientationProperty, notifyAccessibleAttributeChanged, onContextMenuRequestedProperty, onDragDetectedProperty, onDragDoneProperty, onDragDroppedProperty, onDragEnteredProperty, onDragExitedProperty, onDragOverProperty, onInputMethodTextChangedProperty, onKeyPressedProperty, onKeyReleasedProperty, onKeyTypedProperty, onMouseClickedProperty, onMouseDragEnteredProperty, onMouseDragExitedProperty, onMouseDraggedProperty, onMouseDragOverProperty, onMouseDragReleasedProperty, onMouseEnteredProperty, onMouseExitedProperty, onMouseMovedProperty, onMousePressedProperty, onMouseReleasedProperty, onRotateProperty, onRotationFinishedProperty, onRotationStartedProperty, onScrollFinishedProperty, onScrollProperty, onScrollStartedProperty, onSwipeDownProperty, onSwipeLeftProperty, onSwipeRightProperty, onSwipeUpProperty, onTouchMovedProperty, onTouchPressedProperty, onTouchReleasedProperty, onTouchStationaryProperty, onZoomFinishedProperty, onZoomProperty, onZoomStartedProperty, opacityProperty, parentProperty, parentToLocal, parentToLocal, parentToLocal, parentToLocal, parentToLocal, pickOnBoundsProperty, pressedProperty, pseudoClassStateChanged, relocate, removeEventFilter, removeEventHandler, requestFocus, requestFocusTraversal, resizeRelocate, rotateProperty, rotationAxisProperty, scaleXProperty, scaleYProperty, scaleZProperty, sceneProperty, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, sceneToLocal, screenToLocal, screenToLocal, screenToLocal, setAccessibleHelp, setAccessibleRole, setAccessibleRoleDescription, setAccessibleText, setBlendMode, setCache, setCacheHint, setClip, setCursor, setDepthTest, setDisable, setDisabled, setEffect, setEventDispatcher, setEventHandler, setFocused, setFocusTraversable, setHover, setId, setInputMethodRequests, setLayoutX, setLayoutY, setManaged, setMouseTransparent, setNodeOrientation, setOnContextMenuRequested, setOnDragDetected, setOnDragDone, setOnDragDropped, setOnDragEntered, setOnDragExited, setOnDragOver, setOnInputMethodTextChanged, setOnKeyPressed, setOnKeyReleased, setOnKeyTyped, setOnMouseClicked, setOnMouseDragEntered, setOnMouseDragExited, setOnMouseDragged, setOnMouseDragOver, setOnMouseDragReleased, setOnMouseEntered, setOnMouseExited, setOnMouseMoved, setOnMousePressed, setOnMouseReleased, setOnRotate, setOnRotationFinished, setOnRotationStarted, setOnScroll, setOnScrollFinished, setOnScrollStarted, setOnSwipeDown, setOnSwipeLeft, setOnSwipeRight, setOnSwipeUp, setOnTouchMoved, setOnTouchPressed, setOnTouchReleased, setOnTouchStationary, setOnZoom, setOnZoomFinished, setOnZoomStarted, setOpacity, setPickOnBounds, setPressed, setRotate, setRotationAxis, setScaleX, setScaleY, setScaleZ, setStyle, setTranslateX, setTranslateY, setTranslateZ, setUserData, setViewOrder, setVisible, snapshot, snapshot, startDragAndDrop, startFullDrag, styleProperty, toBack, toFront, toString, translateXProperty, translateYProperty, translateZProperty, usesMirroring, viewOrderProperty, visiblePropertyMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javafx.css.Styleable
getStyleableNode
-
Property Details
-
layoutMode
The layout used by the control, either "standard" or "compact" / "unified".- See Also:
-
onChange
Will be invoked whenever anything changes within the filter settings.- See Also:
-
chips
An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.- See Also:
-
-
Constructor Details
-
SimpleFilterView
public SimpleFilterView()Constructs a new instance ofSimpleFilterView.
-
-
Method Details
-
getUserAgentStylesheet
- Overrides:
getUserAgentStylesheetin classjavafx.scene.layout.Region
-
getLayoutMode
Gets the value of thelayoutModeproperty.- Property description:
- The layout used by the control, either "standard" or "compact" / "unified".
- Returns:
- the value of the
layoutModeproperty - See Also:
-
layoutModeProperty
The layout used by the control, either "standard" or "compact" / "unified".- Returns:
- the layout mode
- See Also:
-
setLayoutMode
Sets the value of thelayoutModeproperty.- Property description:
- The layout used by the control, either "standard" or "compact" / "unified".
- Parameters:
layoutMode- the value for thelayoutModeproperty- See Also:
-
clear
public final void clear()Clears all selections and values in the filter view. This method iterates through the filter components, such as selection boxes and pickers, and resets their values or selections to the default state. It also clears any associated mappings and updates the UI accordingly. If an unknown node type is encountered, this method will throw anIllegalStateException. After clearing, if a change listener is defined, it will be executed. This operation ensures that the filter view is in a clean state and ready for new inputs or selections. Note: During the execution of this method, a flag is set to avoid triggering unwanted actions due to internal state changes.- Throws:
IllegalStateException- - if an unsupported node type is found during iteration.- See Also:
-
getOnChange
Gets the value of theonChangeproperty.- Property description:
- Will be invoked whenever anything changes within the filter settings.
- Returns:
- the value of the
onChangeproperty - See Also:
-
onChangeProperty
Will be invoked whenever anything changes within the filter settings.- Returns:
- the runnable to executed upon change
- See Also:
-
setOnChange
Sets the value of theonChangeproperty.- Property description:
- Will be invoked whenever anything changes within the filter settings.
- Parameters:
onChange- the value for theonChangeproperty- See Also:
-
addSelectionBox
Adds a selection box to the UI with the given prompt name and the values of the given enum type.- Type Parameters:
T- the enum type- Parameters:
text- the prompt textclz- the type of the enum- Returns:
- the newly added selection box
-
addSelectionBox
@SafeVarargs public final <T extends Enum<T>> SelectionBox<T> addSelectionBox(String text, T... values) Adds a selection box to the UI with the given prompt name and the given values.- Type Parameters:
T- the enum type- Parameters:
text- the prompt textvalues- the possible values- Returns:
- the newly added selection box
-
addSelectionBox
Adds a selection box to the UI with the given prompt name and the list of the given values.- Type Parameters:
T- the type of the items in the selection box- Parameters:
text- the prompt textvalues- the possible values collection- Returns:
- the newly added selection box
-
addSelectionBox
Adds a selection box to the UI with the given prompt name and the list of the given values.- Type Parameters:
T- the type of the items in the selection box- Parameters:
text- the prompt textvalues- the possible values- Returns:
- the newly added selection box
-
addSelectionBox
Adds a selection box to the filter view with the specified prompt text. The selection box allows users to select multiple items, and the selected items are represented as chips in the filter view. The method initializes the selection box with default properties, sets up listeners to handle changes in the selected items, and manages the associated chip view for each selected item. It ensures proper updates to the UI elements when items are added or removed from the selection box.- Type Parameters:
T- the type of the items in the selection box- Parameters:
text- the prompt text to display in the selection box- Returns:
- the newly created and configured
SelectionBoxinstance
-
addCheckBox
Adds a new CheckBox with the specified text to the control. The CheckBox is configured with listeners to manage its interaction with associated chip views and the internal state of the control.- Parameters:
text- the text to display alongside the created CheckBox- Returns:
- the created CheckBox instance
-
createCheckBox
protected javafx.scene.control.CheckBox createCheckBox() -
createSelectionBox
Creates a new instance of aSelectionBox. This method serves as a factory for creating selection boxes, in case customization or modification of the default selection box behavior is required. Subclasses can override this method to provide a different implementation.- Type Parameters:
T- the type of the items that the selection box will manage- Returns:
- a new instance of
SelectionBoxconfigured with default settings
-
addTextField
Creates a new instance of a textfield.- Parameters:
promptText- the initial prompt text- Returns:
- the new text field
-
createTextField
protected org.controlsfx.control.textfield.CustomTextField createTextField()Factory method for creating a text field that will be added to the view. This method can be overridden to provide a custom text field implementation.- Returns:
- a text field
-
addSearchTextField
Add a new instance of a search text field.- Parameters:
promptText- the initial prompt text- Returns:
- the new text field
- See Also:
-
createSearchTextField
Factory method for creating the search text field that will be added to the view. This method can be overridden to provide a custom search field implementation.- Returns:
- a search text field
-
addDateRangePicker
Adds a date range picker to the filter view and configures it with the specified prompt text. This date range picker allows users to select a range of dates, and selected ranges are represented as chips in the filter view. The method initialises the date range picker, adds listeners to handle changes in selection, and manages the associated chip view for each selected range. It ensures proper update of the UI elements when ranges are added or removed.- Parameters:
text- the prompt text to display in the date range picker- Returns:
- the newly created and configured
DateRangePickerinstance
-
createDateRangePicker
Factory method for creating the date range picker that will be added to the view. This method can be overridden to provide a custom date range picker implementation.- Returns:
- a date range picker
-
addCalendarPicker
Adds a calendar picker to the filter view with the specified prompt text. The calendar picker allows users to select a date, and the selected date is represented as a chip in the filter view. The method initializes the calendar picker, sets its default properties, and adds listeners to handle changes in the selected date. When a date is selected, it is displayed as a chip, and the chip can be removed by the user, clearing the date from the picker.- Parameters:
text- the prompt text to display in the date picker- Returns:
- the newly created and configured
DatePickerinstance
-
createCalendarPicker
Factory method for creating a newCalendarPickerinstance. This method is used to instantiate aCalendarPickerwith default properties. Subclasses can override this method to customize the behavior or appearance of theCalendarPicker.- Returns:
- a new instance of
CalendarPicker.
-
addDatePicker
Adds a date picker to the filter view with the specified prompt text. The date picker allows users to select a date, and the selected date is represented as a chip in the filter view. The method initializes the date picker, sets its default properties, and adds listeners to handle changes in the selected date. When a date is selected, it is displayed as a chip, and the chip can be removed by the user, clearing the date from the picker.- Parameters:
text- the prompt text to display in the date picker- Returns:
- the newly created and configured
DatePickerinstance
-
createDatePicker
protected javafx.scene.control.DatePicker createDatePicker()Factory method for creating a newDatePickerinstance. This method can be overridden to provide a customized implementation of theDatePicker.- Returns:
- a new instance of
DatePicker.
-
getChips
Gets the value of thechipsproperty.- Property description:
- An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.
- Returns:
- the value of the
chipsproperty - See Also:
-
chipsProperty
An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.- Returns:
- the list of chip views
- See Also:
-
setChips
Sets the value of thechipsproperty.- Property description:
- An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.
- Parameters:
chips- the value for thechipsproperty- See Also:
-