com.extjs.gxt.ui.client.widget
Class Container<T extends Component>

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
                  extended by com.extjs.gxt.ui.client.widget.Container<T>
Type Parameters:
T - the child component type
All Implemented Interfaces:
Observable, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
ButtonBar, HtmlContainer, Menu, Portal, ScrollContainer, Table, TabPanel, ToolBar, Tree

public abstract class Container<T extends Component>
extends BoxComponent

Class for any BoxComponent that can contain other components. Containers handle the basic behavior of containing components, namely managing, attaching, and detaching the child widgets.

When children are added to a container they are not physically added to the DOM of the container. Subclasses are responsible for connecting the child components.

Container does not define a root element. setElement must be called by any subclass to ensure the container has an element.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
Container()
          Creates a new container.
 
Method Summary
 void disable()
          Disable this component.
 void enable()
          Enable this component.
 T findItem(com.google.gwt.user.client.Element elem)
          Returns the component whose element, or child element, matches the given element.
 T getItem(int index)
          Returns the item at the given index or null if index out of bounds.
 T getItemByItemId(java.lang.String itemId)
          Returns the item with the specified item id.
 int getItemCount()
          Returns the number of children.
 java.util.List<T> getItems()
          Returns the child items.
 com.google.gwt.user.client.ui.Widget getWidget(int index)
          Returns the widget at the given index.
 int indexOf(T item)
          Returns the index of the item.
 java.util.Iterator<T> iterator()
          Returns an iterator over the container's children.
 boolean removeAll()
          Removes all the container's items.
 void scrollIntoView(T item)
          Scrolls the item into view.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.BoxComponent
getBounds, getHeight, getHeight, getPosition, getShadow, getSize, getWidth, getWidth, isAutoHeight, isAutoWidth, isDeferHeight, isShim, setAutoHeight, setAutoWidth, setBounds, setBounds, setDeferHeight, setHeight, setHeight, setPagePosition, setPagePosition, setPixelSize, setPosition, setShadow, setShim, setSize, setSize, setWidth, setWidth
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, disableEvents, disableTextSelection, el, enableEvents, fireEvent, fireEvent, fireEvent, fly, focus, getBaseStyle, getBorders, getData, getData, getElement, getId, getItemId, getModel, getState, getToolTip, hide, hideToolTip, isDisabledEvents, isEnabled, isRendered, isVisible, onBrowserEvent, onComponentEvent, recalculate, removeAllListeners, removeFromParent, removeListener, removeStyleName, removeWidgetListener, render, render, saveState, setBorders, setData, setData, setElement, setEnabled, setEnableState, setId, setIntStyleAttribute, setItemId, setStyleAttribute, setStyleName, setTitle, setToolTip, setToolTip, setVisible, show, sinkEvents, toString
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
getParent, isAttached
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, setStylePrimaryName, setVisible, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Container

public Container()
Creates a new container.

Method Detail

disable

public void disable()
Description copied from class: Component
Disable this component. Fires the Disable event.

Overrides:
disable in class Component

enable

public void enable()
Description copied from class: Component
Enable this component. Fires the Enable event.

Overrides:
enable in class Component

findItem

public T findItem(com.google.gwt.user.client.Element elem)
Returns the component whose element, or child element, matches the given element.

Parameters:
elem - the element
Returns:
the matching component or null if no match

getItem

public T getItem(int index)
Returns the item at the given index or null if index out of bounds.

Parameters:
index - the index
Returns:
the item

getItemByItemId

public T getItemByItemId(java.lang.String itemId)
Returns the item with the specified item id.

Parameters:
itemId - the item id
Returns:
the button or null if no match

getItemCount

public int getItemCount()
Returns the number of children.

Returns:
the component count

getItems

public java.util.List<T> getItems()
Returns the child items.

Returns:
the children

getWidget

public com.google.gwt.user.client.ui.Widget getWidget(int index)
Returns the widget at the given index. If the child is a WidgetComponent, the wrapped widget is returned.

Parameters:
index - the index
Returns:
the widget

indexOf

public int indexOf(T item)
Returns the index of the item.

Parameters:
item - the item
Returns:
the index

iterator

public java.util.Iterator<T> iterator()
Returns an iterator over the container's children.

Returns:
an iterator

removeAll

public boolean removeAll()
Removes all the container's items.

Returns:
true if all items where removed

scrollIntoView

public void scrollIntoView(T item)
Scrolls the item into view.

Parameters:
item - the item