org.fest.swing.driver
Class JMenuItemLocation

java.lang.Object
  extended by org.fest.swing.driver.JMenuItemLocation

public final class JMenuItemLocation
extends Object

Understands the location of a JMenuItem.

Author:
Alex Ruiz

Constructor Summary
JMenuItemLocation(JMenuItem menuItem)
          Creates a new JMenuItemLocation.
 
Method Summary
 boolean inMenuBar()
          Indicates whether the JMenuItem is in a JMenuBar.
 boolean isParentAMenu()
          Indicates whether the parent of the JMenuItem is another menu.
 Component parentOrInvoker()
          Returns the parent of JMenuItem, or its invoker (if it is in a pop-up.)
 JPopupMenu parentPopup()
          Returns the parent pop-up menu, or null if the JMenuItem is not in a pop-up.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JMenuItemLocation

@RunsInCurrentThread
public JMenuItemLocation(JMenuItem menuItem)
Creates a new JMenuItemLocation.

Note: This constructor is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for ensuring that this constructor is executed in the EDT.

Parameters:
menuItem - the target JMenuItem.
Method Detail

inMenuBar

public boolean inMenuBar()
Indicates whether the JMenuItem is in a JMenuBar.

Returns:
true if the JMenuItem is in a JMenuBar, false otherwise.

isParentAMenu

@RunsInEDT
public boolean isParentAMenu()
Indicates whether the parent of the JMenuItem is another menu.

Returns:
true if the parent of the JMenuItem is another menu, false otherwise.

parentOrInvoker

public Component parentOrInvoker()
Returns the parent of JMenuItem, or its invoker (if it is in a pop-up.)

Returns:
the parent or the invoker of the JMenuItem.

parentPopup

public JPopupMenu parentPopup()
Returns the parent pop-up menu, or null if the JMenuItem is not in a pop-up.

Returns:
the parent pop-up menu, or null if the JMenuItem is not in a pop-up.


Copyright © 2007-2011 FEST (Fixtures for Easy Software Testing). All Rights Reserved.