com.isti.util.gui
Class IstiFocusManager

java.lang.Object
  extended by java.awt.KeyboardFocusManager
      extended by java.awt.DefaultKeyboardFocusManager
          extended by javax.swing.FocusManager
              extended by javax.swing.DefaultFocusManager
                  extended by com.isti.util.gui.IstiFocusManager
All Implemented Interfaces:
java.awt.KeyEventDispatcher, java.awt.KeyEventPostProcessor

public class IstiFocusManager
extends javax.swing.DefaultFocusManager

Class IstiFocusManager implements the ISTI swing focus manager. This class extends the DefaultFocusManager so that it adds support for adding traversal key codes/chars and adds support for listening to focus traversal changes.


Field Summary
 
Fields inherited from class javax.swing.FocusManager
FOCUS_MANAGER_CLASS_PROPERTY
 
Fields inherited from class java.awt.KeyboardFocusManager
BACKWARD_TRAVERSAL_KEYS, DOWN_CYCLE_TRAVERSAL_KEYS, FORWARD_TRAVERSAL_KEYS, UP_CYCLE_TRAVERSAL_KEYS
 
Constructor Summary
IstiFocusManager()
           
 
Method Summary
 void addTabKeyChar(char keyChar)
          Adds the tab key code to the set.
 void addTabKeyCode(int keyCode)
          Adds the tab key code to the set.
 void addTabKeyXEnabledCompArray(java.awt.Component[] compArr)
          Adds an array of components to the list of components for which tab keycodes are translated.
 void addTabKeyXEnabledComponent(java.awt.Component compObj)
          Adds a component to the list of components for which tab keycodes are translated.
 java.awt.event.FocusListener getTraversalFocusListener()
          Returns the traversal focus listener.
 void processKeyEvent(java.awt.Component focusedComponent, java.awt.event.KeyEvent anEvent)
          This method is called by JComponents when a key event occurs.
 void setTraversalFocusListener(java.awt.event.FocusListener fl)
          Sets the traversal focus listener.
 
Methods inherited from class javax.swing.DefaultFocusManager
compareTabOrder, getComponentAfter, getComponentBefore, getFirstComponent, getLastComponent
 
Methods inherited from class javax.swing.FocusManager
disableSwingFocusManager, getCurrentManager, isFocusManagerEnabled, setCurrentManager
 
Methods inherited from class java.awt.DefaultKeyboardFocusManager
dequeueKeyEvents, discardKeyEvents, dispatchEvent, dispatchKeyEvent, downFocusCycle, enqueueKeyEvents, focusNextComponent, focusPreviousComponent, postProcessKeyEvent, upFocusCycle
 
Methods inherited from class java.awt.KeyboardFocusManager
addKeyEventDispatcher, addKeyEventPostProcessor, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, addVetoableChangeListener, clearGlobalFocusOwner, downFocusCycle, firePropertyChange, fireVetoableChange, focusNextComponent, focusPreviousComponent, getActiveWindow, getCurrentFocusCycleRoot, getCurrentKeyboardFocusManager, getDefaultFocusTraversalKeys, getDefaultFocusTraversalPolicy, getFocusedWindow, getFocusOwner, getGlobalActiveWindow, getGlobalCurrentFocusCycleRoot, getGlobalFocusedWindow, getGlobalFocusOwner, getGlobalPermanentFocusOwner, getKeyEventDispatchers, getKeyEventPostProcessors, getPermanentFocusOwner, getPropertyChangeListeners, getPropertyChangeListeners, getVetoableChangeListeners, getVetoableChangeListeners, redispatchEvent, removeKeyEventDispatcher, removeKeyEventPostProcessor, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, removeVetoableChangeListener, setCurrentKeyboardFocusManager, setDefaultFocusTraversalKeys, setDefaultFocusTraversalPolicy, setGlobalActiveWindow, setGlobalCurrentFocusCycleRoot, setGlobalFocusedWindow, setGlobalFocusOwner, setGlobalPermanentFocusOwner, upFocusCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IstiFocusManager

public IstiFocusManager()
Method Detail

getTraversalFocusListener

public java.awt.event.FocusListener getTraversalFocusListener()
Returns the traversal focus listener.

Returns:
The traversal focus listener or null if none.

setTraversalFocusListener

public void setTraversalFocusListener(java.awt.event.FocusListener fl)
Sets the traversal focus listener.

Parameters:
fl - focus listener or null for none.

addTabKeyChar

public void addTabKeyChar(char keyChar)
Adds the tab key code to the set.

Parameters:
keyChar - key character.

addTabKeyCode

public void addTabKeyCode(int keyCode)
Adds the tab key code to the set.

Parameters:
keyCode - key code.

addTabKeyXEnabledComponent

public void addTabKeyXEnabledComponent(java.awt.Component compObj)
Adds a component to the list of components for which tab keycodes are translated. If no components are entered then tab keycodes are translated for all components; otherwise tab keycodes are translated only for the entered components.

Parameters:
compObj - the component to be entered.

addTabKeyXEnabledCompArray

public void addTabKeyXEnabledCompArray(java.awt.Component[] compArr)
Adds an array of components to the list of components for which tab keycodes are translated. If no components are entered then tab keycodes are translated for all components; otherwise tab keycodes are translated only for the entered components.

Parameters:
compArr - the array of components to be entered.

processKeyEvent

public void processKeyEvent(java.awt.Component focusedComponent,
                            java.awt.event.KeyEvent anEvent)
This method is called by JComponents when a key event occurs. JComponent gives key events to the focus manager first, then to key listeners, then to the keyboard UI dispatcher. This method should look at the key event and change the focused component if the key event matches the receiver's focus manager hot keys. For example the default focus manager will change the focus if the key event matches TAB or Shift + TAB. The focus manager should call consume() on anEvent if anEvent has been processed. focusedComponent is the component that currently has the focus. Note: FocusManager will receive both KEY_PRESSED and KEY_RELEASED key events. If one event is consumed, the other one should be consumed too.

Overrides:
processKeyEvent in class java.awt.DefaultKeyboardFocusManager
Parameters:
focusedComponent - focused component
anEvent - key event.