Class OrderedSelectionRecorder

  • All Implemented Interfaces:
    java.util.EventListener, javax.swing.event.ListSelectionListener

    public abstract class OrderedSelectionRecorder
    extends java.lang.Object
    implements javax.swing.event.ListSelectionListener
    ListSelectionListener implementation which can tell you what order items have been selected in.
    Since:
    16 Jun 2004
    Author:
    Mark Taylor (Starlink)
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract boolean[] getModelState()
      Returns the state of the selection model given the source of a selection event.
      int[] getOrderedSelection()
      Returns a list of the currently-selected indices in the selection model in the order in which they were (most recently) added to the selection.
      void updateState​(boolean[] state)
      Sets the new selection state.
      void valueChanged​(javax.swing.event.ListSelectionEvent evt)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • OrderedSelectionRecorder

        public OrderedSelectionRecorder()
        Constructs a new recorder with no items selected.
      • OrderedSelectionRecorder

        public OrderedSelectionRecorder​(boolean[] state)
        Constructs a new recorder with a given initial state.
        Parameters:
        state - mask of flags, one true for each selected item
    • Method Detail

      • getOrderedSelection

        public int[] getOrderedSelection()
        Returns a list of the currently-selected indices in the selection model in the order in which they were (most recently) added to the selection.
        Returns:
        ordered selection model indices
      • valueChanged

        public void valueChanged​(javax.swing.event.ListSelectionEvent evt)
        Specified by:
        valueChanged in interface javax.swing.event.ListSelectionListener
      • updateState

        public void updateState​(boolean[] state)
        Sets the new selection state.
        Parameters:
        state - mask of flags, one true for each selected item
      • getModelState

        protected abstract boolean[] getModelState()
        Returns the state of the selection model given the source of a selection event.
        Returns:
        mask of flags, one true for each selected item