org.fest.swing.driver
Class JMenuItemMatcher

java.lang.Object
  extended by org.fest.swing.driver.JMenuItemMatcher
All Implemented Interfaces:
ComponentMatcher

public class JMenuItemMatcher
extends Object
implements ComponentMatcher

Matches a JMenuItem given a simple label or a menu path of the format "menu|submenu|menuitem", for example "File|Open|Can of worms". Adapted from Abbot's own JMenuItemMatcher.

Author:
Yvonne Wang, Alex Ruiz

Constructor Summary
JMenuItemMatcher(String... path)
          Creates a new JMenuItemMatcher.
 
Method Summary
 boolean matches(Component c)
          Indicates whether the given component is a JMenuItem whose text matches the path specified in this matcher.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JMenuItemMatcher

public JMenuItemMatcher(String... path)
Creates a new JMenuItemMatcher.

Parameters:
path - the path of the menu to match.
Method Detail

matches

@RunsInCurrentThread
public boolean matches(Component c)
Indicates whether the given component is a JMenuItem whose text matches the path specified in this matcher.

Note: This method is not guaranteed to be executed in the event dispatch thread (EDT.) Clients are responsible for calling this method from the EDT.

Specified by:
matches in interface ComponentMatcher
Parameters:
c - the component to verify.
Returns:
true if the component matches, false otherwise.

toString

public String toString()
Overrides:
toString in class Object


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