com.appfoundation.automation.framework.gwen.business
Class LocatorAssembler

java.lang.Object
  extended by com.appfoundation.automation.framework.gwen.business.LocatorAssembler

public class LocatorAssembler
extends java.lang.Object

Locator Assembler

The purpose of this class is to generate XPath from a Locator object, which specifies the type of web element to find, the method for finding it, and a user input value.

Author:
john.valentino

Field Summary
private static java.lang.String ID_IN_DIV_ERROR
           
 
Constructor Summary
LocatorAssembler()
           
 
Method Summary
protected  java.lang.String button(ByType by, java.lang.String value)
          Handles generating the xpath for locating a web element type of Button
protected  java.lang.String checkbox(ByType by, java.lang.String value)
           
protected  java.lang.String element(ByType by, java.lang.String value)
          Handles creating the XPath for the element type
protected  java.lang.String extjscheckbox(ByType by, java.lang.String value)
           
protected  java.lang.String extjscoloroption(ByType by, java.lang.String value)
           
protected  java.lang.String extjscombobutton(ByType by, java.lang.String value)
          Handles generating the XPath for an ExtJS combo box button
protected  java.lang.String extjscomboitem(ByType by, java.lang.String value)
           
protected  java.lang.String extjsdatebutton(ByType by, java.lang.String value)
           
protected  java.lang.String extjsdialog(ByType by, java.lang.String value)
          Handles generating the XPath for an extjsdialog Web Element Type
protected  java.lang.String extjsdialogbutton(ByType by, java.lang.String value)
          Handles generating the XPath for an extjsdialogbutton Web Element Type
protected  java.lang.String extjsgrid(ByType by, java.lang.String value)
          Handles generating the XPath for the extjsgrid Web Element Type.
protected  java.lang.String extjsgridrow(ByType by, java.lang.String value)
          Handles generating the XPath for the extjsgridrow Web Element Type.
protected  java.lang.String extjsgridrowexpand(ByType by, java.lang.String value)
          Handles generating the XPath for the extjsgridrowexpand Web Element Type.
protected  java.lang.String extjshtmleditor(ByType by, java.lang.String value)
           
protected  java.lang.String extjsradio(ByType by, java.lang.String value)
           
protected  java.lang.String extjsslider(ByType by, java.lang.String value)
           
protected  java.lang.String extjssplitbuttonitem(ByType by, java.lang.String value)
          Handles generating the XPath for an extjssplitbuttonitem Web Element Type.
protected  DivResult handleDivEmbed(java.lang.String value)
          Handles location expression values that contain // in order to specify that something is in a div
protected  java.lang.String input(ByType by, java.lang.String value)
          Handles generating the XPath for a web element type of Input
 boolean isInteger(java.lang.String s)
          Returns true if the given String is a valid integer
protected  java.lang.String link(ByType by, java.lang.String value)
           
protected  java.lang.String option(ByType by, java.lang.String value)
           
protected  java.lang.String radio(ByType by, java.lang.String value)
           
protected  java.lang.String select(ByType by, java.lang.String value)
           
protected  java.lang.String table(ByType by, java.lang.String value)
          Handles generating the XPath for the table web element type.
protected  java.lang.String tabledata(ByType by, java.lang.String value)
          Handles generating the XPath for a tabledata Web Element Type.
protected  java.lang.String tablerow(ByType by, java.lang.String value)
          Handles generating the XPath for the given tablerow Web Element Type.
protected  java.lang.String textarea(ByType by, java.lang.String value)
           
protected  int[] toRowColumn(java.lang.String value)
          Takes a string in the format of "1,2" and return an array of two integers.
protected  java.lang.String touchbutton(ByType by, java.lang.String value)
           
protected  java.lang.String touchcheckbox(ByType by, java.lang.String value, java.lang.String component)
           
protected  java.lang.String touchlistitem(ByType by, java.lang.String value)
           
protected  java.lang.String touchradio(ByType by, java.lang.String value)
           
protected  java.lang.String touchslider(ByType by, java.lang.String value)
           
protected  java.lang.String touchspinnerdown(ByType by, java.lang.String value)
           
protected  java.lang.String touchspinnerup(ByType by, java.lang.String value)
           
 java.lang.String xpath(Locator locator)
          Converts the given Locator object expression into XPath, or throws an error if it is invalid in some way.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ID_IN_DIV_ERROR

private static final java.lang.String ID_IN_DIV_ERROR
See Also:
Constant Field Values
Constructor Detail

LocatorAssembler

public LocatorAssembler()
Method Detail

xpath

public java.lang.String xpath(Locator locator)
                       throws LocatorFormatException
Converts the given Locator object expression into XPath, or throws an error if it is invalid in some way.

Parameters:
locator -
Returns:
Throws:
LocatorFormatException

element

protected java.lang.String element(ByType by,
                                   java.lang.String value)
                            throws LocatorFormatException
Handles creating the XPath for the element type

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

handleDivEmbed

protected DivResult handleDivEmbed(java.lang.String value)
Handles location expression values that contain // in order to specify that something is in a div

Parameters:
value -
Returns:

input

protected java.lang.String input(ByType by,
                                 java.lang.String value)
                          throws LocatorFormatException
Handles generating the XPath for a web element type of Input

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

button

protected java.lang.String button(ByType by,
                                  java.lang.String value)
                           throws LocatorFormatException
Handles generating the xpath for locating a web element type of Button

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjsdialog

protected java.lang.String extjsdialog(ByType by,
                                       java.lang.String value)
                                throws LocatorFormatException
Handles generating the XPath for an extjsdialog Web Element Type

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjsdialogbutton

protected java.lang.String extjsdialogbutton(ByType by,
                                             java.lang.String value)
                                      throws LocatorFormatException
Handles generating the XPath for an extjsdialogbutton Web Element Type

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjssplitbuttonitem

protected java.lang.String extjssplitbuttonitem(ByType by,
                                                java.lang.String value)
                                         throws LocatorFormatException
Handles generating the XPath for an extjssplitbuttonitem Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

isInteger

public boolean isInteger(java.lang.String s)
Returns true if the given String is a valid integer

Parameters:
s -
Returns:

tablerow

protected java.lang.String tablerow(ByType by,
                                    java.lang.String value)
                             throws LocatorFormatException
Handles generating the XPath for the given tablerow Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

toRowColumn

protected int[] toRowColumn(java.lang.String value)
Takes a string in the format of "1,2" and return an array of two integers. If the string is not in this format null is returned

Parameters:
value -
Returns:

tabledata

protected java.lang.String tabledata(ByType by,
                                     java.lang.String value)
                              throws LocatorFormatException
Handles generating the XPath for a tabledata Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

table

protected java.lang.String table(ByType by,
                                 java.lang.String value)
                          throws LocatorFormatException
Handles generating the XPath for the table web element type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjsgrid

protected java.lang.String extjsgrid(ByType by,
                                     java.lang.String value)
                              throws LocatorFormatException
Handles generating the XPath for the extjsgrid Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjsgridrow

protected java.lang.String extjsgridrow(ByType by,
                                        java.lang.String value)
                                 throws LocatorFormatException
Handles generating the XPath for the extjsgridrow Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjsgridrowexpand

protected java.lang.String extjsgridrowexpand(ByType by,
                                              java.lang.String value)
                                       throws LocatorFormatException
Handles generating the XPath for the extjsgridrowexpand Web Element Type.

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjscombobutton

protected java.lang.String extjscombobutton(ByType by,
                                            java.lang.String value)
                                     throws LocatorFormatException
Handles generating the XPath for an ExtJS combo box button

Parameters:
by -
value -
Returns:
Throws:
LocatorFormatException

extjscomboitem

protected java.lang.String extjscomboitem(ByType by,
                                          java.lang.String value)
                                   throws LocatorFormatException
Throws:
LocatorFormatException

select

protected java.lang.String select(ByType by,
                                  java.lang.String value)
                           throws LocatorFormatException
Throws:
LocatorFormatException

option

protected java.lang.String option(ByType by,
                                  java.lang.String value)
                           throws LocatorFormatException
Throws:
LocatorFormatException

extjsradio

protected java.lang.String extjsradio(ByType by,
                                      java.lang.String value)
                               throws LocatorFormatException
Throws:
LocatorFormatException

radio

protected java.lang.String radio(ByType by,
                                 java.lang.String value)
                          throws LocatorFormatException
Throws:
LocatorFormatException

extjscheckbox

protected java.lang.String extjscheckbox(ByType by,
                                         java.lang.String value)
                                  throws LocatorFormatException
Throws:
LocatorFormatException

checkbox

protected java.lang.String checkbox(ByType by,
                                    java.lang.String value)
                             throws LocatorFormatException
Throws:
LocatorFormatException

extjsdatebutton

protected java.lang.String extjsdatebutton(ByType by,
                                           java.lang.String value)
                                    throws LocatorFormatException
Throws:
LocatorFormatException

link

protected java.lang.String link(ByType by,
                                java.lang.String value)
                         throws LocatorFormatException
Throws:
LocatorFormatException

extjshtmleditor

protected java.lang.String extjshtmleditor(ByType by,
                                           java.lang.String value)
                                    throws LocatorFormatException
Throws:
LocatorFormatException

textarea

protected java.lang.String textarea(ByType by,
                                    java.lang.String value)
                             throws LocatorFormatException
Throws:
LocatorFormatException

extjscoloroption

protected java.lang.String extjscoloroption(ByType by,
                                            java.lang.String value)
                                     throws LocatorFormatException
Throws:
LocatorFormatException

extjsslider

protected java.lang.String extjsslider(ByType by,
                                       java.lang.String value)
                                throws LocatorFormatException
Throws:
LocatorFormatException

touchbutton

protected java.lang.String touchbutton(ByType by,
                                       java.lang.String value)
                                throws LocatorFormatException
Throws:
LocatorFormatException

touchspinnerup

protected java.lang.String touchspinnerup(ByType by,
                                          java.lang.String value)
                                   throws LocatorFormatException
Throws:
LocatorFormatException

touchspinnerdown

protected java.lang.String touchspinnerdown(ByType by,
                                            java.lang.String value)
                                     throws LocatorFormatException
Throws:
LocatorFormatException

touchcheckbox

protected java.lang.String touchcheckbox(ByType by,
                                         java.lang.String value,
                                         java.lang.String component)
                                  throws LocatorFormatException
Throws:
LocatorFormatException

touchradio

protected java.lang.String touchradio(ByType by,
                                      java.lang.String value)
                               throws LocatorFormatException
Throws:
LocatorFormatException

touchlistitem

protected java.lang.String touchlistitem(ByType by,
                                         java.lang.String value)
                                  throws LocatorFormatException
Throws:
LocatorFormatException

touchslider

protected java.lang.String touchslider(ByType by,
                                       java.lang.String value)
                                throws LocatorFormatException
Throws:
LocatorFormatException