com.vaadin.client.componentlocator
Class LegacyLocatorStrategy

java.lang.Object
  extended by com.vaadin.client.componentlocator.LegacyLocatorStrategy
All Implemented Interfaces:
LocatorStrategy

public class LegacyLocatorStrategy
extends java.lang.Object
implements LocatorStrategy

The LegacyLocatorStrategy class handles the legacy locator syntax that was introduced in version 5.4 of the framework. The legacy locator strategy is always used if no other strategy claims responsibility for a locator string.

Since:
7.2
Author:
Vaadin Ltd

Constructor Summary
LegacyLocatorStrategy(ApplicationConnection clientConnection)
           
 
Method Summary
 Element getElementByPath(java.lang.String path)
          Locates an element using a String locator (path) which identifies a DOM element.
 Element getElementByPathStartingAt(java.lang.String path, Element baseElement)
          Locates an element using a String locator (path) which identifies a DOM element.
 java.util.List<Element> getElementsByPath(java.lang.String path)
          Locates all elements that match a String locator (path) which identifies DOM elements.
 java.util.List<Element> getElementsByPathStartingAt(java.lang.String path, Element root)
          Locates all elements that match a String locator (path) which identifies DOM elements.
 java.lang.String getPathForElement(Element targetElement)
          Generates a String locator which uniquely identifies the target element.
 boolean validatePath(java.lang.String path)
          Test the given input path for formatting errors.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LegacyLocatorStrategy

public LegacyLocatorStrategy(ApplicationConnection clientConnection)
Method Detail

validatePath

public boolean validatePath(java.lang.String path)
Description copied from interface: LocatorStrategy
Test the given input path for formatting errors. If a given path can not be validated, the locator strategy will not be attempted.

Specified by:
validatePath in interface LocatorStrategy
Parameters:
path - a locator path expression
Returns:
true, if the implementing class can process the given path, otherwise false

getPathForElement

public java.lang.String getPathForElement(Element targetElement)
Description copied from interface: LocatorStrategy
Generates a String locator which uniquely identifies the target element. The LocatorStrategy.getElementByPath(String) method can be used for the inverse operation, i.e. locating an element based on the return value from this method.

Note that getElementByPath(getPathForElement(element)) == element is not always true as #getPathForElement(Element) can return a path to another element if the widget determines an action on the other element will give the same result as the action on the target element.

Specified by:
getPathForElement in interface LocatorStrategy
Parameters:
targetElement - The element to generate a path for.
Returns:
A String locator that identifies the target element or null if a String locator could not be created.

getElementByPath

public Element getElementByPath(java.lang.String path)
Locates an element using a String locator (path) which identifies a DOM element. The LocatorStrategy.getPathForElement(Element) method can be used for the inverse operation, i.e. generating a string expression for a DOM element.

Specified by:
getElementByPath in interface LocatorStrategy
Parameters:
path - The String locator which identifies the target element.
Returns:
The DOM element identified by path or null if the element could not be located.

getElementByPathStartingAt

public Element getElementByPathStartingAt(java.lang.String path,
                                          Element baseElement)
Locates an element using a String locator (path) which identifies a DOM element. The path starts from the specified root element.

Specified by:
getElementByPathStartingAt in interface LocatorStrategy
Parameters:
path - The String locator which identifies the target element.
baseElement - The element that is at the root of the path.
Returns:
The DOM element identified by path or null if the element could not be located.
See Also:
LocatorStrategy.getElementByPath(String)

getElementsByPath

public java.util.List<Element> getElementsByPath(java.lang.String path)
Locates all elements that match a String locator (path) which identifies DOM elements. This functionality is limited in LegacyLocatorStrategy.

Specified by:
getElementsByPath in interface LocatorStrategy
Parameters:
path - The String locator which identifies target elements.
Returns:
List that contains all matched elements. Empty list if none found.

getElementsByPathStartingAt

public java.util.List<Element> getElementsByPathStartingAt(java.lang.String path,
                                                           Element root)
Locates all elements that match a String locator (path) which identifies DOM elements. The path starts from the specified root element. This functionality is limited in LegacyLocatorStrategy.

Specified by:
getElementsByPathStartingAt in interface LocatorStrategy
Parameters:
path - The String locator which identifies target elements.
root - The element that is at the root of the path.
Returns:
List that contains all matched elements. Empty list if none found.
See Also:
LocatorStrategy.getElementsByPath(String)


Copyright © 2000-2014 Vaadin Ltd. All Rights Reserved.