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 Classes
    Modifier and Type
    Class
    Description
    static enum 
    An enumeration of possible layouts supported by the filter view.
  • Property Summary

    Properties
    Type
    Property
    Description
    final 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, spacing

    Properties inherited from class javafx.scene.layout.Region

    background, border, cacheShape, centerShape, height, insets, maxHeight, maxWidth, minHeight, minWidth, opaqueInsets, padding, prefHeight, prefWidth, scaleShape, shape, snapToPixel, width

    Properties inherited from class javafx.scene.Parent

    needsLayout

    Properties 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_SIZE

    Fields inherited from class javafx.scene.Node

    BASELINE_OFFSET_SAME_AS_HEIGHT
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructs a new instance of SimpleFilterView.
  • Method Summary

    Modifier and Type
    Method
    Description
    Adds a calendar picker to the filter view with the specified prompt text.
    final javafx.scene.control.CheckBox
    Adds a new CheckBox with the specified text to the control.
    final javafx.scene.control.DatePicker
    Adds a date picker to the filter view with the specified prompt text.
    Adds a date range picker to the filter view and configures it with the specified prompt text.
    Add a new instance of a search text field.
    final <T> SelectionBox<T>
    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.CustomTextField
    addTextField(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 void
    Clears all selections and values in the filter view.
    protected CalendarPicker
    Factory method for creating a new CalendarPicker instance.
    protected javafx.scene.control.CheckBox
     
    protected javafx.scene.control.DatePicker
    Factory method for creating a new DatePicker instance.
    protected DateRangePicker
    Factory method for creating the date range picker that will be added to the view.
    protected SearchTextField
    Factory method for creating the search text field that will be added to the view.
    protected <T> SelectionBox<T>
    Creates a new instance of a SelectionBox.
    protected org.controlsfx.control.textfield.CustomTextField
    Factory method for creating a text field that will be added to the view.
    final javafx.collections.ObservableList<ChipView<?>>
    Gets the value of the chips property.
    Gets the value of the layoutMode property.
    final Runnable
    Gets the value of the onChange property.
     
    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 void
    setChips(javafx.collections.ObservableList<ChipView<?>> chips)
    Sets the value of the chips property.
    final void
    Sets the value of the layoutMode property.
    final void
    Sets the value of the onChange property.

    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, spacingProperty

    Methods inherited from class javafx.scene.layout.Pane

    getChildren

    Methods 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, widthProperty

    Methods inherited from class javafx.scene.Parent

    getChildrenUnmodifiable, getManagedChildren, getStylesheets, isNeedsLayout, layout, lookup, needsLayoutProperty, queryAccessibleAttribute, requestParentLayout, setNeedsLayout, updateBounds

    Methods 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, visibleProperty

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface javafx.css.Styleable

    getStyleableNode
  • Property Details

  • Constructor Details

    • SimpleFilterView

      public SimpleFilterView()
      Constructs a new instance of SimpleFilterView.
  • Method Details

    • getUserAgentStylesheet

      public String getUserAgentStylesheet()
      Overrides:
      getUserAgentStylesheet in class javafx.scene.layout.Region
    • getLayoutMode

      public final SimpleFilterView.LayoutMode getLayoutMode()
      Gets the value of the layoutMode property.
      Property description:
      The layout used by the control, either "standard" or "compact" / "unified".
      Returns:
      the value of the layoutMode property
      See Also:
    • layoutModeProperty

      public final javafx.beans.property.ObjectProperty<SimpleFilterView.LayoutMode> layoutModeProperty()
      The layout used by the control, either "standard" or "compact" / "unified".
      Returns:
      the layout mode
      See Also:
    • setLayoutMode

      public final void setLayoutMode(SimpleFilterView.LayoutMode layoutMode)
      Sets the value of the layoutMode property.
      Property description:
      The layout used by the control, either "standard" or "compact" / "unified".
      Parameters:
      layoutMode - the value for the layoutMode property
      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 an IllegalStateException. 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

      public final Runnable getOnChange()
      Gets the value of the onChange property.
      Property description:
      Will be invoked whenever anything changes within the filter settings.
      Returns:
      the value of the onChange property
      See Also:
    • onChangeProperty

      public final javafx.beans.property.ObjectProperty<Runnable> onChangeProperty()
      Will be invoked whenever anything changes within the filter settings.
      Returns:
      the runnable to executed upon change
      See Also:
    • setOnChange

      public final void setOnChange(Runnable onChange)
      Sets the value of the onChange property.
      Property description:
      Will be invoked whenever anything changes within the filter settings.
      Parameters:
      onChange - the value for the onChange property
      See Also:
    • addSelectionBox

      public 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.
      Type Parameters:
      T - the enum type
      Parameters:
      text - the prompt text
      clz - 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 text
      values - the possible values
      Returns:
      the newly added selection box
    • addSelectionBox

      public 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.
      Type Parameters:
      T - the type of the items in the selection box
      Parameters:
      text - the prompt text
      values - the possible values collection
      Returns:
      the newly added selection box
    • addSelectionBox

      @SafeVarargs public 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.
      Type Parameters:
      T - the type of the items in the selection box
      Parameters:
      text - the prompt text
      values - the possible values
      Returns:
      the newly added selection box
    • addSelectionBox

      public final <T> SelectionBox<T> addSelectionBox(String text)
      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 SelectionBox instance
    • addCheckBox

      public final javafx.scene.control.CheckBox addCheckBox(String text)
      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

      protected <T> SelectionBox<T> createSelectionBox()
      Creates a new instance of a SelectionBox. 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 SelectionBox configured with default settings
    • addTextField

      public final org.controlsfx.control.textfield.CustomTextField addTextField(String promptText)
      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

      public final SearchTextField addSearchTextField(String promptText)
      Add a new instance of a search text field.
      Parameters:
      promptText - the initial prompt text
      Returns:
      the new text field
      See Also:
    • createSearchTextField

      protected SearchTextField 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

      public final DateRangePicker addDateRangePicker(String text)
      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 DateRangePicker instance
    • createDateRangePicker

      protected DateRangePicker 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

      public final CalendarPicker addCalendarPicker(String text)
      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 DatePicker instance
    • createCalendarPicker

      protected CalendarPicker createCalendarPicker()
      Factory method for creating a new CalendarPicker instance. This method is used to instantiate a CalendarPicker with default properties. Subclasses can override this method to customize the behavior or appearance of the CalendarPicker.
      Returns:
      a new instance of CalendarPicker.
    • addDatePicker

      public final javafx.scene.control.DatePicker addDatePicker(String text)
      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 DatePicker instance
    • createDatePicker

      protected javafx.scene.control.DatePicker createDatePicker()
      Factory method for creating a new DatePicker instance. This method can be overridden to provide a customized implementation of the DatePicker.
      Returns:
      a new instance of DatePicker.
    • getChips

      public final javafx.collections.ObservableList<ChipView<?>> getChips()
      Gets the value of the chips property.
      Property description:
      An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.
      Returns:
      the value of the chips property
      See Also:
    • chipsProperty

      public final javafx.beans.property.ListProperty<ChipView<?>> 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

      public final void setChips(javafx.collections.ObservableList<ChipView<?>> chips)
      Sets the value of the chips property.
      Property description:
      An observable list containing the currently managed chip views. Each chip view represents one selected filter criteria.
      Parameters:
      chips - the value for the chips property
      See Also: