javax.swing
Class LegacyGlueFocusTraversalPolicy

java.lang.Object
  |
  +--java.awt.FocusTraversalPolicy
        |
        +--javax.swing.LegacyGlueFocusTraversalPolicy
All Implemented Interfaces:
Serializable

final class LegacyGlueFocusTraversalPolicy
extends FocusTraversalPolicy
implements Serializable

A FocusTraversalPolicy which provides support for legacy applications which handle focus traversal via JComponent.setNextFocusableComponent or by installing a custom DefaultFocusManager. If a specific traversal has not been hard coded, then that traversal is provided either by the custom DefaultFocusManager, or by a wrapped FocusTraversalPolicy instance.

Version:
1.3, 12/03/01
Author:
David Mendenhall

Field Summary
private  HashMap backwardMap
           
private  DefaultFocusManager delegateManager
           
private  FocusTraversalPolicy delegatePolicy
           
private  HashMap forwardMap
           
 
Constructor Summary
(package private) LegacyGlueFocusTraversalPolicy(DefaultFocusManager delegateManager)
           
(package private) LegacyGlueFocusTraversalPolicy(FocusTraversalPolicy delegatePolicy)
           
 
Method Summary
private  boolean accept(Component aComponent)
           
 Component getComponentAfter(Container focusCycleRoot, Component aComponent)
          Suppressed: Returns the Component that should receive the focus after aComponent.
 Component getComponentBefore(Container focusCycleRoot, Component aComponent)
          Suppressed: Returns the Component that should receive the focus before aComponent.
 Component getDefaultComponent(Container focusCycleRoot)
          Suppressed: Returns the default Component to focus.
 Component getFirstComponent(Container focusCycleRoot)
          Suppressed: Returns the first Component in the traversal cycle.
 Component getLastComponent(Container focusCycleRoot)
          Suppressed: Returns the last Component in the traversal cycle.
private  void readObject(ObjectInputStream in)
           
(package private)  void setNextFocusableComponent(Component left, Component right)
           
(package private)  void unsetNextFocusableComponent(Component left, Component right)
           
private  void writeObject(ObjectOutputStream out)
           
 
Methods inherited from class java.awt.FocusTraversalPolicy
getInitialComponent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

delegatePolicy

private transient FocusTraversalPolicy delegatePolicy

delegateManager

private transient DefaultFocusManager delegateManager

forwardMap

private HashMap forwardMap

backwardMap

private HashMap backwardMap
Constructor Detail

LegacyGlueFocusTraversalPolicy

LegacyGlueFocusTraversalPolicy(FocusTraversalPolicy delegatePolicy)

LegacyGlueFocusTraversalPolicy

LegacyGlueFocusTraversalPolicy(DefaultFocusManager delegateManager)
Method Detail

setNextFocusableComponent

void setNextFocusableComponent(Component left,
                               Component right)

unsetNextFocusableComponent

void unsetNextFocusableComponent(Component left,
                                 Component right)

getComponentAfter

public Component getComponentAfter(Container focusCycleRoot,
                                   Component aComponent)
Description copied from class: FocusTraversalPolicy
Suppressed: Returns the Component that should receive the focus after aComponent. focusCycleRoot must be a focus cycle root of aComponent.

Specified by:
getComponentAfter in class FocusTraversalPolicy
Parameters:
focusCycleRoot - a focus cycle root of aComponent
aComponent - a (possibly indirect) child of focusCycleRoot, or focusCycleRoot itself
Returns:
the Component that should receive the focus after aComponent, or null if no suitable Component can be found

getComponentBefore

public Component getComponentBefore(Container focusCycleRoot,
                                    Component aComponent)
Description copied from class: FocusTraversalPolicy
Suppressed: Returns the Component that should receive the focus before aComponent. focusCycleRoot must be a focus cycle root of aComponent.

Specified by:
getComponentBefore in class FocusTraversalPolicy
Parameters:
focusCycleRoot - a focus cycle root of aComponent
aComponent - a (possibly indirect) child of focusCycleRoot, or focusCycleRoot itself
Returns:
the Component that should receive the focus before aComponent, or null if no suitable Component can be found

getFirstComponent

public Component getFirstComponent(Container focusCycleRoot)
Description copied from class: FocusTraversalPolicy
Suppressed: Returns the first Component in the traversal cycle. This method is used to determine the next Component to focus when traversal wraps in the forward direction.

Specified by:
getFirstComponent in class FocusTraversalPolicy
Parameters:
focusCycleRoot - the focus cycle root whose first Component is to be returned
Returns:
the first Component in the traversal cycle when focusCycleRoot is the focus cycle root, or null if no suitable Component can be found

getLastComponent

public Component getLastComponent(Container focusCycleRoot)
Description copied from class: FocusTraversalPolicy
Suppressed: Returns the last Component in the traversal cycle. This method is used to determine the next Component to focus when traversal wraps in the reverse direction.

Specified by:
getLastComponent in class FocusTraversalPolicy
Parameters:
focusCycleRoot - the focus cycle root whose last Component is to be returned
Returns:
the last Component in the traversal cycle when focusCycleRoot is the focus cycle root, or null if no suitable Component can be found

getDefaultComponent

public Component getDefaultComponent(Container focusCycleRoot)
Description copied from class: FocusTraversalPolicy
Suppressed: Returns the default Component to focus. This Component will be the first to receive focus when traversing down into a new focus traversal cycle rooted at focusCycleRoot.

Specified by:
getDefaultComponent in class FocusTraversalPolicy
Parameters:
focusCycleRoot - the focus cycle root whose default Component is to be returned
Returns:
the default Component in the traversal cycle when focusCycleRoot is the focus cycle root, or null if no suitable Component can be found

accept

private boolean accept(Component aComponent)

writeObject

private void writeObject(ObjectOutputStream out)
                  throws IOException
IOException

readObject

private void readObject(ObjectInputStream in)
                 throws IOException,
                        ClassNotFoundException
IOException
ClassNotFoundException


comments?