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, HasItemId, HasFocusSupport, HasGestureRecognizers
Modifier and Type | Field and Description |
---|---|
protected boolean |
adjustSize
True to adjust sizes for box model issues to ensure actual size matches set size.
|
protected boolean |
allowTextSelection |
protected boolean |
cacheSizes
True to cache size calculation (defaults to true) for better performance.
|
protected boolean |
disableContextMenu |
protected boolean |
disabled
True if the widget is disabled.
|
protected String |
disabledStyle
The style used when a widget is disabled (defaults to
ThemeStyles.getStyle().disabled() ). |
protected boolean |
ensureVisibilityOnSizing
Set this to true if you have sizing issues in initial collapsed or hidden items.
|
protected String |
height |
protected boolean |
hidden
True if this widget is hidden.
|
protected Size |
lastSize
The size of the widget that last time it was changed.
|
protected Layer |
layer |
protected int |
left |
protected boolean |
mask |
protected String |
maskMessage |
protected boolean |
monitorWindowResize |
protected int |
pageX |
protected int |
pageY |
protected HandlerRegistration |
resizeHandler |
protected boolean |
shim
True to enable a shim which uses a transparent iframe to stop content from bleeding through.
|
protected int |
tabIndex |
protected ToolTip |
toolTip |
protected ToolTipConfig |
toolTipConfig |
protected int |
top |
protected String |
width |
protected int |
windowResizeDelay |
protected DelayedTask |
windowResizeTask |
Modifier | Constructor and Description |
---|---|
protected |
Component() |
Modifier and Type | Method and Description |
---|---|
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. |
void |
addGestureRecognizer(GestureRecognizer gestureRecognizer)
Adds a GestureRecognizer.
|
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. |
protected void |
addStyleDependentName(Element element,
String style)
Adds a dependent style name to a child element.
|
void |
addStyleOnOver(Element elem,
String style)
Adds a style to the given element on mouseover.
|
protected Point |
adjustPosition(Point point) |
protected Size |
adjustSize(Size size) |
protected void |
applyState(Map<String,Object> state) |
protected void |
assertAfterRender() |
protected void |
assertPreRender() |
protected void |
blur()
Tries to remove focus from the widget.
|
void |
clearSizeCache()
Clears the size cache (the size of the widget the last time it was changed).
|
void |
disable()
Disable this widget.
|
protected void |
disableContextMenu(boolean disable)
Enables and disables the widget's context menu.
|
void |
disableEvents()
True to disable event processing.
|
void |
enable()
Enable this widget.
|
void |
enableEvents()
True to enable event processing.
|
protected boolean |
fireCancellableEvent(<any> event) |
void |
fireEvent(<any> 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.
|
protected XElement |
getFocusEl() |
FocusManagerSupport |
getFocusSupport()
Returns the focus manager support configuration.
|
GestureRecognizer |
getGestureRecognizer(int index)
Get GestureRecognizer at given index
|
int |
getGestureRecognizerCount()
Provides the count of GestureRecognizers
|
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.
|
protected XElement |
getPositionEl()
Returns the element to be used when positioning the widget.
|
boolean |
getShadow()
Returns true if the shadow is enabled.
|
Layer.ShadowPosition |
getShadowPosition()
Returns the shadow position.
|
String |
getStateId()
Returns the widget's state id.
|
int |
getTabIndex()
Returns the current tabIndex of the component.
|
ToolTip |
getToolTip()
Returns the widget's tool tip.
|
void |
hide()
Hide this widget.
|
protected void |
hideShadow() |
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. |
protected boolean |
isMonitorWindowResize()
Returns true if browser resizing is monitored
|
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.
|
protected void |
notifyHide() |
protected void |
notifyShow() |
protected void |
onAfterFirstAttach()
Called immediately after the first time the widget becomes attached to the browser's document only the first time.
|
protected void |
onAttach() |
protected void |
onBlur(Event event) |
void |
onBrowserEvent(Event event) |
protected void |
onDetach() |
protected void |
onDisable() |
protected void |
onEnable() |
protected void |
onFocus(Event event) |
protected void |
onHide() |
protected void |
onHideContextMenu(HideEvent event) |
protected void |
onLoad() |
protected void |
onPosition(int x,
int y)
Called after the widget is moved, this method is empty by default but can be implemented by any subclass that needs
to perform custom logic after a move occurs.
|
protected void |
onResize(int width,
int height)
Called after the widget is resized, this method is empty by default but can be implemented by any subclass that
needs to perform custom logic after a resize occurs.
|
protected void |
onRightClick(Event event) |
protected void |
onShow() |
protected void |
onShowContextMenu(int clientX,
int clientY) |
protected void |
onTouch(Event event) |
protected void |
onUnload() |
protected void |
onWindowResize(int width,
int height) |
protected void |
removeStyleDependentName(Element element,
String style)
Removes a dependent style name from a child element.
|
protected void |
removeStyleOnOver(Element elem) |
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.
|
protected void |
setMonitorWindowResize(boolean monitorWindowResize)
True to have onWindowResize executed when the browser window is resized (default to false).
|
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, pre-render).
|
void |
setShadowPosition(Layer.ShadowPosition shadowPosition)
Sets the shadow position (defaults to SIDES, pre-render).
|
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).
|
protected void |
setStyleDependentName(Element element,
String style,
boolean add)
Adds or removes a dependent style name to a child element.
|
void |
setTabIndex(int tabIndex)
Sets the component's tab index.
|
void |
setToolTip(SafeHtml html)
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.
|
protected boolean adjustSize
protected boolean cacheSizes
protected boolean disabled
protected String disabledStyle
ThemeStyles.getStyle().disabled()
).protected boolean allowTextSelection
protected boolean ensureVisibilityOnSizing
protected boolean hidden
protected Size lastSize
protected String height
protected Layer layer
protected int left
protected int top
protected boolean mask
protected String maskMessage
protected boolean monitorWindowResize
protected int pageX
protected int pageY
protected HandlerRegistration resizeHandler
protected boolean shim
protected ToolTip toolTip
protected ToolTipConfig toolTipConfig
protected boolean disableContextMenu
protected String width
protected int windowResizeDelay
protected DelayedTask windowResizeTask
protected int tabIndex
public HandlerRegistration addBeforeHideHandler(BeforeHideEvent.BeforeHideHandler handler)
BeforeHideEvent.HasBeforeHideHandlers
BeforeHideEvent.BeforeHideHandler
handler for BeforeHideEvent
events.addBeforeHideHandler
in interface BeforeHideEvent.HasBeforeHideHandlers
handler
- the handlerpublic HandlerRegistration addBeforeShowContextMenuHandler(BeforeShowContextMenuEvent.BeforeShowContextMenuHandler handler)
BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler
BeforeShowContextMenuEvent.BeforeShowContextMenuHandler
handler for
BeforeShowContextMenuEvent
events.addBeforeShowContextMenuHandler
in interface BeforeShowContextMenuEvent.HasBeforeShowContextMenuHandler
handler
- the handlerpublic HandlerRegistration addBeforeShowHandler(BeforeShowEvent.BeforeShowHandler handler)
BeforeShowEvent.HasBeforeShowHandlers
BeforeShowEvent.BeforeShowHandler
handler for BeforeShowEvent
events.addBeforeShowHandler
in interface BeforeShowEvent.HasBeforeShowHandlers
handler
- the handlerpublic HandlerRegistration addBlurHandler(BlurEvent.BlurHandler handler)
BlurEvent.HasBlurHandlers
BlurEvent.BlurHandler
handler for BlurEvent
events.addBlurHandler
in interface BlurEvent.HasBlurHandlers
handler
- the handlerpublic HandlerRegistration addDisableHandler(DisableEvent.DisableHandler handler)
DisableEvent.HasDisableHandlers
DisableEvent.DisableHandler
handler for DisableEvent
events.addDisableHandler
in interface DisableEvent.HasDisableHandlers
handler
- the handlerpublic HandlerRegistration addEnableHandler(EnableEvent.EnableHandler handler)
EnableEvent.HasEnableHandlers
EnableEvent.EnableHandler
handler for EnableEvent
events.addEnableHandler
in interface EnableEvent.HasEnableHandlers
handler
- the handlerpublic HandlerRegistration addFocusHandler(FocusEvent.FocusHandler handler)
FocusEvent.HasFocusHandlers
FocusEvent.FocusHandler
handler for FocusEvent
events.addFocusHandler
in interface FocusEvent.HasFocusHandlers
handler
- the handlerpublic HandlerRegistration addHideHandler(HideEvent.HideHandler handler)
HideEvent.HasHideHandlers
HideEvent.HideHandler
handler for HideEvent
events.addHideHandler
in interface HideEvent.HasHideHandlers
handler
- the handlerpublic HandlerRegistration addMoveHandler(MoveEvent.MoveHandler handler)
MoveEvent.HasMoveHandlers
MoveEvent.MoveHandler
handler for MoveEvent
events.addMoveHandler
in interface MoveEvent.HasMoveHandlers
handler
- the handlerpublic HandlerRegistration addResizeHandler(ResizeHandler handler)
public HandlerRegistration addShowContextMenuHandler(ShowContextMenuEvent.ShowContextMenuHandler handler)
ShowContextMenuEvent.HasShowContextMenuHandler
ShowContextMenuEvent.ShowContextMenuHandler
handler for
ShowContextMenuEvent
events.addShowContextMenuHandler
in interface ShowContextMenuEvent.HasShowContextMenuHandler
handler
- the handlerpublic HandlerRegistration addShowHandler(ShowEvent.ShowHandler handler)
ShowEvent.HasShowHandlers
ShowEvent.ShowHandler
handler for ShowEvent
events.addShowHandler
in interface ShowEvent.HasShowHandlers
handler
- the handlerpublic void addGestureRecognizer(GestureRecognizer gestureRecognizer)
HasGestureRecognizers
addGestureRecognizer
in interface HasGestureRecognizers
gestureRecognizer
- the gesture recognizerpublic GestureRecognizer getGestureRecognizer(int index)
HasGestureRecognizers
getGestureRecognizer
in interface HasGestureRecognizers
index
- the index you wantpublic int getGestureRecognizerCount()
HasGestureRecognizers
getGestureRecognizerCount
in interface HasGestureRecognizers
public void addStyleOnOver(Element elem, String style)
elem
- the over elementstyle
- the style to addpublic void clearSizeCache()
public void disable()
public void disableEvents()
public void enable()
public void enableEvents()
public void fireEvent(<any> event)
public void focus()
public <X> X getData(String key)
null
if it has not been set.X
- the type of data being returnedkey
- the name of the propertynull
if it has not been setpublic XElement getElement()
#setElement(com.google.gwt.dom.client.Element)
.public FocusManagerSupport getFocusSupport()
getFocusSupport
in interface HasFocusSupport
public Style.HideMode getHideMode()
public void setHideMode(Style.HideMode hideMode)
hideMode
- the hide mode.public String getId()
public void setId(String id)
id
- the idpublic String getItemId()
public void setItemId(String id)
public int getOffsetHeight(boolean content)
content
- true to get the height minus borders and paddingpublic int getOffsetWidth(boolean content)
content
- true to get the width minus borders and paddingpublic boolean getShadow()
public void setShadow(boolean shadow)
shadow
- true to enable the shadowpublic Layer.ShadowPosition getShadowPosition()
public void setShadowPosition(Layer.ShadowPosition shadowPosition)
shadowPosition
- the positionpublic String getStateId()
public void setStateId(String stateId)
stateId
- the state idpublic int getTabIndex()
public void setTabIndex(int tabIndex)
tabIndex
- the tab indexpublic ToolTip getToolTip()
public void hide()
public void hideToolTip()
public boolean isAllowTextSelection()
public void setAllowTextSelection(boolean enable)
enable
- true to enable, false to disablepublic boolean isAutoHeight()
public boolean isAutoWidth()
public boolean isDeferHeight()
public void setDeferHeight(boolean deferHeight)
deferHeight
- true to defer heightpublic boolean isEnabled()
true
if the widget is enabled.public void setEnabled(boolean enabled)
enabled
- the enabled statepublic boolean isRendered()
public boolean isStateful()
public void setStateful(boolean stateful)
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.stateful
- true to enable statepublic boolean isVisible()
public void setVisible(boolean visible)
visible
- the visible statepublic boolean isVisible(boolean deep)
true
if the widget is visible.deep
- true to search up the widget hierarchypublic void mask()
public void mask(String message)
message
- a message to display in the maskpublic void onBrowserEvent(Event event)
public void removeToolTip()
public void setBorders(boolean show)
show
- true
to display a borderpublic void setBounds(int x, int y, int width, int height)
x
- the x coordinatey
- the y coordinatewidth
- the widthheight
- the heightpublic void setBounds(Rectangle bounds)
bounds
- the update boxpublic void setContextMenu(Menu menu)
menu
- the context menupublic void setData(String key, Object data)
key
- the name of the propertydata
- the new value for the propertypublic void setHeight(int height)
height
- the new heightpublic void setHeight(String height)
height
- the new height to setpublic void setPagePosition(int x, int y)
setPosition(int, int)
.x
- the x coordinatey
- the y coordinatepublic void setPixelSize(int width, int height)
width
- new width, in pixelsheight
- height, in pixelspublic void setPosition(int left, int top)
setPagePosition(int, int)
.left
- the new lefttop
- the new toppublic void setSize(String width, String height)
width
- the new width to setheight
- the new height to setpublic void setToolTip(SafeHtml html)
html
- the tip text or htmlpublic void setToolTipConfig(ToolTipConfig config)
config
- the tool tip configpublic void setWidth(int width)
width
- the new width to setpublic void setWidth(String width)
width
- the new width to setpublic void show()
public void sync(boolean show)
show
- true to show the layerpublic void syncSize()
public void unmask()
protected void addStyleDependentName(Element element, String style)
element
- the elementstyle
- the style nameprotected void assertAfterRender()
protected void assertPreRender()
protected void blur()
protected void disableContextMenu(boolean disable)
disable
- true
to disable the context menuprotected boolean fireCancellableEvent(<any> event)
protected XElement getFocusEl()
protected XElement getPositionEl()
protected void hideShadow()
protected boolean isMonitorWindowResize()
protected void setMonitorWindowResize(boolean monitorWindowResize)
monitorWindowResize
- true to monitor window resizingprotected void notifyHide()
protected void notifyShow()
protected void onAfterFirstAttach()
protected void onAttach()
protected void onBlur(Event event)
protected void onDetach()
protected void onDisable()
protected void onEnable()
protected void onFocus(Event event)
protected void onHide()
protected void onHideContextMenu(HideEvent event)
protected void onLoad()
protected void onPosition(int x, int y)
x
- the new x positiony
- the new y positionprotected void onResize(int width, int height)
width
- the widthheight
- the heightprotected void onRightClick(Event event)
protected void onShow()
protected void onShowContextMenu(int clientX, int clientY)
protected void onTouch(Event event)
protected void onUnload()
protected void onWindowResize(int width, int height)
protected void removeStyleDependentName(Element element, String style)
element
- the elementstyle
- the style nameprotected void removeStyleOnOver(Element elem)
protected void setStyleDependentName(Element element, String style, boolean add)
element
- the elementstyle
- the style nameadd
- true to add, otherwise removeCopyright © 2018. All rights reserved.