com.sencha.gxt.widget.core.client
Class 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.sencha.gxt.widget.core.client.Component
All Implemented Interfaces:
HasAttachHandlers, HasResizeHandlers, HasHandlers, EventListener, HasVisibility, IsWidget, BeforeHideEvent.HasBeforeHideHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, BeforeShowEvent.HasBeforeShowHandlers, BlurEvent.HasBlurHandlers, DisableEvent.HasDisableHandlers, EnableEvent.HasEnableHandlers, FocusEvent.HasFocusHandlers, HideEvent.HasHideHandlers, MoveEvent.HasMoveHandlers, ShowContextMenuEvent.HasShowContextMenuHandler, ShowEvent.HasShowHandlers, HasFocusSupport, HasItemId
Direct Known Subclasses:
CellComponent, CollapsePanel, ColumnFooter, ColumnHeader, ColumnHeader.GridSplitBar, ColumnHeader.Group, ColumnHeader.Head, Composite, Container, DatePicker, FileUploadField, FillToolItem, Grid, Header, IconButton, Info, Insert, Item, LabelToolItem, ListView, MenuBarItem, ModalPanel, SeparatorToolItem, SplitBar, Status, StatusProxy, TabPanel, Tip, Tree

public class Component
extends Widget
implements FocusEvent.HasFocusHandlers, BlurEvent.HasBlurHandlers, BeforeHideEvent.HasBeforeHideHandlers, HideEvent.HasHideHandlers, BeforeShowEvent.HasBeforeShowHandlers, ShowEvent.HasShowHandlers, EnableEvent.HasEnableHandlers, DisableEvent.HasDisableHandlers, BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler, ShowContextMenuEvent.HasShowContextMenuHandler, MoveEvent.HasMoveHandlers, HasResizeHandlers, HasItemId, HasFocusSupport

Base class for all Ext GWT widgets.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
UIObject.DebugIdImpl, UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Method Summary
 HandlerRegistration addBeforeHideHandler(BeforeHideEvent.BeforeHideHandler handler)
          Adds a BeforeHideEvent.BeforeHideHandler handler for BeforeHideEvent events.
 HandlerRegistration addBeforeShowContextMenuHandler(BeforeShowContextMenuEvent.BeforeShowContextMenuHandler handler)
          Adds a BeforeShowContextMenuEvent.BeforeShowContextMenuHandler handler for BeforeShowContextMenuEvent events.
 HandlerRegistration addBeforeShowHandler(BeforeShowEvent.BeforeShowHandler handler)
          Adds a BeforeShowEvent.BeforeShowHandler handler for BeforeShowEvent events.
 HandlerRegistration addBlurHandler(BlurEvent.BlurHandler handler)
          Adds a BlurEvent.BlurHandler handler for BlurEvent events.
 HandlerRegistration addDisableHandler(DisableEvent.DisableHandler handler)
          Adds a DisableEvent.DisableHandler handler for DisableEvent events.
 HandlerRegistration addEnableHandler(EnableEvent.EnableHandler handler)
          Adds a EnableEvent.EnableHandler handler for EnableEvent events.
 HandlerRegistration addFocusHandler(FocusEvent.FocusHandler handler)
          Adds a FocusEvent.FocusHandler handler for FocusEvent events.
 HandlerRegistration addHideHandler(HideEvent.HideHandler handler)
          Adds a HideEvent.HideHandler handler for HideEvent events.
 HandlerRegistration addMoveHandler(MoveEvent.MoveHandler handler)
          Adds a MoveEvent.MoveHandler handler for MoveEvent events.
 HandlerRegistration addResizeHandler(ResizeHandler handler)
           
 HandlerRegistration addShowContextMenuHandler(ShowContextMenuEvent.ShowContextMenuHandler handler)
          Adds a ShowContextMenuEvent.ShowContextMenuHandler handler for ShowContextMenuEvent events.
 HandlerRegistration addShowHandler(ShowEvent.ShowHandler handler)
          Adds a ShowEvent.ShowHandler handler for ShowEvent events.
 void addStyleOnOver(Element elem, String style)
          Adds a style to the given element on mouseover.
 void clearSizeCache()
          Clears the size cache (the size of the widget the last time it was changed).
 void disable()
          Disable this widget.
 void disableEvents()
          True to disable event processing.
 void enable()
          Enable this widget.
 void enableEvents()
          True to enable event processing.
 void fireEvent(GwtEvent<?> event)
           
 void focus()
          Try to focus this widget.
<X> X
getData(String key)
          Returns the application defined property for the given name, or null if it has not been set.
 XElement getElement()
          Gets a handle to the object's underlying DOM element.
 FocusManagerSupport getFocusSupport()
          Returns the focus manager support configuration.
 Style.HideMode getHideMode()
          Returns the widget's hide mode.
 String getId()
          Returns the widget's id.
 String getItemId()
          Returns the item id of this widget.
 int getOffsetHeight(boolean content)
          Returns the widget's height.
 int getOffsetWidth(boolean content)
          Returns the element's width.
 boolean getShadow()
          Returns true if the shadow is enabled.
 String getStateId()
          Returns the widget's state id.
 ToolTip getToolTip()
          Returns the widget's tool tip.
 void hide()
          Hide this widget.
 void hideToolTip()
          Hides the widget's tool tip (if one exists).
 boolean isAllowTextSelection()
          Returns the enable text selection state.
 boolean isAutoHeight()
          Returns the auto height state.
 boolean isAutoWidth()
          Returns the auto width state.
 boolean isDeferHeight()
          Returns true if the height is being deferred
 boolean isEnabled()
          Returns true if the widget is enabled.
 boolean isRendered()
          Returns true if the component has been rendered.
 boolean isStateful()
          Returns true if the widget is saving and restore it's state.
 boolean isVisible()
           
 boolean isVisible(boolean deep)
          Returns true if the widget is visible.
 void mask()
          Puts a mask over this widget to disable user interaction.
 void mask(String message)
          Puts a mask over this widget to disable user interaction.
 void onBrowserEvent(Event event)
           
 void removeToolTip()
          Removes the components tooltip (if one exists).
 void setAllowTextSelection(boolean enable)
          Enables and disables text selection for the widget.
 void setBorders(boolean show)
          Adds or removes a border.
 void setBounds(int x, int y, int width, int height)
          Sets the widget's size.
 void setBounds(Rectangle bounds)
          Sets the widget's size.
 void setContextMenu(Menu menu)
          Sets the widget's context menu.
 void setData(String key, Object data)
          Sets the application defined property with the given name.
 void setDeferHeight(boolean deferHeight)
          True to defer height calculations to an external widget, false to allow this widget to set its own height (defaults to false).
 void setEnabled(boolean enabled)
          Convenience function for setting disabled/enabled by boolean.
 void setHeight(int height)
          Sets the widget's height.
 void setHeight(String height)
          Sets the height of the widget.
 void setHideMode(Style.HideMode hideMode)
          Sets the components hide mode (defaults to HideMode.DISPLAY).
 void setId(String id)
          Sets the component's id.
 void setItemId(String id)
          Sets the widget's item id.
 void setPagePosition(int x, int y)
          Sets the page XY position of the widget.
 void setPixelSize(int width, int height)
          Sets the component's size.
 void setPosition(int left, int top)
          Sets the left and top of the widget.
 void setShadow(boolean shadow)
          True to enable a shadow that will be displayed behind the widget (defaults to false).
 void setSize(String width, String height)
          Sets the width and height of the widget.
 void setStateful(boolean stateful)
          A flag which specifies if the component is stateful (defaults to false).
 void setStateId(String stateId)
          Sets the widget's state id which is a unique id for this widget to use for state management purposes (defaults to the widget id if one was set, otherwise null if the widget is using a generated id).
 void setTabIndex(int tabIndex)
          Sets the widget's tab index.
 void setToolTip(String text)
          Sets the widget's tool tip.
 void setToolTipConfig(ToolTipConfig config)
          Sets the widget's tool tip with the given config.
 void setVisible(boolean visible)
          Convenience function to hide or show this widget by boolean.
 void setWidth(int width)
          Sets the width of the widget.
 void setWidth(String width)
          Sets the width of the widget.
 void show()
          Show this widget.
 void sync(boolean show)
          Syncs the layer of the widget.
 void syncSize()
          Clears the size cache and resets to the last known size.
 void unmask()
          Unmasks the widget.
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, getLayoutData, getParent, isAttached, removeFromParent, setLayoutData, sinkEvents
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, removeStyleDependentName, removeStyleName, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, sinkBitlessEvent, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addBeforeHideHandler

public HandlerRegistration addBeforeHideHandler(BeforeHideEvent.BeforeHideHandler handler)
Description copied from interface: BeforeHideEvent.HasBeforeHideHandlers
Adds a BeforeHideEvent.BeforeHideHandler handler for BeforeHideEvent events.

Specified by:
addBeforeHideHandler in interface BeforeHideEvent.HasBeforeHideHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addBeforeShowContextMenuHandler

public HandlerRegistration addBeforeShowContextMenuHandler(BeforeShowContextMenuEvent.BeforeShowContextMenuHandler handler)
Description copied from interface: BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler
Adds a BeforeShowContextMenuEvent.BeforeShowContextMenuHandler handler for BeforeShowContextMenuEvent events.

Specified by:
addBeforeShowContextMenuHandler in interface BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler
Parameters:
handler - the handler
Returns:
the registration for the event

addBeforeShowHandler

public HandlerRegistration addBeforeShowHandler(BeforeShowEvent.BeforeShowHandler handler)
Description copied from interface: BeforeShowEvent.HasBeforeShowHandlers
Adds a BeforeShowEvent.BeforeShowHandler handler for BeforeShowEvent events.

Specified by:
addBeforeShowHandler in interface BeforeShowEvent.HasBeforeShowHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addBlurHandler

public HandlerRegistration addBlurHandler(BlurEvent.BlurHandler handler)
Description copied from interface: BlurEvent.HasBlurHandlers
Adds a BlurEvent.BlurHandler handler for BlurEvent events.

Specified by:
addBlurHandler in interface BlurEvent.HasBlurHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addDisableHandler

public HandlerRegistration addDisableHandler(DisableEvent.DisableHandler handler)
Description copied from interface: DisableEvent.HasDisableHandlers
Adds a DisableEvent.DisableHandler handler for DisableEvent events.

Specified by:
addDisableHandler in interface DisableEvent.HasDisableHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addEnableHandler

public HandlerRegistration addEnableHandler(EnableEvent.EnableHandler handler)
Description copied from interface: EnableEvent.HasEnableHandlers
Adds a EnableEvent.EnableHandler handler for EnableEvent events.

Specified by:
addEnableHandler in interface EnableEvent.HasEnableHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addFocusHandler

public HandlerRegistration addFocusHandler(FocusEvent.FocusHandler handler)
Description copied from interface: FocusEvent.HasFocusHandlers
Adds a FocusEvent.FocusHandler handler for FocusEvent events.

Specified by:
addFocusHandler in interface FocusEvent.HasFocusHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addHideHandler

public HandlerRegistration addHideHandler(HideEvent.HideHandler handler)
Description copied from interface: HideEvent.HasHideHandlers
Adds a HideEvent.HideHandler handler for HideEvent events.

Specified by:
addHideHandler in interface HideEvent.HasHideHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addMoveHandler

public HandlerRegistration addMoveHandler(MoveEvent.MoveHandler handler)
Description copied from interface: MoveEvent.HasMoveHandlers
Adds a MoveEvent.MoveHandler handler for MoveEvent events.

Specified by:
addMoveHandler in interface MoveEvent.HasMoveHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addResizeHandler

public HandlerRegistration addResizeHandler(ResizeHandler handler)
Specified by:
addResizeHandler in interface HasResizeHandlers

addShowContextMenuHandler

public HandlerRegistration addShowContextMenuHandler(ShowContextMenuEvent.ShowContextMenuHandler handler)
Description copied from interface: ShowContextMenuEvent.HasShowContextMenuHandler
Adds a ShowContextMenuEvent.ShowContextMenuHandler handler for ShowContextMenuEvent events.

Specified by:
addShowContextMenuHandler in interface ShowContextMenuEvent.HasShowContextMenuHandler
Parameters:
handler - the handler
Returns:
the registration for the event

addShowHandler

public HandlerRegistration addShowHandler(ShowEvent.ShowHandler handler)
Description copied from interface: ShowEvent.HasShowHandlers
Adds a ShowEvent.ShowHandler handler for ShowEvent events.

Specified by:
addShowHandler in interface ShowEvent.HasShowHandlers
Parameters:
handler - the handler
Returns:
the registration for the event

addStyleOnOver

public void addStyleOnOver(Element elem,
                           String style)
Adds a style to the given element on mouseover. The widget must be sinking mouse events for the over style to function.

Parameters:
elem - the over element
style - the style to add

clearSizeCache

public void clearSizeCache()
Clears the size cache (the size of the widget the last time it was changed).


disable

public void disable()
Disable this widget.


disableEvents

public void disableEvents()
True to disable event processing.


enable

public void enable()
Enable this widget.


enableEvents

public void enableEvents()
True to enable event processing.


fireEvent

public void fireEvent(GwtEvent<?> event)
Specified by:
fireEvent in interface HasHandlers
Overrides:
fireEvent in class Widget

focus

public void focus()
Try to focus this widget.


getData

public <X> X getData(String key)
Returns the application defined property for the given name, or null if it has not been set.

Parameters:
key - the name of the property
Returns:
the value or null if it has not been set

getElement

public XElement getElement()
Gets a handle to the object's underlying DOM element. This method should not be overridden. It is non-final solely to support legacy code that depends upon overriding it. If it is overridden, the subclass implementation must not return a different element than was previously set using UIObject.setElement(com.google.gwt.user.client.Element).

Overrides:
getElement in class UIObject
Returns:
the object's browser element

getFocusSupport

public FocusManagerSupport getFocusSupport()
Returns the focus manager support configuration. Only applicable when the focus manager has been enabled.

Specified by:
getFocusSupport in interface HasFocusSupport
Returns:
the focus manager configuration

getHideMode

public Style.HideMode getHideMode()
Returns the widget's hide mode.

Returns:
the hide mode

getId

public String getId()
Returns the widget's id.

Returns:
the widget id

getItemId

public String getItemId()
Returns the item id of this widget. Unlike the widget's id, the item id does not have to be unique.

Specified by:
getItemId in interface HasItemId
Returns:
the widget's item id

getOffsetHeight

public int getOffsetHeight(boolean content)
Returns the widget's height.

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

getOffsetWidth

public int getOffsetWidth(boolean content)
Returns the element's width.

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

getShadow

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

Returns:
the shadow the shadow state

getStateId

public String getStateId()
Returns the widget's state id. If a state id is specified, it is used as the key when saving and retrieving the widget's state.

Returns:
the state id

getToolTip

public ToolTip getToolTip()
Returns the widget's tool tip.

Returns:
the tool tip

hide

public void hide()
Hide this widget.


hideToolTip

public void hideToolTip()
Hides the widget's tool tip (if one exists).


isAllowTextSelection

public boolean isAllowTextSelection()
Returns the enable text selection state.

Returns:
true if enable, false if disabled

isAutoHeight

public boolean isAutoHeight()
Returns the auto height state.

Returns:
the auto height state

isAutoWidth

public boolean isAutoWidth()
Returns the auto width state.

Returns:
true of auto width

isDeferHeight

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

Returns:
the defer height state

isEnabled

public boolean isEnabled()
Returns true if the widget is enabled.

Returns:
the enabled state

isRendered

public boolean isRendered()
Returns true if the component has been rendered.

Returns:
true if rendered

isStateful

public boolean isStateful()
Returns true if the widget is saving and restore it's state.

Returns:
true if stateful

isVisible

public boolean isVisible()
Specified by:
isVisible in interface HasVisibility
Overrides:
isVisible in class UIObject

isVisible

public boolean isVisible(boolean deep)
Returns true if the widget is visible.

Parameters:
deep - true to search up the widget hierarchy
Returns:
true if the widget is visible

mask

public void mask()
Puts a mask over this widget to disable user interaction.


mask

public void mask(String message)
Puts a mask over this widget to disable user interaction.

Parameters:
message - a message to display in the mask

onBrowserEvent

public void onBrowserEvent(Event event)
Specified by:
onBrowserEvent in interface EventListener
Overrides:
onBrowserEvent in class Widget

removeToolTip

public void removeToolTip()
Removes the components tooltip (if one exists).


setAllowTextSelection

public void setAllowTextSelection(boolean enable)
Enables and disables text selection for the widget.

Parameters:
enable - true to enable, false to disable

setBorders

public void setBorders(boolean show)
Adds or removes a border.

Parameters:
show - true to display a border

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Sets the widget's size.

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

setBounds

public void setBounds(Rectangle bounds)
Sets the widget's size.

Parameters:
bounds - the update box

setContextMenu

public void setContextMenu(Menu menu)
Sets the widget's context menu.

Parameters:
menu - the context menu

setData

public void setData(String key,
                    Object data)
Sets the application defined property with the given name.

Parameters:
key - the name of the property
data - the new value for the property

setDeferHeight

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

Parameters:
deferHeight - true to defer height

setEnabled

public void setEnabled(boolean enabled)
Convenience function for setting disabled/enabled by boolean.

Parameters:
enabled - the enabled state

setHeight

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

Parameters:
height - the new height

setHeight

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

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

setHideMode

public void setHideMode(Style.HideMode hideMode)
Sets the components hide mode (defaults to HideMode.DISPLAY).

Parameters:
hideMode - the hide mode.

setId

public void setId(String id)
Sets the component's id.

Parameters:
id - the id

setItemId

public void setItemId(String id)
Sets the widget's item id. Unlike a widget's id, the widget's item id is not tied to id attribute of the widget's root element. As such, the item id does not have to be unique.

Specified by:
setItemId in interface HasItemId
Parameters:
id - the item id

setPagePosition

public void setPagePosition(int x,
                            int y)
Sets the page XY position of the widget. To set the left and top instead, use setPosition(int, int).

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

setPixelSize

public void setPixelSize(int width,
                         int height)
Sets the component's size. Unlike GWT widget's, when setting sizes, the component's actual size will match exactly the size specified independent of borders and padding.

Overrides:
setPixelSize in class UIObject
Parameters:
width - new width, in pixels
height - height, in pixels

setPosition

public void setPosition(int left,
                        int top)
Sets the left and top of the widget. To set the page XY position instead, use setPagePosition(int, int).

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 widget (defaults to false).

Parameters:
shadow - true to enable the shadow

setSize

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

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

setStateful

public void setStateful(boolean stateful)
A flag which specifies if the component is stateful (defaults to false). The widget must have either a setStateId(String) or setId(String) assigned for state to be managed. Auto-generated ids are not guaranteed to be stable across page loads and cannot be relied upon to save and restore the same state for a widget.

Parameters:
stateful - true to enable state

setStateId

public void setStateId(String stateId)
Sets the widget's state id which is a unique id for this widget to use for state management purposes (defaults to the widget id if one was set, otherwise null if the widget is using a generated id).

Parameters:
stateId - the state id

setTabIndex

public void setTabIndex(int tabIndex)
Sets the widget's tab index.

Parameters:
tabIndex - the tab index

setToolTip

public void setToolTip(String text)
Sets the widget's tool tip.

Parameters:
text - the text

setToolTipConfig

public void setToolTipConfig(ToolTipConfig config)
Sets the widget's tool tip with the given config.

Parameters:
config - the tool tip config

setVisible

public void setVisible(boolean visible)
Convenience function to hide or show this widget by boolean.

Specified by:
setVisible in interface HasVisibility
Overrides:
setVisible in class UIObject
Parameters:
visible - the visible state

setWidth

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

Parameters:
width - the new width to set

setWidth

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

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

show

public void show()
Show this widget.


sync

public void sync(boolean show)
Syncs the layer of the widget.

Parameters:
show - true to show the layer

syncSize

public void syncSize()
Clears the size cache and resets to the last known size.


unmask

public void unmask()
Unmasks the widget.



Copyright © 2012. All Rights Reserved.