WIDGET
- is the generic type of AbstractUiWidgetAdapter.getToplevelWidget()
.public abstract class UiWidgetAdapterGwt<WIDGET extends com.google.gwt.user.client.ui.UIObject> extends AbstractUiWidgetAdapterWithEvents<WIDGET,EventAdapterGwt> implements AttributeWriteImage<UiWidgetImage>, HandlerRegistrationCollector
UiWidgetAdapter
using GWT
based on UIObject
.Modifier and Type | Field and Description |
---|---|
private com.google.gwt.user.client.ui.Image |
image |
protected static int |
TAB_INDEX_NONE
The tab index to remove from tab-order.
|
HTML_ATTRIBUTE_ID, ID_SEPARATOR, PROPERTY_ID
PROPERTY_STYLES, STYLE_PATTERN_MULTIPLE, STYLE_PATTERN_SINGLE
WAI_ARIA
PROPERTY_LABEL
ACCESS_KEY_NONE, HTML_ATTRIBUTE_ACCESS_KEY
ATTRIBUTE_COLSPAN
Constructor and Description |
---|
UiWidgetAdapterGwt()
The constructor.
|
UiWidgetAdapterGwt(WIDGET toplevelWidget)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addHandlerRegistration(com.google.gwt.event.shared.HandlerRegistration registration)
This method is to be called with the
HandlerRegistration for all permanent handlers. |
boolean |
addStyle(String style)
This method adds the given
style to the styles . |
String |
createAbsoluteImageUrl(String relativePath)
This method creates an absolute URL from the given
relativePath . |
protected EventAdapterGwt |
createEventAdapter(UiFeatureEvent source,
UiHandlerEvent sender)
This method creates the
AbstractUiWidgetAdapterWithEvents.getEventAdapter() instance. |
void |
dispose()
This method disposes this object.
|
com.google.gwt.user.client.ui.UIObject |
getActiveWidget()
This method gets the active widget.
|
double |
getHeightInPixel()
This method gets the height of this object in pixels.
|
UiWidgetImage |
getImage()
This method gets the
image of this object. |
protected com.google.gwt.dom.client.Element |
getImageParentElement()
This method gets the parent-
Element where a potential image is
attached . |
Length |
getLength(LengthProperty property)
This method gets the
Length for the given LengthProperty of this object. |
protected com.google.gwt.dom.client.Element |
getSizeElement() |
protected static com.google.gwt.user.client.ui.Widget |
getToplevelWidget(UiWidget widget)
This method is a simplified variant of
getToplevelWidget(UiWidget, Class) . |
protected static <W extends com.google.gwt.user.client.ui.UIObject> |
getToplevelWidget(UiWidget widget,
Class<W> widgetType)
This method gets the
native widget of the given widget . |
double |
getWidthInPixel()
This method gets the width of this object in pixels.
|
boolean |
isStyleDeltaSupported()
This method determines if the style delta operations
AttributeWriteStylesAdvanced.addStyle(String) ,
AttributeWriteStylesAdvanced.removeStyle(String) and AttributeWritePrimaryStyle.setPrimaryStyle(String) are supported by this widget adapter. |
boolean |
removeStyle(String style)
This method removes the given
style from the styles . |
void |
setAttribute(String name,
String value)
This method sets the
attribute of this object. |
void |
setId(String id)
This method set the
ID of this object. |
void |
setImage(UiWidgetImage imageWidget)
This method sets the
image of this object. |
void |
setLength(LengthProperty property,
Length length)
This method sets the specified
length of this object. |
void |
setPrimaryStyle(String primaryStyle)
This method sets the
primary style . |
void |
setStyles(String styles)
This method clears all
styles and sets them to the given styles . |
void |
setTooltip(String tooltip)
This method sets the tooltip text of this object.
|
void |
setVisible(boolean visible,
boolean programmatic) |
applyEventAdapter, applyEventAdapterForChange, applyEventAdapterForClick, applyEventAdapterForFocus, applyEventAdapterForSelection, getEventAdapter, setEventSender
createLabel, createToplevelWidget, getAccessKey, getAltText, getAttribute, getBundle, getColumnSpan, getContext, getHeightInRows, getId, getLabel, getMaximumTextLength, getPrimaryStyle, getSelectionMode, getStyles, getTitle, getTooltip, getToplevelWidget, getUiWidget, getUiWidgetTyped, getUrl, getValidationFailure, hasStyle, isDisposed, isEnabled, isFocused, isResizable, setMode, setParent, setUiWidget
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
removeFromParent
setEnabled
protected static final int TAB_INDEX_NONE
-1
. See GWT bug 8323.private com.google.gwt.user.client.ui.Image image
setImage(UiWidgetImage)
public UiWidgetAdapterGwt()
public UiWidgetAdapterGwt(WIDGET toplevelWidget)
toplevelWidget
- is the toplevel widget
.protected static final com.google.gwt.user.client.ui.Widget getToplevelWidget(UiWidget widget)
getToplevelWidget(UiWidget, Class)
.widget
- is the UiWidget
to "unwrap".protected static final <W extends com.google.gwt.user.client.ui.UIObject> W getToplevelWidget(UiWidget widget, Class<W> widgetType)
native widget
of the given widget
.W
- is the generic type of widgetType
.widget
- is the UiWidget
to "unwrap".widgetType
- is the expected type of the native widget.public com.google.gwt.user.client.ui.UIObject getActiveWidget()
AbstractUiWidgetAdapter.getToplevelWidget()
. In more complex scenarios the toplevel widget
may only be a container widget and this method returns a child that represents the active part.getActiveWidget
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
public void setId(String id)
ID
of this object. Use this method to give the object a meaningful
identifier after creation. AttributeReadHtmlId.getId()
for the syntax constraints of IDs.setId
in interface AttributeWriteHtmlId
setId
in interface AttributeWriteId<String>
id
- is the new ID
for the object.public void setTooltip(String tooltip)
setTooltip
in interface AttributeWriteTooltip
tooltip
- is the new tooltip text or null
to disable the tooltip.AttributeReadTooltip.getTooltip()
public void setAttribute(String name, String value)
attribute
of this object.setAttribute
in interface AttributeWriteOnlyAttribute
name
- is the name of the attribute
.value
- is the new value of the attribute
. May
be null
to unset (remove attribute).public void setVisible(boolean visible, boolean programmatic)
setVisible
in interface UiWidgetAdapter
visible
- - true
to set visible (show), false
to set invisible (hide).programmatic
- - see UiEvent.isProgrammatic()
.AttributeWriteVisibleAdvanced.setVisible(boolean, boolean)
public void setStyles(String styles)
styles
and sets them to the given styles
. This
will also update the primary style
.setStyles
in interface AttributeWriteStyles
styles
- are the styles of this object. Either a single style or a list of styles separated by
whitespaces. Use the empty string to unset all styles.public boolean addStyle(String style)
style
to the styles
.addStyle
in interface AttributeWriteStylesAdvanced
addStyle
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
style
- is the style to add. If this style is already contained in the styles
,
this will have no effect.true
if the styles has actually been added, false
if it was already
present before.public boolean removeStyle(String style)
style
from the styles
.removeStyle
in interface AttributeWriteStylesAdvanced
removeStyle
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
style
- is the style to remove. If this style is NOT contained in the styles
,
this will have no effect.true
if the given style
has actually been removed, false
otherwise (if it was NOT present
).public void setPrimaryStyle(String primaryStyle)
primary style
.setPrimaryStyle
in interface AttributeWritePrimaryStyle
setPrimaryStyle
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
primaryStyle
- is the new value for primary style
.AttributeReadStyles.getStyles()
public boolean isStyleDeltaSupported()
AttributeWriteStylesAdvanced.addStyle(String)
,
AttributeWriteStylesAdvanced.removeStyle(String)
and AttributeWritePrimaryStyle.setPrimaryStyle(String)
are supported by this widget adapter.
Otherwise such operations are always performed via the AttributeWriteStyles.setStyles(String)
method. If supported
the delta operations are preferred as they are assumed to be more efficient.isStyleDeltaSupported
in interface UiWidgetAdapter
isStyleDeltaSupported
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
true
if style delta operations are supported, false
otherwise.public Length getLength(LengthProperty property)
Length
for the given LengthProperty
of this object. getLength
(LengthProperty.WIDTH
)
will return the same result as AttributeReadSize.getWidth()
. Unlike AttributeReadSize
this method provides access to additional properties such as e.g. LengthProperty.MIN_WIDTH
or
LengthProperty.MAX_HEIGHT
.getLength
in interface AttributeReadLengthProperty
property
- is the LengthProperty
identifying the actual property to get.Length
. Will be Length.ZERO
if undefined (NOT set).public void setLength(LengthProperty property, Length length)
length
of this object. setLength
(LengthProperty.WIDTH
, value)
will return the same result as setWidth
(value)
.setLength
in interface AttributeWriteLengthProperty
property
- is the LengthProperty
identifying the actual property to set.length
- is the new length
to set.public double getWidthInPixel()
int
value. However, to be compatible with
Length.getAmount()
and with some underlying native toolkits we
use double
to prevent potential information loss.getWidthInPixel
in interface AttributeReadSizeInPixel
public double getHeightInPixel()
int
value. However, to be compatible with
Length.getAmount()
and with some underlying native toolkits we
use double
to prevent potential information loss.getHeightInPixel
in interface AttributeReadSizeInPixel
protected com.google.gwt.dom.client.Element getSizeElement()
Element
used by getLength(LengthProperty)
and
setLength(LengthProperty, Length)
.protected EventAdapterGwt createEventAdapter(UiFeatureEvent source, UiHandlerEvent sender)
AbstractUiWidgetAdapterWithEvents.getEventAdapter()
instance. It should to be implemented by the top-level
widget-adapter class specific for a native UI toolkit. It may further be overridden to use a sub-class
instead when more specific behavior is needed.createEventAdapter
in class AbstractUiWidgetAdapterWithEvents<WIDGET extends com.google.gwt.user.client.ui.UIObject,EventAdapterGwt>
source
- is the source of the events (typically UiWidget
).sender
- is the sender of events (an adapter that delegates to the individual handlers/listeners).event adapter
.public void setImage(UiWidgetImage imageWidget)
image
of this object. A previously set image will be replaced.setImage
in interface AttributeWriteImage<UiWidgetImage>
imageWidget
- is the new image
or null
to remove the image.protected com.google.gwt.dom.client.Element getImageParentElement()
Element
where a potential image is
attached
.Element
for an image.public UiWidgetImage getImage()
image
of this object. If the image is attached to an
object with arbitrary other features and has a smaller size, it is typically called icon.getImage
in interface AttributeReadImage<UiWidgetImage>
getImage
in class AbstractUiWidgetAdapter<WIDGET extends com.google.gwt.user.client.ui.UIObject>
null
if no image is defined.public void dispose()
dispose
in interface AttributeWriteDisposed
public String createAbsoluteImageUrl(String relativePath)
relativePath
.createAbsoluteImageUrl
in interface UiWidgetAdapter
relativePath
- is the relative path (URL suffix) to the image.UiConfiguration.getTheme()
public void addHandlerRegistration(com.google.gwt.event.shared.HandlerRegistration registration)
HandlerRegistration
for all permanent handlers. This allows
to remove
them on
disposal
.addHandlerRegistration
in interface HandlerRegistrationCollector
registration
- is the HandlerRegistration
to add.Copyright © 2001–2016 mmm-Team. All rights reserved.