Class DefaultGTreeFilterProvider

java.lang.Object
docking.widgets.tree.DefaultGTreeFilterProvider
All Implemented Interfaces:
GTreeFilterProvider

public class DefaultGTreeFilterProvider extends Object implements GTreeFilterProvider
  • Constructor Details

    • DefaultGTreeFilterProvider

      public DefaultGTreeFilterProvider(GTree gTree)
  • Method Details

    • copy

      public GTreeFilterProvider copy(GTree newTree)
      Description copied from interface: GTreeFilterProvider
      Creates a copy of this filter with all current filter settings.

      This is meant to be used for GTrees that support creating a new copy.

      Note: Filter providers that do not support copying will return null from this method.

      Specified by:
      copy in interface GTreeFilterProvider
      Parameters:
      newTree - the new tree for the new filter
      Returns:
      the copy
    • getFilterComponent

      public JComponent getFilterComponent()
      Description copied from interface: GTreeFilterProvider
      Returns the component to place at the bottom of a GTree to provider filtering capabilities.
      Specified by:
      getFilterComponent in interface GTreeFilterProvider
      Returns:
      the filter component
    • setFilterText

      public void setFilterText(String text)
      Description copied from interface: GTreeFilterProvider
      Sets the filter text for the filter.
      Specified by:
      setFilterText in interface GTreeFilterProvider
      Parameters:
      text - the text to filter on
    • setEnabled

      public void setEnabled(boolean enabled)
      Description copied from interface: GTreeFilterProvider
      Sets the active state for the filter component.
      Specified by:
      setEnabled in interface GTreeFilterProvider
      Parameters:
      enabled - true, the filter component is enabled
    • setAccessibleNamePrefix

      public void setAccessibleNamePrefix(String namePrefix)
      Description copied from interface: GTreeFilterProvider
      Sets an accessible name on the filter component. This prefix will be used to assign meaningful accessible names to the filter text field and the filter options button such that screen readers will properly describe them.

      This prefix should be the base name that describes the type of items in the tree. This method will then append the necessary information to name the text field and the button.

      Specified by:
      setAccessibleNamePrefix in interface GTreeFilterProvider
      Parameters:
      namePrefix - the accessible name prefix to assign to the filter component. For example if the tree contains fruits, then "Fruits" would be an appropriate prefix name.
    • getFilterOptions

      public FilterOptions getFilterOptions()
    • setPreferredFilterOptions

      public void setPreferredFilterOptions(FilterOptions filterOptions)
      A method to allow clients to change the current filter settings to something they would like for their particular use case. This differs from setFilterOptions(FilterOptions) in that this method will also disable saving any changes the user makes to the filter. If you do not need to disable preference saving, then call the other method.

      This method disables preference saving with the assumption that some clients always wish the filter to start in the same preferred state instead of where the user last left it. It is not clear why we do that, but it is probably based on the assumption that the API client wants the filter to always start in the preferred state. The prevents filter from being restored with a previous user filter that does not make sense for the general case.

      Parameters:
      filterOptions - the options
      See Also:
    • setFilterOptions

      public void setFilterOptions(FilterOptions filterOptions)
      Sets the options for this filter provider.
      Parameters:
      filterOptions - the new filter options
    • activate

      public void activate()
      Description copied from interface: GTreeFilterProvider
      Activates this filter by showing it, if not visible, and then requesting focus in the filter text field.
      Specified by:
      activate in interface GTreeFilterProvider
    • toggleVisibility

      public void toggleVisibility()
      Description copied from interface: GTreeFilterProvider
      Changes the visibility of the filter, make it not visible it if showing, showing it if not visible.
      Specified by:
      toggleVisibility in interface GTreeFilterProvider
    • loadFilterPreference

      public void loadFilterPreference(DockingWindowManager windowManager)
      Description copied from interface: GTreeFilterProvider
      Loads any filter preferences that have been saved.

      This is called when the tree is first made visible in the tool. This is the chance for the filter to load any preferences and to add a preference supplier to the window manager.

      Specified by:
      loadFilterPreference in interface GTreeFilterProvider
      Parameters:
      windowManager - the DockingWindowManager to load preferences from
    • getFilter

      public GTreeFilter getFilter()
      Description copied from interface: GTreeFilterProvider
      returns the GTreeFilter object to apply to the GTree whenever the filter component is manipulated
      Specified by:
      getFilter in interface GTreeFilterProvider
      Returns:
      the GTreeFilter to apply to the tree
    • getFilterText

      public String getFilterText()
      Description copied from interface: GTreeFilterProvider
      Returns the current filter text.
      Specified by:
      getFilterText in interface GTreeFilterProvider
      Returns:
      the current filter text
    • setDataTransformer

      public void setDataTransformer(FilterTransformer<GTreeNode> transformer)
      Description copied from interface: GTreeFilterProvider
      Sets a FilterTransformer for preparing tree data to be filtered.
      Specified by:
      setDataTransformer in interface GTreeFilterProvider
      Parameters:
      transformer - the transform for preparing tree data to be filtered
    • dispose

      public void dispose()
      Description copied from interface: GTreeFilterProvider
      A method for subclasses to do any optional cleanup
      Specified by:
      dispose in interface GTreeFilterProvider