com.pietschy.command.util
Class DefaultWindowSearchStrategy

java.lang.Object
  extended by com.pietschy.command.util.DefaultWindowSearchStrategy
All Implemented Interfaces:
WindowSearchStrategy

public class DefaultWindowSearchStrategy
extends java.lang.Object
implements WindowSearchStrategy

Default WindowSearchStrategy used by commands for finding the parent windows of components. This implementation is able to locate the parent window of JPopupMenus.


Constructor Summary
DefaultWindowSearchStrategy()
          Creates a new instance.
 
Method Summary
 java.awt.Window findParentWindow(java.awt.Component component)
          Invoked to find the parent window of the specified component.
protected  javax.swing.JPopupMenu getTopLevelPopup(javax.swing.JPopupMenu popup)
          Traverses the popup hierarchy to finds the highest level popup from the specified instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultWindowSearchStrategy

public DefaultWindowSearchStrategy()
Creates a new instance.

Method Detail

findParentWindow

public java.awt.Window findParentWindow(java.awt.Component component)
Description copied from interface: WindowSearchStrategy
Invoked to find the parent window of the specified component.

Specified by:
findParentWindow in interface WindowSearchStrategy
Parameters:
component - the component of interest.
Returns:
the window parent of the component, or null if none can be found.

getTopLevelPopup

protected javax.swing.JPopupMenu getTopLevelPopup(javax.swing.JPopupMenu popup)
Traverses the popup hierarchy to finds the highest level popup from the specified instance.

Parameters:
popup - the popup of interest.
Returns:
the highest level popup parent of the specified popup.


Copyright © 2006 - 2007 Andrew Pietsch