Class ItemFilter

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.HtmlComponent
com.vaadin.flow.component.HtmlContainer
com.vaadin.flow.component.html.Div
com.vaadin.flow.component.spreadsheet.ItemFilter
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.ClickNotifier<com.vaadin.flow.component.html.Div>, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasComponents, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasEnabled, com.vaadin.flow.component.HasOrderedComponents, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, com.vaadin.flow.component.HasText, SpreadsheetFilter, Serializable

public class ItemFilter extends com.vaadin.flow.component.html.Div implements SpreadsheetFilter
A simple filter for spreadsheet filtering table, filtering cell values with checkboxes.

Has a check box for selecting all items (cell values), and one check box per unique cell value that can be found within the cells of the table column.

See Also:
  • Nested Class Summary

    Nested classes/interfaces inherited from interface com.vaadin.flow.component.HasText

    com.vaadin.flow.component.HasText.WhiteSpace
  • Constructor Summary

    Constructors
    Constructor
    Description
    ItemFilter(org.apache.poi.ss.util.CellRangeAddress filterRange, Spreadsheet spreadsheet, PopupButton popupButton, SpreadsheetFilterTable filterTable)
    Constructs a new item filter for the given spreadsheet, filtering range, pop-up button and filtering table.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Clear the filtering options.
    protected Set<String>
    Gets all of the unique values for this filter column.
    Returns the rows that should be filtered by this filter.
    protected Set<String>
    Gets the currently NOT filtered cell values.
    protected void
    Creates the "Select All" filter component.
    protected void
    Create all components of the ItemFilter.
    protected void
    Creates the base layout for the filter components.
    protected void
    Creates the filter selection component.
    protected void
    Initializes pop-up close listener for verifying that filter selections match with what is currently shown.
    protected void
    Updates the filtered rows to reflect the new filtered values.
    void
    Updates the filtering options based on the values within the column.

    Methods inherited from class com.vaadin.flow.component.HtmlComponent

    getTitle, setTitle

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.ClickNotifier

    addClickListener, addClickShortcut, addDoubleClickListener, addSingleClickListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasComponents

    add, add, add, addComponentAsFirst, addComponentAtIndex, remove, remove, removeAll

    Methods inherited from interface com.vaadin.flow.component.HasElement

    getElement

    Methods inherited from interface com.vaadin.flow.component.HasEnabled

    isEnabled, setEnabled

    Methods inherited from interface com.vaadin.flow.component.HasOrderedComponents

    getChildren, getComponentAt, getComponentCount, indexOf, replace

    Methods inherited from interface com.vaadin.flow.component.HasSize

    getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName

    Methods inherited from interface com.vaadin.flow.component.HasText

    getText, getWhiteSpace, setText, setWhiteSpace
  • Constructor Details

    • ItemFilter

      public ItemFilter(org.apache.poi.ss.util.CellRangeAddress filterRange, Spreadsheet spreadsheet, PopupButton popupButton, SpreadsheetFilterTable filterTable)
      Constructs a new item filter for the given spreadsheet, filtering range, pop-up button and filtering table.
      Parameters:
      filterRange - Range of cells to filter
      spreadsheet - Target Spreadsheet
      popupButton - Pop-up button to insert the filter components in
      filterTable - Target SpreadsheetFilterTable
  • Method Details

    • initComponents

      protected void initComponents()
      Create all components of the ItemFilter.
    • initLayouts

      protected void initLayouts()
      Creates the base layout for the filter components.
    • initPopupButtonListeners

      protected void initPopupButtonListeners()
      Initializes pop-up close listener for verifying that filter selections match with what is currently shown.
    • initAllItemsCheckbox

      protected void initAllItemsCheckbox()
      Creates the "Select All" filter component.
    • initOptions

      protected void initOptions()
      Creates the filter selection component.
    • updateOptions

      public void updateOptions()
      Updates the filtering options based on the values within the column.
    • getVisibleValues

      protected Set<String> getVisibleValues()
      Gets the currently NOT filtered cell values.
      Returns:
      All unique values currently visible (= not filtered) within this column
    • getAllValues

      protected Set<String> getAllValues()
      Gets all of the unique values for this filter column.
      Returns:
      All unique values within this column
    • updateFilteredItems

      protected void updateFilteredItems(Collection<String> visibleValues)
      Updates the filtered rows to reflect the new filtered values.
      Parameters:
      visibleValues - the values that are NOT filtered
    • getFilteredRows

      public Set<Integer> getFilteredRows()
      Description copied from interface: SpreadsheetFilter
      Returns the rows that should be filtered by this filter. In other words the returned set of rows will be hidden from the table.
      Specified by:
      getFilteredRows in interface SpreadsheetFilter
      Returns:
      Row indexes of the filtered rows, 0-based
    • clearFilter

      public void clearFilter()
      Description copied from interface: SpreadsheetFilter
      Clear the filtering options. After this method the SpreadsheetFilter.getFilteredRows() for this filter should return an empty set.
      Specified by:
      clearFilter in interface SpreadsheetFilter