com.gwtext.client.widgets
Class BoxComponent

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.gwtext.client.widgets.Component
              extended by com.gwtext.client.widgets.BoxComponent
All Implemented Interfaces:
com.google.gwt.user.client.EventListener, Observable
Direct Known Subclasses:
Container, DataView, Field, Label, ProgressBar, Toolbar, WidgetComponent

public class BoxComponent
extends Component

Base class for any visual Component that uses a box container. BoxComponent provides automatic box model adjustments for sizing and positioning and will work correctly withnin the Component rendering model. All container classes should subclass BoxComponent so that they will work consistently when nested within other Ext layout containers.


Field Summary
 
Fields inherited from class com.gwtext.client.widgets.Component
config, id
 
Constructor Summary
BoxComponent()
           
BoxComponent(com.google.gwt.user.client.Element element)
           
BoxComponent(com.google.gwt.core.client.JavaScriptObject jsObj)
           
 
Method Summary
protected  void addListener(BoxComponentListener listener)
          Add a Component listener.
protected  com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
           
 void doOnRender(Function function)
          Runs the specified function when the Component is rendered.
 void doOnRender(Function function, int delayMillis)
          Runs the specified function when the Component is rendered.
 boolean getAutoHeight()
           
 boolean getAutoWidth()
           
 Box getBox()
          Gets the current box measurements of the component's.
 Box getBox(boolean local)
          Gets the current box measurements of the component's.
protected  com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
           
 int getHeight()
          The height of this component in pixels.
 int[] getPosition()
          Gets the current XY position of the component's underlying element.
 int[] getPosition(boolean local)
          Gets the current XY position of the component's underlying element.
 Size getSize()
          Gets the current size of the component's underlying element.
 int getWidth()
          The component width.
 java.lang.String getXType()
          Gets the xtype for this component as registered with ComponentMgr.
 void setAutoHeight(boolean autoHeight)
          True to use height:'auto', false to use fixed height (defaults to false).
 void setAutoWidth(boolean autoWidth)
          True to use width:'auto', false to use fixed width (defaults to false).
 void setHeight(int height)
          The height of this component in pixels (defaults to auto).
 void setHeight(java.lang.String height)
          Set the height in pixels or auto.
 void setPagePosition(int x, int y)
          Sets the page XY position of the component.
 void setPosition(int left, int top)
          Sets the left and top of the component.
 void setSize(int width, int height)
          Sets the width and height of the component.
 void setSize(java.lang.String width, java.lang.String height)
           
 void setWidth(int width)
          The component width.
 void setWidth(java.lang.String width)
          Set the width in pixels or auto.
 void syncSize()
          Force the component's size to recalculate based on the underlying element's current height and width.
 void updateBox(Box box)
          Sets the current box measurements of the component's underlying element.
 
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
getAbsoluteLeft, getAbsoluteTop, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, isVisible, setPixelSize, setStyleName, setStyleName, setStylePrimaryName, setVisible, sinkEvents, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BoxComponent

public BoxComponent()

BoxComponent

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

BoxComponent

public BoxComponent(com.google.gwt.user.client.Element element)
Method Detail

getConfigPrototype

protected com.google.gwt.core.client.JavaScriptObject getConfigPrototype()
Specified by:
getConfigPrototype in class Component

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 Component
Returns:
the xtype

create

protected com.google.gwt.core.client.JavaScriptObject create(com.google.gwt.core.client.JavaScriptObject config)
Specified by:
create in class Component

getBox

public Box getBox()
Gets the current box measurements of the component's.

Returns:
the box measurements

getBox

public Box getBox(boolean local)
Gets the current box measurements of the component's.

Parameters:
local - if true the element's left and top are returned instead of page XY (defaults to false)
Returns:
the box measurements

getPosition

public int[] getPosition()
Gets the current XY position of the component's underlying element.

Returns:
the XY position

getPosition

public int[] getPosition(boolean local)
Gets the current XY position of the component's underlying element.

Parameters:
local - if true the element's left and top are returned instead of page XY (defaults to false)
Returns:
the XY position

getSize

public Size getSize()
Gets the current size of the component's underlying element.

Returns:
the components Size

setPagePosition

public void setPagePosition(int x,
                            int y)
Sets the page XY position of the component. To set the left and top instead, use setPosition. This method fires the move event.

Parameters:
x - the new X position
y - the new Y opsition

setPosition

public void setPosition(int left,
                        int top)
Sets the left and top of the component. To set the page XY position instead, use setPagePosition. This method fires the move event.

Parameters:
left - the new left
top - the new right

setSize

public void setSize(int width,
                    int height)
Sets the width and height of the component. This method fires the resize event.

Parameters:
width - the new width
height - the new height

setSize

public void setSize(java.lang.String width,
                    java.lang.String height)
Overrides:
setSize in class com.google.gwt.user.client.ui.UIObject

syncSize

public void syncSize()
Force the component's size to recalculate based on the underlying element's current height and width.


updateBox

public void updateBox(Box box)
Sets the current box measurements of the component's underlying element.

Parameters:
box - the new box measurements

addListener

protected void addListener(BoxComponentListener listener)
Add a Component listener.

Parameters:
listener - the listener

doOnRender

public void doOnRender(Function function)
Runs the specified function when the Component is rendered.

Parameters:
function - the function to execute on render

doOnRender

public void doOnRender(Function function,
                       int delayMillis)
Runs the specified function when the Component is rendered.

Parameters:
function - the function to execute on render
delayMillis - a delay in milliseconds

setAutoHeight

public void setAutoHeight(boolean autoHeight)
                   throws java.lang.IllegalStateException
True to use height:'auto', false to use fixed height (defaults to false).

Note: This property cannot be changed after the Component has been rendered.

Parameters:
autoHeight - true to use auto height
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getAutoHeight

public boolean getAutoHeight()
Returns:
true if using auto height, else false

setAutoWidth

public void setAutoWidth(boolean autoWidth)
                  throws java.lang.IllegalStateException
True to use width:'auto', false to use fixed width (defaults to false).

Parameters:
autoWidth - true for auto width
Throws:
java.lang.IllegalStateException - this property cannot be changed after the Component has been rendered

getAutoWidth

public boolean getAutoWidth()
Returns:
true if using auto width, else false

setHeight

public void setHeight(int height)
The height of this component in pixels (defaults to auto).

Parameters:
height - the component height

setHeight

public void setHeight(java.lang.String height)
Set the height in pixels or auto. Note that setting percentage based heights will lead to unpredictable display behavior. You should use the various layouts like AnchorLayout to control percentage based rendering of components.

Overrides:
setHeight in class Component
Parameters:
height - the component height

getHeight

public int getHeight()
The height of this component in pixels.

Returns:
the hieght of the component in pixels

setWidth

public void setWidth(int width)
The component width. (defaults to auto)

Parameters:
width - the width, -1 for auto

setWidth

public void setWidth(java.lang.String width)
Set the width in pixels or auto. Note that setting percentage based widths will lead to unpredictable display behavior. You should use the various layouts like AnchorLayout to control percentage based rendering of components.

Overrides:
setWidth in class Component
Parameters:
width - the component height

getWidth

public int getWidth()
The component width.

Returns:
the component width, -1 for auto