org.zkoss.ztl
Class JQuery

java.lang.Object
  extended by org.openqa.selenium.By
      extended by org.zkoss.ztl.ClientWidget
          extended by org.zkoss.ztl.JQuery
All Implemented Interfaces:
java.lang.Iterable<JQuery>

public class JQuery
extends ClientWidget
implements java.lang.Iterable<JQuery>

A simulator of JQuery client side object, which wraps the JQuery client side API.

Author:
jumperchen

Nested Class Summary
 
Nested classes/interfaces inherited from class org.openqa.selenium.By
org.openqa.selenium.By.ByClassName, org.openqa.selenium.By.ByCssSelector, org.openqa.selenium.By.ById, org.openqa.selenium.By.ByLinkText, org.openqa.selenium.By.ByName, org.openqa.selenium.By.ByPartialLinkText, org.openqa.selenium.By.ByTagName, org.openqa.selenium.By.ByXPath
 
Field Summary
 
Fields inherited from class org.zkoss.ztl.ClientWidget
_out
 
Constructor Summary
JQuery(ClientWidget el)
           
JQuery(java.lang.String uuid)
           
JQuery(java.lang.StringBuffer out)
           
JQuery(java.lang.StringBuffer out, java.lang.String script)
           
 
Method Summary
 java.lang.String attr(java.lang.String name)
          Returns the attribute value from the given name.
 JQuery children()
          Returns the child element in JQuery object.
 JQuery children(java.lang.String selector)
          Returns the child element in JQuery object.
 java.lang.String css(java.lang.String name)
          Returns the CSS value from the given name.
 JQuery eq(int index)
          proxy for jQuery eq method
 boolean exists()
          Returns whether the widget exists or not.
 JQuery find(java.lang.String selector)
          Finds the element from the given selector.
 JQuery first()
          Returns the first element in JQuery object.
 Element get(int index)
          proxy for jQuery get method
 boolean hasClass(java.lang.String className)
          Returns whether includes the className.
 int height()
          Returns the current computed height for the first element.
 java.lang.String html()
          Returns the html content(innerHTML)
 int innerHeight()
          Returns the current computed height for the first element, including padding but not border.
 int innerWidth()
          Returns the current computed width for the first element, including padding but not border.
 boolean is(java.lang.String selector)
          check the jquery element match the selector.
 boolean isVisible()
          a short cut for visible
 java.util.Iterator<JQuery> iterator()
           
 JQuery last()
          Returns the last element in JQuery object.
 int length()
          Returns the length of the array from the jQuery object.
 JQuery next()
          Returns the next element in JQuery object.
 int offsetLeft()
          Returns the current computed offsetLeft for the first element
 int offsetTop()
          Returns the current computed offsetTop for the first element
 int outerHeight()
          Returns the current computed height for the first element, including padding and border.
 int outerHeight(boolean includeMargin)
          Returns the current computed height for the first element, including padding and border, it will including margin, if true
 int outerWidth()
          Returns the current computed width for the first element, including padding and border.
 int outerWidth(boolean includeMargin)
          Returns the current computed width for the first element, including padding and border, it will including margin, if true
 JQuery parent()
          Returns the parent element in JQuery object.
 JQuery parent(java.lang.String selector)
          Returns the parent element in JQuery object.
 JQuery parents(java.lang.String selector)
          Returns the parents element in JQuery object.
 int positionLeft()
          Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first element
 int positionTop()
          Returns the current computed positionTop (the offsetTop relative to the parent) for the first element
 JQuery prev()
          Returns the previous element in JQuery object.
static int scrollbarWidth()
          Returns the scrollbar width.
 int scrollHeight()
          Note:This not a jQuery base method.
 int scrollLeft()
          getter for scrollLeft if multiple result , will receive first value.
 void scrollLeft(int value)
          setter for scrollLeft
 int scrollTop()
          getter for scrollTop if multiple result , will receive first value.
 void scrollTop(int value)
          setter for scrollTop
 int scrollWidth()
          Note:This not a jQuery base method.
 java.lang.String text()
          Returns the text content
 org.openqa.selenium.By toBy()
          Returns the element as By element, if possible.
 Element toElement()
          Returns the element from this client widget.
 Widget toWidget()
          translate to widget.
 java.lang.String val()
          Returns the current value of the first element in the set of matched elements.
 int width()
          Returns the current computed width for the first element.
 ZK zk()
          Switches to the ZK object.
 
Methods inherited from class org.zkoss.ztl.ClientWidget
eval, eval, findElements, isBlank, isEmpty, toLocator, toString, toUpperCase
 
Methods inherited from class org.openqa.selenium.By
className, cssSelector, equals, findElement, hashCode, id, linkText, name, partialLinkText, tagName, xpath
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JQuery

public JQuery(java.lang.String uuid)

JQuery

public JQuery(ClientWidget el)

JQuery

public JQuery(java.lang.StringBuffer out,
              java.lang.String script)

JQuery

public JQuery(java.lang.StringBuffer out)
Method Detail

css

public java.lang.String css(java.lang.String name)
Returns the CSS value from the given name.

Parameters:
name - CSS name.

attr

public java.lang.String attr(java.lang.String name)
Returns the attribute value from the given name.

Parameters:
name - attribute name of the element.

hasClass

public boolean hasClass(java.lang.String className)
Returns whether includes the className.

Parameters:
className - the CSS class name.

is

public boolean is(java.lang.String selector)
check the jquery element match the selector. (We port this from jQuery);

Parameters:
selector - the JQuery allowed
Returns:

isVisible

public boolean isVisible()
a short cut for visible


find

public JQuery find(java.lang.String selector)
Finds the element from the given selector.

Parameters:
selector - the JQuery allowed.

first

public JQuery first()
Returns the first element in JQuery object.


last

public JQuery last()
Returns the last element in JQuery object.


prev

public JQuery prev()
Returns the previous element in JQuery object.


next

public JQuery next()
Returns the next element in JQuery object.


children

public JQuery children()
Returns the child element in JQuery object.


children

public JQuery children(java.lang.String selector)
Returns the child element in JQuery object.


parent

public JQuery parent()
Returns the parent element in JQuery object.


parent

public JQuery parent(java.lang.String selector)
Returns the parent element in JQuery object.


parents

public JQuery parents(java.lang.String selector)
Returns the parents element in JQuery object.


text

public java.lang.String text()
Returns the text content


html

public java.lang.String html()
Returns the html content(innerHTML)


val

public java.lang.String val()
Returns the current value of the first element in the set of matched elements.

Returns:

height

public int height()
Returns the current computed height for the first element.


width

public int width()
Returns the current computed width for the first element.


innerHeight

public int innerHeight()
Returns the current computed height for the first element, including padding but not border.


innerWidth

public int innerWidth()
Returns the current computed width for the first element, including padding but not border.


outerWidth

public int outerWidth()
Returns the current computed width for the first element, including padding and border.


outerWidth

public int outerWidth(boolean includeMargin)
Returns the current computed width for the first element, including padding and border, it will including margin, if true

Parameters:
boolean - includeMargin

outerHeight

public int outerHeight()
Returns the current computed height for the first element, including padding and border.


outerHeight

public int outerHeight(boolean includeMargin)
Returns the current computed height for the first element, including padding and border, it will including margin, if true

Parameters:
boolean - includeMargin

length

public int length()
Returns the length of the array from the jQuery object.


zk

public ZK zk()
Switches to the ZK object.


toBy

public org.openqa.selenium.By toBy()
Description copied from class: ClientWidget
Returns the element as By element, if possible.

Specified by:
toBy in class ClientWidget

scrollbarWidth

public static int scrollbarWidth()
Returns the scrollbar width.


exists

public boolean exists()
Returns whether the widget exists or not.


offsetLeft

public int offsetLeft()
Returns the current computed offsetLeft for the first element


offsetTop

public int offsetTop()
Returns the current computed offsetTop for the first element


positionLeft

public int positionLeft()
Returns the current computed positionLeft (the offsetLeft relative to the parent) for the first element

Returns:

positionTop

public int positionTop()
Returns the current computed positionTop (the offsetTop relative to the parent) for the first element

Returns:

scrollTop

public int scrollTop()
getter for scrollTop if multiple result , will receive first value.

Returns:

scrollTop

public void scrollTop(int value)
setter for scrollTop

Parameters:
value -

scrollLeft

public int scrollLeft()
getter for scrollLeft if multiple result , will receive first value.

Returns:

scrollLeft

public void scrollLeft(int value)
setter for scrollLeft

Parameters:
value -

scrollHeight

public int scrollHeight()
Note:This not a jQuery base method. just a short cut ,in javascript's world equals get(0).scrollHeight

Returns:

scrollWidth

public int scrollWidth()
Note:This not a jQuery base method. just a short cut ,in javascript's world equals get(0).scrollWidth

Returns:

get

public Element get(int index)
proxy for jQuery get method

Parameters:
index -
Returns:
Element the dom element

toElement

public Element toElement()
Description copied from class: ClientWidget
Returns the element from this client widget.

Specified by:
toElement in class ClientWidget

eq

public JQuery eq(int index)
proxy for jQuery eq method

Parameters:
index -
Returns:

iterator

public java.util.Iterator<JQuery> iterator()
Specified by:
iterator in interface java.lang.Iterable<JQuery>

toWidget

public Widget toWidget()
translate to widget. (a shortcut for new Widget($obj) );

Returns:


Copyright © 2015. All Rights Reserved.