com.extjs.gxt.ui.client.widget
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.extjs.gxt.ui.client.widget.Component
              extended by com.extjs.gxt.ui.client.widget.BoxComponent
All Implemented Interfaces:
Observable, com.google.gwt.user.client.EventListener
Direct Known Subclasses:
Container, DatePicker, Editor, Field, Grid, Html, IconButton, Insert, ListView, ModalPanel, ProgressBar, Shadow, SplitBar, StatusProxy, TableColumnUI, TableHeader, Text, 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 within the Component rendering model.

Events:
Resize : BoxComponentEvent(boxComponent, width, height)
Fires after the component is resized.
Move : BoxComponentEvent(boxComponent, x, y)
Fires after the component is moved.


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
BoxComponent()
           
 
Method Summary
 Rectangle getBounds(boolean local)
          Gets the current box measurements of the component's underlying element.
 int getHeight()
          Returns the component's offset height.
 int getHeight(boolean content)
          Return the component's height.
 Point getPosition(boolean local)
          Returns the component's current position.
 boolean getShadow()
          Returns true if the shadow is enabled.
 Size getSize()
          Returns the component's size.
 int getWidth()
          Returns the component's width.
 int getWidth(boolean content)
          Returns the component's width.
 boolean isAutoHeight()
           
 boolean isAutoWidth()
           
 boolean isDeferHeight()
          Returns true if the height is being deferred
 boolean isShim()
          Returns true if shimming is enabled.
 void setAutoHeight(boolean autoHeight)
          Sets the component's auto height value (defaults to false).
 void setAutoWidth(boolean autoWidth)
          True to use width:'auto', false to use fixed width (defaults to false).
 void setBounds(int x, int y, int width, int height)
          Sets the component's size.
 void setBounds(Rectangle bounds)
          Sets the component's size.
 void setDeferHeight(boolean deferHeight)
          True to defer height calculations to an external component, false to allow this component to set its own height (defaults to false).
 void setHeight(int height)
          Sets the component's height.
 void setHeight(java.lang.String height)
          Sets the height of the component.
 void setPagePosition(int x, int y)
          Sets the page XY position of the component.
 void setPagePosition(Point point)
          Sets the page XY position of the component.
 void setPixelSize(int width, int height)
          Sets the width and height of the component.
 void setPosition(int left, int top)
          Sets the left and top of the component.
 void setShadow(boolean shadow)
          True to enable a shadow that will be displayed behind the component (defaults to false).
 void setShim(boolean shim)
          True to enable a shim which uses a transparent iframe to stop content from bleeding through.
 void setSize(int width, int height)
          Sets the width and height of the component.
 void setSize(java.lang.String width, java.lang.String height)
          Sets the width and height of the component.
 void setWidth(int width)
          Sets the width of the component.
 void setWidth(java.lang.String width)
          Sets the width of the component.
 
Methods inherited from class com.extjs.gxt.ui.client.widget.Component
addListener, addPlugin, addStyleName, addWidgetListener, disable, disableEvents, disableTextSelection, el, enable, 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

BoxComponent

public BoxComponent()
Method Detail

getBounds

public Rectangle getBounds(boolean local)
Gets the current box measurements of the component's underlying element. The component must be attached to return page coordinates.

Parameters:
local - if true the element's left and top are returned instead of page coordinates
Returns:
the component's bounds

getHeight

public int getHeight()
Returns the component's offset height.

Returns:
the height

getHeight

public int getHeight(boolean content)
Return the component's height.

Parameters:
content - true to get the height minus borders and padding
Returns:
the height

getPosition

public Point getPosition(boolean local)
Returns the component's current position. The component must be attached to return page coordinates.

Parameters:
local - true to return the element's left and top rather than page coordinates
Returns:
the position

getShadow

public boolean getShadow()
Returns true if the shadow is enabled.

Returns:
the shadow the shadow state

getSize

public Size getSize()
Returns the component's size.

Returns:
the size

getWidth

public int getWidth()
Returns the component's width.

Returns:
the width

getWidth

public int getWidth(boolean content)
Returns the component's width.

Parameters:
content - true to get width minus borders and padding
Returns:
the width

isAutoHeight

public boolean isAutoHeight()
Returns:
the autoHeight

isAutoWidth

public boolean isAutoWidth()
Returns:
the autoWidth

isDeferHeight

public boolean isDeferHeight()
Returns true if the height is being deferred

Returns:
the defer heigh state

isShim

public boolean isShim()
Returns true if shimming is enabled.

Returns:
the shim state

setAutoHeight

public void setAutoHeight(boolean autoHeight)
Sets the component's auto height value (defaults to false).

Parameters:
autoHeight - true to enable auto height

setAutoWidth

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

Parameters:
autoWidth - the auto width state

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the component's size. This method fires the Move and Resize events. element.

Parameters:
x - the x coordinate
y - the y coordinate
width - the width
height - the height

setBounds

public void setBounds(Rectangle bounds)
Sets the component's size. This method fires the Move and Resize events. element.

Parameters:
bounds - the update box

setDeferHeight

public void setDeferHeight(boolean deferHeight)
True to defer height calculations to an external component, false to allow this component to set its own height (defaults to false).

Parameters:
deferHeight - true to defer height

setHeight

public void setHeight(int height)
Sets the component's height. This method fires the Resize event. element.

Parameters:
height - the new height

setHeight

public void setHeight(java.lang.String height)
Sets the height of the component. This method fires the Resize event. element.

Overrides:
setHeight in class Component
Parameters:
height - the new height to set

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(int, int). This method fires the Move event.

Parameters:
x - the x coordinate
y - the y coordinate

setPagePosition

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

Parameters:
point - the new location

setPixelSize

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

Overrides:
setPixelSize in class Component
Parameters:
width - the new width to set
height - the new height to set

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(int, int). This method fires the move event.

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

setShadow

public void setShadow(boolean shadow)
True to enable a shadow that will be displayed behind the component (defaults to false).

Parameters:
shadow - true to enable the shadow

setShim

public void setShim(boolean shim)
True to enable a shim which uses a transparent iframe to stop content from bleeding through.

Parameters:
shim - true to enable a shim

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 to set
height - the new height to set

setSize

public void setSize(java.lang.String width,
                    java.lang.String height)
Sets the width and height of the component. This method fires the Resize event.

Overrides:
setSize in class Component
Parameters:
width - the new width to set
height - the new height to set

setWidth

public void setWidth(int width)
Sets the width of the component. This method fires the Resize event.

Parameters:
width - the new width to set

setWidth

public void setWidth(java.lang.String width)
Sets the width of the component. This method fires the Resize event.

Overrides:
setWidth in class Component
Parameters:
width - the new width to set