Interface AdvancedListSelectionModel<E>

  • All Superinterfaces:
    javax.swing.ListSelectionModel
    All Known Implementing Classes:
    DefaultEventSelectionModel, EventSelectionModel

    public interface AdvancedListSelectionModel<E>
    extends javax.swing.ListSelectionModel
    AdvancedListSelectionModel is an interface defining additional methods for selection management beyond the standard ListSelectionModel.
    Author:
    Holger Brands
    • Field Summary

      • Fields inherited from interface javax.swing.ListSelectionModel

        MULTIPLE_INTERVAL_SELECTION, SINGLE_INTERVAL_SELECTION, SINGLE_SELECTION
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addValidSelectionMatcher​(Matcher<E> validSelectionMatcher)
      Add a matcher which decides when source elements are valid for selection.
      void dispose()
      Releases the resources consumed by this AdvancedListSelectionModel so that it may eventually be garbage collected.
      EventList<E> getDeselected()
      Gets an EventList that contains only deselected values and modifies the source list on mutation.
      boolean getEnabled()
      Returns whether the EventSelectionModel is editable or not.
      EventList<E> getSelected()
      Gets an EventList that contains only selected values and modifies the source list on mutation.
      EventList<E> getTogglingDeselected()
      Gets an EventList that contains only deselected values and modifies the selection state on mutation.
      EventList<E> getTogglingSelected()
      Gets an EventList that contains only selected values and modifies the selection state on mutation.
      void invertSelection()
      Inverts the current selection.
      void removeValidSelectionMatcher​(Matcher<E> validSelectionMatcher)
      Remove a matcher which decides when source elements are valid for selection.
      void setEnabled​(boolean enabled)
      Set the EventSelectionModel as editable or not.
      • Methods inherited from interface javax.swing.ListSelectionModel

        addListSelectionListener, addSelectionInterval, clearSelection, getAnchorSelectionIndex, getLeadSelectionIndex, getMaxSelectionIndex, getMinSelectionIndex, getSelectedIndices, getSelectedItemsCount, getSelectionMode, getValueIsAdjusting, insertIndexInterval, isSelectedIndex, isSelectionEmpty, removeIndexInterval, removeListSelectionListener, removeSelectionInterval, setAnchorSelectionIndex, setLeadSelectionIndex, setSelectionInterval, setSelectionMode, setValueIsAdjusting
    • Method Detail

      • getSelected

        EventList<E> getSelected()
        Gets an EventList that contains only selected values and modifies the source list on mutation. Adding and removing items from this list performs the same operation on the source list.
      • getTogglingSelected

        EventList<E> getTogglingSelected()
        Gets an EventList that contains only selected values and modifies the selection state on mutation. Adding an item to this list selects it and removing an item deselects it. If an item not in the source list is added an IllegalArgumentException is thrown.
      • getDeselected

        EventList<E> getDeselected()
        Gets an EventList that contains only deselected values and modifies the source list on mutation. Adding and removing items from this list performs the same operation on the source list.
      • getTogglingDeselected

        EventList<E> getTogglingDeselected()
        Gets an EventList that contains only deselected values and modifies the selection state on mutation. Adding an item to this list deselects it and removing an item selects it. If an item not in the source list is added an IllegalArgumentException is thrown
      • setEnabled

        void setEnabled​(boolean enabled)
        Set the EventSelectionModel as editable or not. This means that the user cannot manipulate the selection by clicking. The selection can still be changed as the source list changes.

        Note that this will also disable the selection from being modified programatically. Therefore you must use setEnabled(true) to modify the selection in code.

      • getEnabled

        boolean getEnabled()
        Returns whether the EventSelectionModel is editable or not.
      • addValidSelectionMatcher

        void addValidSelectionMatcher​(Matcher<E> validSelectionMatcher)
        Add a matcher which decides when source elements are valid for selection.
        Parameters:
        validSelectionMatcher - returns true if a source element can be selected; false otherwise
      • removeValidSelectionMatcher

        void removeValidSelectionMatcher​(Matcher<E> validSelectionMatcher)
        Remove a matcher which decides when source elements are valid for selection.
        Parameters:
        validSelectionMatcher - returns true if a source element can be selected; false otherwise
      • invertSelection

        void invertSelection()
        Inverts the current selection.