Constructor and Description |
---|
ElementSelector(Element... els)
Creates a element selector that wraps the provided elements.
|
ElementSelector(Set<Element> cmps)
Creates a component selector that wraps the provided components.
|
ElementSelector(String selector,
Collection<Element> roots)
Creates a selector with the provided roots.
|
ElementSelector(String selector,
Element... roots)
Creates a selector with the provided roots.
|
ElementSelector(String selector,
Set<Element> roots)
Creates an element selector with the given selector on the provided roots.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(Element e)
Explicitly adds a component to the result set.
|
boolean |
addAll(Collection<? extends Element> c)
Adds all components in the given collection to the result set.
|
ElementSelector |
append(Element child)
Appends a child component to the first container in this set.
|
ElementSelector |
append(Object constraint,
Element child)
Appends a child component to the first container in this set.
|
void |
clear() |
boolean |
contains(Object o)
Checks if an object is contained in result set.
|
boolean |
containsAll(Collection<?> c)
Checks if the result set contains all of the components found in the provided
collection.
|
ElementSelector |
find(String selector) |
String |
getAttribute(String key)
Gets an attribute value from the first item in this found set.
|
boolean |
getBoolean(String key,
boolean defaultValue)
Gets a boolean value on this selector.
|
ElementSelector |
getChildAt(int index) |
int |
getChildIndex(Element child) |
ElementSelector |
getChildrenByTagName(String name) |
Date |
getDate(String key,
DateFormat... formats)
Gets a date value on this selector.
|
ElementSelector |
getDescendantsByTagName(String name) |
ElementSelector |
getDescendantsByTagName(String name,
int depth) |
ElementSelector |
getDescendantsByTagNameAndAttribute(String name,
String tagName,
int depth) |
double |
getDouble(String key,
double defaultValue)
Gets a double value on this selector.
|
ElementSelector |
getElementById(String id) |
ElementSelector |
getFirstChildByTagName(String name) |
int |
getInt(String key,
int defaultValue)
Gets an int value on this selector.
|
int |
getNumChildren() |
ElementSelector |
getParent() |
String |
getString(String key,
String defaultValue)
Gets a string value on this selector.
|
String |
getText() |
boolean |
hasTextChild() |
boolean |
isEmpty() |
Iterator<Element> |
iterator() |
boolean |
remove(Object o)
Explicitly removes a component from the result set.
|
boolean |
removeAll(Collection<?> c)
Removes all of the components in the provided collection from the result set.
|
ElementSelector |
removeAttribute(String attribute) |
ElementSelector |
removeChildAt(int indx) |
boolean |
retainAll(Collection<?> c)
Retains only elements of the result set that are contained in the provided collection.
|
ElementSelector |
setAttribute(String key,
String value) |
ElementSelector |
setBoolean(String key,
boolean value) |
ElementSelector |
setDate(String key,
Date date,
DateFormat fmt) |
ElementSelector |
setDouble(String key,
double value) |
ElementSelector |
setInt(String key,
int value) |
ElementSelector |
setString(String key,
String value) |
int |
size()
Returns number of results found.
|
Object[] |
toArray()
Returns results as an array.
|
<T> T[] |
toArray(T[] a)
Returns results as an array.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
equals, hashCode, spliterator
parallelStream, removeIf, stream
public ElementSelector(String selector, Set<Element> roots)
Creates an element selector with the given selector on the provided roots.
selector
- The selector.roots
- The rootspublic ElementSelector(Set<Element> cmps)
Creates a component selector that wraps the provided components. The provided
components are treated as the "results" of this selector. Not the roots. However
you can use find(java.lang.String)
to perform a query using this selector
as the roots.
cmps
- Components to add to this selector results.public ElementSelector(Element... els)
Creates a element selector that wraps the provided elements. The provided
components are treated as the "results" of this selector. Not the roots. However
you can use find(java.lang.String)
to perform a query using this selector
as the roots.
els
- Components to add to this selector results.public ElementSelector(String selector, Element... roots)
Creates a selector with the provided roots. This will only search through the subtrees of the provided roots to find results that match the provided selector string.
selector
- The selector stringroots
- The roots for this selector.public ElementSelector(String selector, Collection<Element> roots)
Creates a selector with the provided roots. This will only search through the subtrees of the provided roots to find results that match the provided selector string.
selector
- The selector stringroots
- The roots for this selector.public boolean retainAll(Collection<?> c)
Retains only elements of the result set that are contained in the provided collection.
public boolean removeAll(Collection<?> c)
Removes all of the components in the provided collection from the result set.
public void clear()
public int size()
Returns number of results found.
public boolean isEmpty()
public boolean contains(Object o)
Checks if an object is contained in result set.
public Object[] toArray()
Returns results as an array.
public <T> T[] toArray(T[] a)
Returns results as an array.
public boolean add(Element e)
Explicitly adds a component to the result set.
public ElementSelector append(Element child)
Appends a child component to the first container in this set. Same as calling
Container#add(com.codename1.ui.Component)
padding child on first container
in this set.
child
- Component to add to container.public ElementSelector append(Object constraint, Element child)
Appends a child component to the first container in this set. Same as calling
Container#add(java.lang.Object, com.codename1.ui.Component)
padding child on first container
in this set.
constraint
- child
- public ElementSelector setAttribute(String key, String value)
public String getAttribute(String key)
Gets an attribute value from the first item in this found set.
key
- public ElementSelector setString(String key, String value)
public ElementSelector setInt(String key, int value)
public ElementSelector setDouble(String key, double value)
public ElementSelector setBoolean(String key, boolean value)
public ElementSelector setDate(String key, Date date, DateFormat fmt)
public String getString(String key, String defaultValue)
Gets a string value on this selector. This uses a notation that allows you to target the current result, or a subselection.
key
- The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"defaultValue
- The default value if no value is found.public int getInt(String key, int defaultValue)
Gets an int value on this selector. This uses a notation that allows you to target the current result, or a subselection.
key
- The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"defaultValue
- The default value if no value is found.public double getDouble(String key, double defaultValue)
Gets a double value on this selector. This uses a notation that allows you to target the current result, or a subselection.
key
- The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"defaultValue
- The default value if no value is found.public boolean getBoolean(String key, boolean defaultValue)
Gets a boolean value on this selector. This uses a notation that allows you to target the current result, or a subselection.
key
- The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"defaultValue
- The default value if no value is found.public Date getDate(String key, DateFormat... formats)
Gets a date value on this selector. This uses a notation that allows you to target the current result, or a subselection.
key
- The key. E.g. "@attname" for attribute. "tagname" for subtag. "subselector/@attname", "subselector/tagname"formats
- DateFormats to attempt to parse date with.public boolean remove(Object o)
Explicitly removes a component from the result set.
public boolean containsAll(Collection<?> c)
Checks if the result set contains all of the components found in the provided collection.
containsAll
in interface Collection<Element>
containsAll
in interface Set<Element>
c
- public boolean addAll(Collection<? extends Element> c)
Adds all components in the given collection to the result set.
public ElementSelector getChildAt(int index)
public ElementSelector getParent()
public int getChildIndex(Element child)
public ElementSelector getChildrenByTagName(String name)
public ElementSelector getDescendantsByTagName(String name, int depth)
public ElementSelector getDescendantsByTagName(String name)
public ElementSelector getDescendantsByTagNameAndAttribute(String name, String tagName, int depth)
public ElementSelector getElementById(String id)
public ElementSelector getFirstChildByTagName(String name)
public int getNumChildren()
public String getText()
public boolean hasTextChild()
public ElementSelector removeAttribute(String attribute)
public ElementSelector removeChildAt(int indx)
public ElementSelector find(String selector)
Copyright © 2021. All Rights Reserved.