jodd.lagarto.dom.jerry
Class Jerry

java.lang.Object
  extended by jodd.lagarto.dom.jerry.Jerry

public class Jerry
extends java.lang.Object

Jerry is JQuery in Java.


Nested Class Summary
static class Jerry.JerryParser
          Content parser and Jerry factory.
 
Field Summary
protected  Node[] nodes
           
protected  Jerry parent
           
 
Constructor Summary
protected Jerry(Jerry parent, java.util.List<Node> nodeList)
           
protected Jerry(Jerry parent, Node... nodes)
           
protected Jerry(Jerry parent, Node[] nodes1, Node[] nodes2)
           
 
Method Summary
 Jerry $(java.lang.String cssSelector)
           
 Jerry add(java.lang.String selector)
          Adds elements to the set of matched elements.
 Jerry addClass(java.lang.String... classNames)
          Adds the specified class(es) to each of the set of matched elements.
 Jerry append(java.lang.String html)
          Inserts content, specified by the parameter, to the end of each element in the set of matched elements.
 java.lang.String attr(java.lang.String name)
          Gets the value of an attribute for the first element in the set of matched elements.
 Jerry attr(java.lang.String name, java.lang.String value)
          Sets one or more attributes for the set of matched elements.
 Jerry before(java.lang.String html)
          Inserts content, specified by the parameter, before each element in the set of matched elements.
 Jerry children()
          Gets the immediate children of each element in the set of matched elements.
protected  NodeSelector createNodeSelector(Node node)
          Creates node selector.
protected  java.util.Map<java.lang.String,java.lang.String> createPropertiesMap(java.lang.String attrValue, char propertiesDelimiter, char valueDelimiter)
           
protected  java.util.Set<java.lang.String> createPropertiesSet(java.lang.String attrValue, char propertiesDelimiter)
           
 Jerry css(java.lang.String... css)
          Sets one or more CSS properties for the set of matched elements.
 java.lang.String css(java.lang.String propertyName)
          Gets the value of a style property for the first element in the set of matched elements.
 Jerry css(java.lang.String propertyName, java.lang.String value)
          Sets one or more CSS properties for the set of matched elements.
 Jerry detach()
          Removes the set of matched elements from the DOM.
 Jerry each(JerryFunction function)
          Iterates over a jQuery object, executing a function for each matched element.
 Jerry each(JerryNodeFunction function)
          Iterates over a jQuery object, executing a function for each matched element.
 Jerry empty()
          Removes all child nodes of the set of matched elements from the DOM.
 Jerry end()
          Ends the most recent filtering operation in the current chain and returns the set of matched elements to its previous state.
 Jerry eq(int value)
          Reduces the set of matched elements to the one at the specified index.
 Jerry find(java.lang.String cssSelector)
          Gets the descendants of each element in the current set of matched elements, filtered by a selector.
 Jerry first()
          Reduces the set of matched elements to the first in the set.
protected  java.lang.String generateAttributeValue(java.util.Map<java.lang.String,java.lang.String> map, char propertiesDelimiter, char valueDelimiter)
           
protected  java.lang.String generateAttributeValue(java.util.Set<java.lang.String> set, char propertiesDelimiter)
           
 Node[] get()
          Retrieve all DOM elements matched by this set.
 Node get(int index)
          Returns node at given index.
 Jerry gt(int value)
          Reduces the set of matched elements to the one at an index greater than specified index.
 boolean hasClass(java.lang.String... classNames)
          Determines whether any of the matched elements are assigned the given class.
 java.lang.String html()
          Gets the HTML contents of the first element in the set of matched elements.
 Jerry html(java.lang.String html)
          Sets the HTML contents of each element in the set of matched elements.
 int index(Node element)
          Searches for a given Node from among the matched elements.
 boolean is(java.lang.String cssSelectors)
          Checks the current matched set of elements against a selector and return true if at least one of these elements matches the given arguments.
static Jerry.JerryParser jerry()
          Just creates new Jerry runner to separate parser creation and creation of new Jerry instances.
static Jerry jerry(java.nio.CharBuffer content)
          Parses input content and creates new Jerry.
static Jerry jerry(java.lang.CharSequence content)
          Parses input sequence and creates new Jerry.
 Jerry last()
          Reduces the set of matched elements to the last in the set.
 int length()
          Returns number of nodes in this Jerry.
 Jerry lt(int value)
          Reduces the set of matched elements to the one at an index less than specified index.
 Jerry next()
          Gets the immediately following sibling of each element in the set of matched elements.
 Jerry not(java.lang.String cssSelector)
          Removes elements from the set of matched elements.
 Jerry parent()
          Gets the parent of each element in the current set of matched elements.
 Jerry prev()
          Gets the immediately preceding sibling of each element in the set of matched elements.
 Jerry remove()
          Removes the set of matched elements from the DOM.
 Jerry removeAttr(java.lang.String name)
          Removes an attribute from each element in the set of matched elements.
 Jerry removeClass(java.lang.String... classNames)
          Removes a single class, multiple classes, or all classes from each element in the set of matched elements.
 Jerry root()
          Returns root Jerry.
 Jerry siblings()
          Gets the siblings of each element in the set of matched elements.
 int size()
          Returns number of nodes in this Jerry.
 java.lang.String text()
          Gets the combined text contents of each element in the set of matched elements, including their descendants.
 Jerry text(java.lang.String text)
          Sets the content of each element in the set of matched elements to the specified text.
 Jerry toggleClass(java.lang.String... classNames)
          Adds or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.
 Jerry wrap(java.lang.String html)
          Wraps an HTML structure around each element in the set of matched elements.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected final Jerry parent

nodes

protected final Node[] nodes
Constructor Detail

Jerry

protected Jerry(Jerry parent,
                Node... nodes)

Jerry

protected Jerry(Jerry parent,
                Node[] nodes1,
                Node[] nodes2)

Jerry

protected Jerry(Jerry parent,
                java.util.List<Node> nodeList)
Method Detail

jerry

public static Jerry jerry(java.lang.CharSequence content)
Parses input sequence and creates new Jerry.


jerry

public static Jerry jerry(java.nio.CharBuffer content)
Parses input content and creates new Jerry.


jerry

public static Jerry.JerryParser jerry()
Just creates new Jerry runner to separate parser creation and creation of new Jerry instances.


length

public int length()
Returns number of nodes in this Jerry.


size

public int size()
Returns number of nodes in this Jerry.


get

public Node get(int index)
Returns node at given index.


get

public Node[] get()
Retrieve all DOM elements matched by this set.


index

public int index(Node element)
Searches for a given Node from among the matched elements.


children

public Jerry children()
Gets the immediate children of each element in the set of matched elements.


parent

public Jerry parent()
Gets the parent of each element in the current set of matched elements.


siblings

public Jerry siblings()
Gets the siblings of each element in the set of matched elements.


next

public Jerry next()
Gets the immediately following sibling of each element in the set of matched elements.


prev

public Jerry prev()
Gets the immediately preceding sibling of each element in the set of matched elements.


find

public Jerry find(java.lang.String cssSelector)
Gets the descendants of each element in the current set of matched elements, filtered by a selector.


$

public Jerry $(java.lang.String cssSelector)

createNodeSelector

protected NodeSelector createNodeSelector(Node node)
Creates node selector.


each

public Jerry each(JerryFunction function)
Iterates over a jQuery object, executing a function for each matched element.


each

public Jerry each(JerryNodeFunction function)
Iterates over a jQuery object, executing a function for each matched element.


add

public Jerry add(java.lang.String selector)
Adds elements to the set of matched elements.


end

public Jerry end()
Ends the most recent filtering operation in the current chain and returns the set of matched elements to its previous state.


not

public Jerry not(java.lang.String cssSelector)
Removes elements from the set of matched elements.


root

public Jerry root()
Returns root Jerry.


first

public Jerry first()
Reduces the set of matched elements to the first in the set.


last

public Jerry last()
Reduces the set of matched elements to the last in the set.


eq

public Jerry eq(int value)
Reduces the set of matched elements to the one at the specified index.


gt

public Jerry gt(int value)
Reduces the set of matched elements to the one at an index greater than specified index.


lt

public Jerry lt(int value)
Reduces the set of matched elements to the one at an index less than specified index.


is

public boolean is(java.lang.String cssSelectors)
Checks the current matched set of elements against a selector and return true if at least one of these elements matches the given arguments.


attr

public java.lang.String attr(java.lang.String name)
Gets the value of an attribute for the first element in the set of matched elements.


attr

public Jerry attr(java.lang.String name,
                  java.lang.String value)
Sets one or more attributes for the set of matched elements.


removeAttr

public Jerry removeAttr(java.lang.String name)
Removes an attribute from each element in the set of matched elements.


css

public java.lang.String css(java.lang.String propertyName)
Gets the value of a style property for the first element in the set of matched elements.


css

public Jerry css(java.lang.String propertyName,
                 java.lang.String value)
Sets one or more CSS properties for the set of matched elements.


css

public Jerry css(java.lang.String... css)
Sets one or more CSS properties for the set of matched elements.


addClass

public Jerry addClass(java.lang.String... classNames)
Adds the specified class(es) to each of the set of matched elements.


hasClass

public boolean hasClass(java.lang.String... classNames)
Determines whether any of the matched elements are assigned the given class.


removeClass

public Jerry removeClass(java.lang.String... classNames)
Removes a single class, multiple classes, or all classes from each element in the set of matched elements.


toggleClass

public Jerry toggleClass(java.lang.String... classNames)
Adds or remove one or more classes from each element in the set of matched elements, depending on either the class's presence or the value of the switch argument.


text

public java.lang.String text()
Gets the combined text contents of each element in the set of matched elements, including their descendants. Text is HTML decoded for text nodes.


text

public Jerry text(java.lang.String text)
Sets the content of each element in the set of matched elements to the specified text.


html

public java.lang.String html()
Gets the HTML contents of the first element in the set of matched elements. Content is raw, not HTML decoded.


html

public Jerry html(java.lang.String html)
Sets the HTML contents of each element in the set of matched elements.


append

public Jerry append(java.lang.String html)
Inserts content, specified by the parameter, to the end of each element in the set of matched elements.


before

public Jerry before(java.lang.String html)
Inserts content, specified by the parameter, before each element in the set of matched elements.


remove

public Jerry remove()
Removes the set of matched elements from the DOM.


detach

public Jerry detach()
Removes the set of matched elements from the DOM. Identical to remove().


empty

public Jerry empty()
Removes all child nodes of the set of matched elements from the DOM.


wrap

public Jerry wrap(java.lang.String html)
Wraps an HTML structure around each element in the set of matched elements. Returns the original set of elements for chaining purposes.


createPropertiesSet

protected java.util.Set<java.lang.String> createPropertiesSet(java.lang.String attrValue,
                                                              char propertiesDelimiter)

generateAttributeValue

protected java.lang.String generateAttributeValue(java.util.Set<java.lang.String> set,
                                                  char propertiesDelimiter)

createPropertiesMap

protected java.util.Map<java.lang.String,java.lang.String> createPropertiesMap(java.lang.String attrValue,
                                                                               char propertiesDelimiter,
                                                                               char valueDelimiter)

generateAttributeValue

protected java.lang.String generateAttributeValue(java.util.Map<java.lang.String,java.lang.String> map,
                                                  char propertiesDelimiter,
                                                  char valueDelimiter)


Copyright © 2003-2012 Jodd Team