com.extjs.gxt.ui.client.core
Class CompositeElement

java.lang.Object
  extended by com.extjs.gxt.ui.client.core.CompositeElement

public class CompositeElement
extends java.lang.Object

Wraps an list of elements, allowing code to be applied to each element using a CompositeFunction.


Field Summary
protected  java.util.List<com.google.gwt.user.client.Element> items
          The list of elements.
 
Constructor Summary
CompositeElement()
          Creates a new composite element.
CompositeElement(com.google.gwt.user.client.Element[] elements)
          Creates a new composite element.
CompositeElement(java.util.List<com.google.gwt.user.client.Element> elements)
          Creates a new composite element.
 
Method Summary
 void add(com.google.gwt.user.client.Element elem)
          Adds an element.
 void add(Elements elements)
          Adds the elements.
 boolean contains(com.google.gwt.user.client.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.
 com.google.gwt.user.client.Element first()
          Returns the first element.
 int getCount()
          Returns the number of elements in this composite.
 com.google.gwt.user.client.Element getElement(int index)
          Returns the element at the given index.
 java.util.List<com.google.gwt.user.client.Element> getElements()
          The list of elements.
 int indexOf(com.google.gwt.user.client.Element elem)
          Returns the index of the given element.
 void insert(com.google.gwt.user.client.Element[] elems, int index)
           
 void insert(com.google.gwt.user.client.Element elem, int index)
          Inserts an element at the given index.
 boolean is(com.google.gwt.user.client.Element elem)
          Returns true if the given element is or is a child of any contained element.
 com.google.gwt.user.client.Element item(int index)
          Returns the Element object at the specified index.
 com.google.gwt.user.client.Element last()
          Returns the last element.
 void remove(com.google.gwt.user.client.Element element)
          Removes an element.
 void remove(int index)
          Removes an element.
 void removeAll()
          Removes all elements.
 void removeStyleName(java.lang.String style)
           
 boolean replaceElement(com.google.gwt.user.client.Element elem, com.google.gwt.user.client.Element replace)
          Replaces an element.
 void setHeight(int height)
          Sets the element's height.
 void setInnerHtml(java.lang.String html)
          Sets the element's inner HTML.
 void setWidth(int width)
          Sets the element's width.
 void setWidth(java.lang.String width)
          Sets the element's width.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected java.util.List<com.google.gwt.user.client.Element> items
The list of elements.

Constructor Detail

CompositeElement

public CompositeElement()
Creates a new composite element.


CompositeElement

public CompositeElement(com.google.gwt.user.client.Element[] elements)
Creates a new composite element.

Parameters:
elements - the initial elements

CompositeElement

public CompositeElement(java.util.List<com.google.gwt.user.client.Element> elements)
Creates a new composite element.

Parameters:
elements - the initial elements
Method Detail

add

public void add(com.google.gwt.user.client.Element elem)
Adds an element.

Parameters:
elem - the element to add

add

public void add(Elements elements)
Adds the elements.

Parameters:
elements - the elements to add

contains

public boolean contains(com.google.gwt.user.client.Element elem)
Returns true if this composite contains the passed element.

Parameters:
elem - the element
Returns:
the contains state

each

public void each(CompositeFunction f)
Calls the passed function passing (el, this, index) for each element in this composite.

Parameters:
f - the function

first

public com.google.gwt.user.client.Element first()
Returns the first element.

Returns:
the element

getCount

public int getCount()
Returns the number of elements in this composite.

Returns:
the count

getElement

public com.google.gwt.user.client.Element getElement(int index)
Returns the element at the given index.

Parameters:
index - the element index
Returns:
the element

getElements

public java.util.List<com.google.gwt.user.client.Element> getElements()
The list of elements.


indexOf

public int indexOf(com.google.gwt.user.client.Element elem)
Returns the index of the given element.

Parameters:
elem - the element
Returns:
the index

insert

public void insert(com.google.gwt.user.client.Element elem,
                   int index)
Inserts an element at the given index.

Parameters:
elem - the element to add
index - the insert location

insert

public void insert(com.google.gwt.user.client.Element[] elems,
                   int index)

is

public boolean is(com.google.gwt.user.client.Element elem)
Returns true if the given element is or is a child of any contained element.

Parameters:
elem - the element to test
Returns:
the is state

item

public com.google.gwt.user.client.Element item(int index)
Returns the Element object at the specified index.

Parameters:
index - the index
Returns:
the element

last

public com.google.gwt.user.client.Element last()
Returns the last element.

Returns:
the last element

remove

public void remove(com.google.gwt.user.client.Element element)
Removes an element.

Parameters:
element - the element to remove

remove

public void remove(int index)
Removes an element.

Parameters:
index - the index of the element to remove

removeAll

public void removeAll()
Removes all elements.


replaceElement

public boolean replaceElement(com.google.gwt.user.client.Element elem,
                              com.google.gwt.user.client.Element replace)
Replaces an element.

Parameters:
elem - the element to remove
replace - the element to replace
Returns:
true if the item was replaced

setHeight

public void setHeight(int height)
Sets the element's height.

Parameters:
height - the height

setInnerHtml

public void setInnerHtml(java.lang.String html)
Sets the element's inner HTML.

Parameters:
html - the html

removeStyleName

public void removeStyleName(java.lang.String style)

setWidth

public void setWidth(int width)
Sets the element's width.

Parameters:
width - the width

setWidth

public void setWidth(java.lang.String width)
Sets the element's width.

Parameters:
width - the width