dsto.dfc.swing.commands
Class WindowFocusTracker

java.lang.Object
  extended by dsto.dfc.swing.commands.WindowFocusTracker
All Implemented Interfaces:
AWTEventListener, EventListener

public class WindowFocusTracker
extends Object
implements AWTEventListener

Track focus changes across components in a window and sets command view's active property based on focus heirachy. This can be used to resolve overloaded commands based on component focus.

Version:
$Revision$
Author:
Matthew
See Also:
CommandView.activate()

Constructor Summary
WindowFocusTracker(Window window, String view)
          Create a focus tracker for a given window.
WindowFocusTracker(Window window, String[] views)
          Create a focus tracker for a given window.
 
Method Summary
 void dispose()
           
 void eventDispatched(AWTEvent e)
           
protected  void setFocusedComponent(Component newFocus)
           
protected  void setViewsActive(Component start, Component stop, boolean active)
          Walk down a chain of components, setting their command views 'active' property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WindowFocusTracker

public WindowFocusTracker(Window window,
                          String view)
Create a focus tracker for a given window.

Parameters:
window - The window to track focus in.
view - The view type to manage (eg CommandView.MAIN_MENU_VIEW),

WindowFocusTracker

public WindowFocusTracker(Window window,
                          String[] views)
Create a focus tracker for a given window.

Parameters:
window - The window to track focus in.
views - The view types to manage (eg CommandView.MAIN_MENU_VIEW),
Method Detail

dispose

public void dispose()

setFocusedComponent

protected void setFocusedComponent(Component newFocus)

setViewsActive

protected void setViewsActive(Component start,
                              Component stop,
                              boolean active)
Walk down a chain of components, setting their command views 'active' property.

Parameters:
start - The component (inclusive) to begin at.
stop - The component (not inclusive) to end at.
active - The new value of command view's active property.

eventDispatched

public void eventDispatched(AWTEvent e)
Specified by:
eventDispatched in interface AWTEventListener


Copyright © 2008 Commonwealth of Australia