javax.swing.plaf.basic
Class BasicListUI.IncrementLeadSelectionAction

java.lang.Object
  extended byjavax.swing.AbstractAction
      extended byjavax.swing.plaf.basic.BasicListUI.IncrementLeadSelectionAction
All Implemented Interfaces:
Action, ActionListener, Cloneable, EventListener, Serializable
Direct Known Subclasses:
BasicListUI.EndAction, BasicListUI.HomeAction, BasicListUI.IncrementLeadByColumnAction, BasicListUI.PageDownAction, BasicListUI.PageUpAction
Enclosing class:
BasicListUI

private static class BasicListUI.IncrementLeadSelectionAction
extends AbstractAction

Action to increment the selection in the list up/down a row at a type. This also has the option to extend the selection, or only move the lead.


Nested Class Summary
 
Nested classes inherited from class javax.swing.AbstractAction
 
Field Summary
protected  int amount
          Amount to offset, subclasses will define what this means.
protected  int selectionType
          One of CHANGE_LEAD, CHANGE_SELECTION or EXTEND_SELECTION.
 
Fields inherited from class javax.swing.AbstractAction
changeSupport, enabled
 
Fields inherited from interface javax.swing.Action
ACCELERATOR_KEY, ACTION_COMMAND_KEY, DEFAULT, LONG_DESCRIPTION, MNEMONIC_KEY, NAME, SHORT_DESCRIPTION, SMALL_ICON
 
Constructor Summary
protected BasicListUI.IncrementLeadSelectionAction(String name, int type)
           
protected BasicListUI.IncrementLeadSelectionAction(String name, int type, int amount)
           
 
Method Summary
 void actionPerformed(ActionEvent e)
          Invokes getNextIndex to determine the next index to select.
protected  void ensureIndexIsVisible(JList list, int index)
          Ensures the particular index is visible.
protected  int getAmount(JList list)
          Returns the amount to increment by.
protected  int getNextIndex(JList list)
          Returns the next index to select.
 
Methods inherited from class javax.swing.AbstractAction
addPropertyChangeListener, clone, firePropertyChange, getKeys, getPropertyChangeListeners, getValue, isEnabled, putValue, removePropertyChangeListener, setEnabled
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

amount

protected int amount
Amount to offset, subclasses will define what this means.


selectionType

protected int selectionType
One of CHANGE_LEAD, CHANGE_SELECTION or EXTEND_SELECTION.

Constructor Detail

BasicListUI.IncrementLeadSelectionAction

protected BasicListUI.IncrementLeadSelectionAction(String name,
                                                   int type)

BasicListUI.IncrementLeadSelectionAction

protected BasicListUI.IncrementLeadSelectionAction(String name,
                                                   int type,
                                                   int amount)
Method Detail

getNextIndex

protected int getNextIndex(JList list)
Returns the next index to select. This is based on the lead selected index and the amount ivar.


getAmount

protected int getAmount(JList list)
Returns the amount to increment by.


ensureIndexIsVisible

protected void ensureIndexIsVisible(JList list,
                                    int index)
Ensures the particular index is visible. This simply forwards the method to list.


actionPerformed

public void actionPerformed(ActionEvent e)
Invokes getNextIndex to determine the next index to select. If the index is valid (not -1 and < size of the model), this will either: move the selection to the new index if the selectionType == CHANGE_SELECTION, move the lead to the new index if selectionType == CHANGE_LEAD, otherwise the selection is extend from the anchor to the new index and the lead is set to the new index.