WIDGET
- is the generic type of getToplevelWidget()
.public abstract class AbstractUiWidgetAdapter<WIDGET> extends Object implements UiWidgetAdapter, AttributeReadAltText, AttributeReadUrl, AttributeReadLabel, AttributeReadTitle<String>, AttributeReadImage<UiWidgetImage>, AttributeReadValidationFailure, AttributeReadAccessKey, AttributeReadFocused, AttributeReadMaximumTextLength, AttributeReadHeightInRows, AttributeReadColumnSpan, AttributeReadResizable, AttributeReadSelectionMode
UiWidgetAdapter
.Modifier and Type | Field and Description |
---|---|
private WIDGET |
toplevelWidget |
private AbstractUiWidgetNative<?,?> |
uiWidget |
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 |
---|
AbstractUiWidgetAdapter()
The constructor.
|
AbstractUiWidgetAdapter(WIDGET toplevelWidget)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
addStyle(String style)
This method adds the given
style to the styles . |
AbstractUiWidgetLabel<?> |
createLabel(UiContext context)
This method creates the label for this widget.
|
protected abstract WIDGET |
createToplevelWidget()
This method creates the
underlying widget . |
char |
getAccessKey()
This method gets the access key of this object.
|
Object |
getActiveWidget()
This method gets the active widget.
|
String |
getAltText()
This method gets the alternative text of this object.
|
String |
getAttribute(String name)
This method gets the attribute with the given
name of this object. |
protected NlsBundleClientUiRoot |
getBundle() |
int |
getColumnSpan()
This method gets the number of columns spanned by this object (cell).
|
UiContext |
getContext() |
int |
getHeightInRows()
This method gets the height in rows of this object.
|
String |
getId()
This method gets the unique identifier of this object.
|
UiWidgetImage |
getImage()
This method gets the
image of this object. |
String |
getLabel()
This method gets the label of this object.
|
int |
getMaximumTextLength()
This method gets the maximum text length of this object.
|
String |
getPrimaryStyle()
This method gets the primary
style of this object. |
SelectionMode |
getSelectionMode()
This method gets the
SelectionMode . |
String |
getStyles()
This method gets the style(s) (also called style-name(s)) of this object.
|
String |
getTitle()
This method gets the title of this object.
|
String |
getTooltip()
This method gets the tooltip of this object.
|
WIDGET |
getToplevelWidget() |
AbstractUiWidgetNative<?,?> |
getUiWidget()
This method gives access to the
native UI widget wrapping this widget
adapter. |
protected AbstractUiWidgetNative<?,?> |
getUiWidgetTyped()
This method is a design suggestion for implementations of widget adapters that need typed access to
getUiWidget() and want to perform the cast only in a single place. |
String |
getUrl()
This method gets the URL of this object.
|
String |
getValidationFailure()
This method gets the validation failure of this object.
|
boolean |
hasStyle(String style)
This method checks if the given
style is contained in the set of styles
of this object. |
boolean |
isDisposed()
This method tests if this object has been
disposed . |
boolean |
isEnabled()
This method determines if this object is enabled.
|
boolean |
isFocused()
This method determines if this object currently has the focus.
|
boolean |
isResizable()
This method determines if this object is resizable.
|
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 |
setMode(boolean editMode)
This method is called from
UiModeChanger for
AttributeWriteMode.setMode(net.sf.mmm.client.ui.api.common.UiMode) . |
void |
setParent(UiWidgetComposite<?> parent)
This method gets called whenever the parent of the according
UiWidget is changed. |
void |
setPrimaryStyle(String primaryStyle)
This method sets the
primary style . |
void |
setUiWidget(AbstractUiWidgetNative<?,?> uiWidget) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
createAbsoluteImageUrl, removeFromParent, setEventSender, setVisible
setId
setTooltip
setEnabled
setStyles
dispose
setLength
getLength
getHeightInPixel, getWidthInPixel
setAttribute
private WIDGET toplevelWidget
getToplevelWidget()
private AbstractUiWidgetNative<?,?> uiWidget
getUiWidget()
public AbstractUiWidgetAdapter()
public AbstractUiWidgetAdapter(WIDGET toplevelWidget)
toplevelWidget
- is the toplevel widget
.protected abstract WIDGET createToplevelWidget()
underlying widget
. underlying widget
.public WIDGET getToplevelWidget()
getToplevelWidget
in interface UiWidgetAdapter
AbstractUiWidgetFactoryNative.getNativeWidget(net.sf.mmm.client.ui.api.widget.UiWidgetRegular)
public Object getActiveWidget()
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.public final AbstractUiWidgetNative<?,?> getUiWidget()
native UI widget
wrapping this widget
adapter. UI widget
wrapping this widget adapter.protected AbstractUiWidgetNative<?,?> getUiWidgetTyped()
getUiWidget()
and want to perform the cast only in a single place. If you would override
getUiWidget()
to add the cast and do that multiple times across the inheritance hierarchy this
would cause multiple/unnecessary casts. Casting is required as we already declare enough generics for
widget adapters and also want to keep the code more flexible.UiWidget
potentially specifically typed.public void setUiWidget(AbstractUiWidgetNative<?,?> uiWidget)
uiWidget
- is the uiWidget to setpublic void setParent(UiWidgetComposite<?> parent)
UiWidget
is changed. It does nothing by default but may be
overridden to deal with special behavior of native UI toolkits.setParent
in interface UiWidgetAdapter
parent
- is the new parent or null
if removed from parent
.public String getId()
[a-zA-Z][a-zA-Z0-9_$]*
.
Invalid IDs (e.g. containing colon, hash or period) are not accepted to prevent you from later having
problems with CSS selectors.getId
in interface AttributeReadHtmlId
getId
in interface AttributeReadId<String>
AttributeReadHtmlId.ID_SEPARATOR
public SelectionMode getSelectionMode()
SelectionMode
.getSelectionMode
in interface AttributeReadSelectionMode
SelectionMode
. Must not be null
.public void setMode(boolean editMode)
UiModeChanger
for
AttributeWriteMode.setMode(net.sf.mmm.client.ui.api.common.UiMode)
. It only
handles the predefined UiMode
s.setMode
in interface UiWidgetAdapter
editMode
- - true
of UiMode.EDIT
and
false
for UiMode.VIEW
.protected NlsBundleClientUiRoot getBundle()
NlsBundleClientUiRoot
.public String getTooltip()
getTooltip
in interface AttributeReadTooltip
public boolean isEnabled()
isEnabled
in interface AttributeReadEnabled
true
if this object is enabled, false
if this object is disabled.public String getStyles()
class
attribute of HTML
elements that are then configured via some cascading style sheet (CSS). AttributeReadStyles.STYLE_PATTERN_SINGLE
. Any number of styles or in other words
the result of this has to match AttributeReadStyles.STYLE_PATTERN_MULTIPLE
. The first style is called the
primary style
.getStyles
in interface AttributeReadStyles
public boolean isDisposed()
disposed
. A disposed object can
NOT be used anymore.isDisposed
in interface AttributeReadDisposed
true
if this object has been disposed.AttributeWriteDisposed.dispose()
public String getAltText()
getAltText
in interface AttributeReadAltText
null
if NOT set.public String getUrl()
getUrl
in interface AttributeReadUrl
null
if NOT set.public String getLabel()
getLabel
in interface AttributeReadLabel
public String getTitle()
Object.toString()
of the result if NOT null
getTitle
in interface AttributeReadTitle<String>
null
if not set. The string-representation
of the result (if
NOT null
) needs to be suitable for end-users.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>
null
if no image is defined.public String getValidationFailure()
getValidationFailure
in interface AttributeReadValidationFailure
null
for no error.public String getAttribute(String name)
name
of this object. This is generic
and not further specified. It can e.g. allow to get DOM attributes of an element.getAttribute
in interface AttributeReadAttribute
name
- is the name of the requested attribute.name
or null
if NOT set.public char getAccessKey()
focus
.getAccessKey
in interface AttributeReadAccessKey
AttributeReadAccessKey.ACCESS_KEY_NONE
if no access key is defined.public int getMaximumTextLength()
Integer.MAX_VALUE
if no
maximum is defined.getMaximumTextLength
in interface AttributeReadMaximumTextLength
public int getHeightInRows()
getHeightInRows
in interface AttributeReadHeightInRows
public boolean isResizable()
isResizable
in interface AttributeReadResizable
true
if the object can be
resized
(by the end-user), false
otherwise.public int getColumnSpan()
1
indicates that the next cells to the right are
connected.getColumnSpan
in interface AttributeReadColumnSpan
1
.public String getPrimaryStyle()
style
of this object.getPrimaryStyle
in interface AttributeReadPrimaryStyle
null
if NOT defined.public boolean hasStyle(String style)
style
is contained in the set of styles
of this object.hasStyle
in interface AttributeReadStylesAdvanced
style
- is the style to check.style
is active.public boolean addStyle(String style)
style
to the styles
.addStyle
in interface AttributeWriteStylesAdvanced
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
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
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
true
if style delta operations are supported, false
otherwise.public boolean isFocused()
isFocused
in interface AttributeReadFocused
true
if this object is focused, false
otherwise.public AbstractUiWidgetLabel<?> createLabel(UiContext context)
FormItem
in SmartGWT). In such
case this method will wrap it as UiWidgetLabel
. Otherwise this method should
create
a new
UiWidgetLabel
and return it.createLabel
in interface UiWidgetAdapter
context
- is the UiContext
that may be used to create the label.Copyright © 2001–2016 mmm-Team. All rights reserved.