com.smartgwt.client.types
Enum LocatorStrategy

java.lang.Object
  extended by java.lang.Enum<LocatorStrategy>
      extended by com.smartgwt.client.types.LocatorStrategy
All Implemented Interfaces:
ValueEnum, Serializable, Comparable<LocatorStrategy>

public enum LocatorStrategy
extends Enum<LocatorStrategy>
implements ValueEnum

The AutoTest subsystem relies on generating and parsing identifier strings to identify components on the page. A very common pattern is identifying a specific component within a list of possible candidates. There are many many cases where this pattern is used, for example - members in a layout,tabs in a tabset, sections in a section stack.

In order to make these identifiers as robust as possible across minor changes to an application, (such as skin changes, minor layout changes, etc) the system will store multiple pieces of information about a component when generating an identification string to retrieve it from a list of candidates. The system has a default strategy for choosing the order in which to look at these pieces of information but in some cases this can be overridden by setting a LocatorStrategy.

By default we use the following strategies in order to identify a component from a list of candidates:

If an explicit strategy is specified, that will be used to locate the component if possible. If no matching component is found using that strategy, we will continue to try the remaining strategies in order as described above. In other words setting a locatorStrategy to "title" will skip attempting to find a component by name, and instead attempt to find by title - or failing that by index.

Note that we also support matching by type (see LocatorTypeStrategy). Matching by type is used if we were unable to match by name or title or to disambiguate between multiple components with a matching title.


Enum Constant Summary
INDEX
          Match by index
NAME
          Match by name if possible.
TITLE
          Match by title if possible.
 
Method Summary
 String getValue()
           
static LocatorStrategy valueOf(String name)
          Returns the enum constant of this type with the specified name.
static LocatorStrategy[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NAME

public static final LocatorStrategy NAME
Match by name if possible.


TITLE

public static final LocatorStrategy TITLE
Match by title if possible.


INDEX

public static final LocatorStrategy INDEX
Match by index

Method Detail

values

public static LocatorStrategy[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (LocatorStrategy c : LocatorStrategy.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static LocatorStrategy valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name
NullPointerException - if the argument is null

getValue

public String getValue()
Specified by:
getValue in interface ValueEnum