Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.gwtext.client.widgets
Class Container

    java.lang.Object
      com.google.gwt.user.client.ui.UIObject
          com.google.gwt.user.client.ui.Widget
              com.gwtext.client.widgets.Component
                  com.gwtext.client.widgets.BoxComponent
                      com.gwtext.client.widgets.Container

All Implemented Interfaces:
  com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasWidgets, Observable, java.lang.Iterable

Direct Known Subclasses:
  Panel, PortalColumn

    public class Container

extends BoxComponent
implements com.google.gwt.user.client.ui.HasWidgets

Base class for any `BoxComponent` that can contain other components. Containers handle the basic behavior of containing items, namely adding, inserting and removing them. The specific layout logic required to visually render contained items is delegated to any one of the different layout classes available. This class is intended to be extended and should generally not need to be created directly via the new keyword.

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.gwtext.client.widgets.Component
`config, id`

Fields inherited from class com.google.gwt.user.client.ui.UIObject
`DEBUG_ID_PREFIX`

Constructor Summary
`Container()`
`Container(com.google.gwt.user.client.Element element)`
`Container(com.google.gwt.core.client.JavaScriptObject jsObj)`

Method Summary
`void` | `add(Component component)` Add a Component to the Container.
`void` | `add(Component component, LayoutData layoutData)` Add a Component to the Container.
`void` | `add(com.google.gwt.user.client.ui.Widget widget)` Add a widget to the Container.
`void` | `add(com.google.gwt.user.client.ui.Widget widget, LayoutData layoutData)` Add a widget to the Container.
`void` | `addListener(ContainerListener listener)` Add a Container listener.
`void` | `bubble(ComponentTraversalCallback cb)` Bubbles up the component/container heirarchy, calling the specified function with each component.
`void` | `cascade(ComponentTraversalCallback cb)` Cascades down the component/container heirarchy from this component (called first), calling the specified function with each component.
`void` | `clear()` Remove all child elements destroying them.
`protected com.google.gwt.core.client.JavaScriptObject` | `create(com.google.gwt.core.client.JavaScriptObject config)`
`void` | `doLayout()` Force this container's layout to be recalculated.
`void` | `doLayout(boolean shallow)` Force this container's layout to be recalculated.
`Component[]` | `findBy(ComponentTraversalCallback cb)` Find a component under this container at any level by a custom function.
`Component` | `findByID(java.lang.String id)` Find a component under this container at any level by id.
`Component[]` | `findByType(java.lang.String xtype)` Find a component under this container at any level by xtype.
`int` | `getActiveItem()` Return the Active Item index.
`java.lang.String` | `getActiveItemID()`
`boolean` | `getAutoDestroy()`
`boolean` | `getBufferResize()`
`Component` | `getComponent(int index)` Gets a direct child Component by by index.
`Component` | `getComponent(java.lang.String id)` Gets a direct child Component by id.
`Component[]` | `getComponents()` The collection of components in this container.
`protected com.google.gwt.core.client.JavaScriptObject` | `getConfigPrototype()`
`boolean` | `getHideBorders()` True to hide the borders of each contained component, false to defer to the component's existing border settings (defaults to false).
`Component[]` | `getItems()` The collection of components in this container.
`ContainerLayout` | `getLayout()`
`boolean` | `getMonitorResize()`
`java.lang.String` | `getXType()` Gets the xtype for this component as registered with ComponentMgr.
`void` | `insert(int index, Component component)` Inserts a Component into this Container at a specified index.
`java.util.Iterator` | `iterator()`
`void` | `remove(Component component, boolean autoDestroy)` Removes a component from this container.
`void` | `remove(java.lang.String id)` Removes a component from this container.
`void` | `remove(java.lang.String id, boolean autoDestroy)` Removes a component from this container.
`boolean` | `remove(com.google.gwt.user.client.ui.Widget w)`
`void` | `removeAll()` Removes all child components without destroying them.
`void` | `removeAll(boolean autoDestroy)` Removes all components from this container.
`void` | `setActiveItem(int activeItem)` A string component id or the numeric index of the component that should be initially activated within the container's layout on render.
`void` | `setActiveItemID(java.lang.String activeItem)` A string component id or the numeric index of the component that should be initially activated within the container's layout on render.
`void` | `setAutoDestroy(boolean autoDestroy)` If true the container will automatically destroy any contained component that is removed from it, else destruction must be handled manually (defaults to true).
`void` | `setBufferResize(boolean bufferResize)` When set to true (100 milliseconds), the layout assigned for this container will buffer the frequency it calculates and does a re-layout of components.
`void` | `setDefaults(DefaultsHandler defaultsHandler)`
`void` | `setHideBorders(boolean hideBorders)` True to hide the borders of each contained component, false to defer to the component's existing border settings (defaults to false).
`void` | `setLayout(ContainerLayout layout)` The layout type to be used in this container.
`void` | `setMonitorResize(boolean monitorResize)` True to automatically monitor window resize events to handle anything that is sensitive to the current size of the viewport.

Methods inherited from class com.gwtext.client.widgets.BoxComponent
`addListener, doOnRender, doOnRender, getAutoHeight, getAutoWidth, getBox, getBox, getHeight, getPosition, getPosition, getSize, getWidth, setAutoHeight, setAutoWidth, setHeight, setHeight, setPagePosition, setPosition, setSize, setSize, setWidth, setWidth, syncSize, updateBox`

Methods inherited from class com.gwtext.client.widgets.Component
`addClass, addClassCreated, addEvent, addEvents, addListener, addListener, addListener, addPlugin, addStyleDependentName, addStyleName, afterRender, beforeDestroy, check, checkExtVer, cloneComponent, cloneComponent, cloneConfig, destroy, disable, enable, equals, error, findParentBy, findParentByType, fireEvent, focus, focus, focus, getApplyTo, getAttribute, getAttributeAsBoolean, getAttributeAsFloat, getAttributeAsInt, getAttributeAsJavaScriptObject, getAutoShow, getCls, getComponentJS, getConfig, getConfigAsString, getCtCls, getDisabledClass, getEl, getElement, getElement, getElement, getHideMode, getHideParent, getId, getItemId, getJsObj, getOffsetHeight, getOffsetWidth, getOrCreateJsObj, getOwnerContainer, getRenderTo, getStateEvents, getStateId, getTitle, getXTypes, hashCode, hide, initComponent, isCreated, isDisabled, isHidden, isRendered, isVisible, isXType, isXType, onDestroy, purgeListeners, removeClass, removeStyleDependentName, removeStyleName, render, render, render, render, render, render, resumeEvents, setApplyTo, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAttribute, setAutoEl, setAutoEl, setAutoShow, setCls, setCtCls, setDisabled, setDisabledClass, setEl, setEl, setElement, setHideMode, setHideParent, setId, setRenderTo, setRenderToID, setStateEvents, setStateId, setStyle, setStyle, setStyleName, setStylePrimaryName, setTitle, setVisible, show, suspendEvents, toString`

Methods inherited from class com.google.gwt.user.client.ui.Widget
`doAttachChildren, doDetachChildren, getParent, isAttached, onAttach, onBrowserEvent, onDetach, onLoad, onUnload, removeFromParent`

Methods inherited from class com.google.gwt.user.client.ui.UIObject
`ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, onEnsureDebugId, setElement, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

Constructor Detail

### Container

    public Container()

### Container

    public Container(com.google.gwt.core.client.JavaScriptObject jsObj)

### Container

    public Container(com.google.gwt.user.client.Element element)

Method Detail

### getConfigPrototype

    protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()

  Overrides:
    `getConfigPrototype` in class `BoxComponent`

### getXType

    public java.lang.String getXType()

  Description copied from class: `Component`
  Gets the xtype for this component as registered with ComponentMgr. For a list of all available xtypes, see the Component javadocs.

       TextField field = new TextField();
       field.getXType() returns "textfield"

  Overrides:
    `getXType` in class `BoxComponent`
  Returns:
    the xtype

### create

    protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)

  Overrides:
    `create` in class `BoxComponent`

### setDefaults

    public void setDefaults(DefaultsHandler defaultsHandler)

### add

    public void add(Component component,
                    LayoutData layoutData)

  Add a Component to the Container.

  Parameters:
    `component` - the component to add
    `layoutData` - the layout to use when adding the component

### add

    public void add(com.google.gwt.user.client.ui.Widget widget)

  Add a widget to the Container.

  Specified by:
    `add` in interface `com.google.gwt.user.client.ui.HasWidgets`
  Parameters:
    `widget` - the widget to add

### add

    public void add(com.google.gwt.user.client.ui.Widget widget,
                    LayoutData layoutData)

  Add a widget to the Container.

  Parameters:
    `widget` - the widget to add
    `layoutData` - the layout to use when adding the component

### add

    public void add(Component component)

  Add a Component to the Container.

  Parameters:
    `component` - the component to add

### findByID

    public Component findByID(java.lang.String id)

  Find a component under this container at any level by id.

  Parameters:
    `id` - the component ID
  Returns:
    the component

### findByType

    public Component[] findByType(java.lang.String xtype)

  Find a component under this container at any level by xtype.

  Parameters:
    `xtype` - the components xtype
  Returns:
    an array of components

### findBy

    public Component[] findBy(ComponentTraversalCallback cb)

  Find a component under this container at any level by a custom function. If the passed function returns true, the component will be included in the results.

  Parameters:
    `cb` - the find function
  Returns:
    an array of Components

### getComponent

    public Component getComponent(java.lang.String id)

  Gets a direct child Component by id.

  Parameters:
    `id` - the component ID
  Returns:
    the component

### getComponent

    public Component getComponent(int index)

  Gets a direct child Component by by index.

  Parameters:
    `index` - the component index
  Returns:
    the component

### bubble

    public void bubble(ComponentTraversalCallback cb)

  Bubbles up the component/container heirarchy, calling the specified function with each component. If the function returns false at any point, the bubble is stopped.

  Parameters:
    `cb` - the traversal callback

### cascade

    public void cascade(ComponentTraversalCallback cb)

  Cascades down the component/container heirarchy from this component (called first), calling the specified function with each component. If the function returns false at any point, the cascade is stopped on that branch.

  Parameters:
    `cb` - the traversal callback

### insert

    public void insert(int index,
                       Component component)

  Inserts a Component into this Container at a specified index. Fires the beforeadd event before inserting, then fires the add event after the Component has been inserted.

  Parameters:
    `index` - the index to insert the component at
    `component` - the component to insert

### remove

    public void remove(java.lang.String id)

  Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed.

  Parameters:
    `id` - the id of the Component to remove

### remove

    public boolean remove(com.google.gwt.user.client.ui.Widget w)

  Specified by:
    `remove` in interface `com.google.gwt.user.client.ui.HasWidgets`

### clear

    public void clear()

  Remove all child elements destroying them.

  Specified by:
    `clear` in interface `com.google.gwt.user.client.ui.HasWidgets`

### getItems

    public Component[] getItems()

  The collection of components in this container. Alias for `getComponents()`

  Returns:
    child components

### getComponents

    public Component[] getComponents()

  The collection of components in this container.

  Returns:
    child components

### iterator

    public java.util.Iterator iterator()

  Specified by:
    `iterator` in interface `com.google.gwt.user.client.ui.HasWidgets`
  Specified by:
    `iterator` in interface `java.lang.Iterable`

### remove

    public void remove(Component component,
                       boolean autoDestroy)

  Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed.

  Parameters:
    `component` - the id of the Component to remove
    `autoDestroy` - true to automatically invoke the Component's destroy method

### remove

    public void remove(java.lang.String id,
                       boolean autoDestroy)

  Removes a component from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed.

  Parameters:
    `id` - the id of the Component to remove
    `autoDestroy` - true to automatically invoke the Component's destroy method

### removeAll

    public void removeAll()

  Removes all child components without destroying them.

### removeAll

    public void removeAll(boolean autoDestroy)

  Removes all components from this container. Fires the beforeremove event before removing, then fires the remove event after the component has been removed.

  Parameters:
    `autoDestroy` - true to automatically invoke the component's destroy

### doLayout

    public void doLayout()

  Force this container's layout to be recalculated. A call to this function is required after adding a new component to an already rendered container. If you are not dynamically adding and removing components after render, this function will generally not need to be called.

### doLayout

    public void doLayout(boolean shallow)

  Force this container's layout to be recalculated. A call to this function is required after adding a new component to an already rendered container. If you are not dynamically adding and removing components after render, this function will generally not need to be called.

  Parameters:
    `shallow` - True to only calculate the layout of this component, and let child components auto calculate layouts as required

### addListener

    public void addListener(ContainerListener listener)

  Add a Container listener.

  Parameters:
    `listener` - the listener

### setActiveItemID

    public void setActiveItemID(java.lang.String activeItem)

  A string component id or the numeric index of the component that should be initially activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like `AccordionLayout` , `CardLayout` and `FitLayout` ).

  Parameters:
    `activeItem` - the active Item ID

### getActiveItemID

    public java.lang.String getActiveItemID()

  Returns:
    the active Item ID

### setActiveItem

    public void setActiveItem(int activeItem)

  A string component id or the numeric index of the component that should be initially activated within the container's layout on render. For example, activeItem: 'item-1' or activeItem: 0 (index 0 = the first item in the container's collection). activeItem only applies to layout styles that can display items one at a time (like `AccordionLayout` , `CardLayout` and `FitLayout` ).

  Parameters:
    `activeItem` - the active Item ID

### getActiveItem

    public int getActiveItem()

  Return the Active Item index.

  Returns:
    the active item index

### setAutoDestroy

    public void setAutoDestroy(boolean autoDestroy)

  If true the container will automatically destroy any contained component that is removed from it, else destruction must be handled manually (defaults to true).

  Parameters:
    `autoDestroy` - true to autodestroy

### getAutoDestroy

    public boolean getAutoDestroy()

  Returns:
    true if Component is configured to auto destroy contained components on destruction

### setBufferResize

    public void setBufferResize(boolean bufferResize)

  When set to true (100 milliseconds), the layout assigned for this container will buffer the frequency it calculates and does a re-layout of components. This is useful for heavy containers or containers with a large amount of sub components that frequent calls to layout are expensive.

  Parameters:
    `bufferResize` - true to buffer resize

### getBufferResize

    public boolean getBufferResize()

  Returns:
    true if buffer resize is enabled

### setHideBorders

    public void setHideBorders(boolean hideBorders)

  True to hide the borders of each contained component, false to defer to the component's existing border settings (defaults to false).

  Parameters:
    `hideBorders` - true to hide borders

### getHideBorders

    public boolean getHideBorders()

  True to hide the borders of each contained component, false to defer to the component's existing border settings (defaults to false).

  Returns:
    true if hide borders

### setLayout

    public void setLayout(ContainerLayout layout)
                   throws java.lang.IllegalStateException

  The layout type to be used in this container. If not specified, a default ContainerLayout will be created and used.

  Parameters:
    `layout` - the layout to use
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getLayout

    public ContainerLayout getLayout()

### setMonitorResize

    public void setMonitorResize(boolean monitorResize)
                          throws java.lang.IllegalStateException

  True to automatically monitor window resize events to handle anything that is sensitive to the current size of the viewport. This value is typically managed by the chosen layout and should not need to be set manually.

  Parameters:
    `monitorResize` - true to monitor resize
  Throws:
    `java.lang.IllegalStateException` - this property cannot be changed after the Component has been rendered

### getMonitorResize

    public boolean getMonitorResize()

  Returns:
    true if monitor resize

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD