public class CompositeElement extends Object
CompositeFunction
.Modifier and Type | Field and Description |
---|---|
protected List<Element> |
items
The list of elements.
|
Constructor and Description |
---|
CompositeElement()
Creates a new composite element.
|
CompositeElement(Element[] elements)
Creates a new composite element.
|
CompositeElement(List<Element> elements)
Creates a new composite element.
|
Modifier and Type | Method and Description |
---|---|
void |
add(Element elem)
Adds an element.
|
void |
addClassName(String cls)
Removes the class name.
|
boolean |
contains(Element elem)
Returns true if this composite contains the passed element.
|
void |
each(CompositeFunction f)
Calls the passed function passing (el, this, index) for each element in
this composite.
|
Element |
first()
Returns the first element.
|
int |
getCount()
Returns the number of elements in this composite.
|
Element |
getElement(int index)
Returns the element at the given index.
|
List<Element> |
getElements() |
int |
indexOf(Element elem)
Returns the index of the given element.
|
void |
insert(Element[] elems,
int index)
Inserts the elements at the given index.
|
void |
insert(Element elem,
int index)
Inserts an element at the given index.
|
boolean |
is(Element elem)
Returns true if the given element is or is a child of any contained
element.
|
Element |
item(int index)
Returns the Element object at the specified index.
|
Element |
last()
Returns the last element.
|
void |
remove(Element element)
Removes an element.
|
void |
removeAll()
Removes all elements.
|
void |
removeClassName(String cls)
Removes the class name.
|
boolean |
replaceElement(Element elem,
Element replace)
Replaces an element.
|
void |
setHeight(int height)
Sets the element's height.
|
void |
setInnerSafeHtml(SafeHtml html)
Sets the element's inner HTML.
|
void |
setWidth(int width)
Sets the element's width.
|
void |
setWidth(String width)
Sets the element's width.
|
protected List<Element> items
public CompositeElement()
public CompositeElement(Element[] elements)
elements
- the initial elementspublic CompositeElement(List<Element> elements)
elements
- the initial elementspublic void add(Element elem)
elem
- the element to addpublic void addClassName(String cls)
cls
- the class namepublic boolean contains(Element elem)
elem
- the elementpublic void each(CompositeFunction f)
f
- the functionpublic Element first()
public int getCount()
public Element getElement(int index)
index
- the element indexpublic List<Element> getElements()
public int indexOf(Element elem)
elem
- the elementpublic void insert(Element elem, int index)
elem
- the element to addindex
- the insert locationpublic void insert(Element[] elems, int index)
elems
- the elements to insertindex
- the insert locationpublic boolean is(Element elem)
elem
- the element to testpublic Element item(int index)
index
- the indexpublic Element last()
public void remove(Element element)
element
- the element to removepublic void removeAll()
public void removeClassName(String cls)
cls
- the class namepublic boolean replaceElement(Element elem, Element replace)
elem
- the element to removereplace
- the element to replacepublic void setHeight(int height)
height
- the heightpublic void setInnerSafeHtml(SafeHtml html)
html
- the htmlpublic void setWidth(int width)
width
- the widthpublic void setWidth(String width)
width
- the widthCopyright © 2018. All rights reserved.