public abstract class AbstractUiWidgetFactory extends AbstractLoggableComponent implements UiWidgetFactory
UiWidgetFactory.| Modifier and Type | Field and Description |
|---|---|
private AbstractUiContext |
context |
private UiWidgetFactoryDatatype |
widgetFactoryDatatype |
private UiWidgetFactoryNative |
widgetFactoryNative |
CDI_NAME| Constructor and Description |
|---|
AbstractUiWidgetFactory()
The constructor.
|
| Modifier and Type | Method and Description |
|---|---|
<WIDGET extends UiWidgetNative> |
create(Class<WIDGET> widgetInterface)
This method creates a new
UiWidget instance of the given type (
widgetInterface). |
<VALUE> UiWidgetField<VALUE> |
createForDatatype(Class<VALUE> datatype)
This method creates a new instance of the
field widget to view and edit the given
datatype. |
protected void |
doInitialize()
This method performs the actual
initialization. |
protected UiContext |
getContext() |
UiWidgetMainWindow |
getMainWindow()
This method gets the application
main window. |
Object |
getNativeWidget(UiWidgetRegular widget)
This method gets the underlying native widget of the given
regular widget. |
void |
setContext(AbstractUiContext context) |
void |
setWidgetFactoryDatatype(UiWidgetFactoryDatatype widgetFactoryDatatype) |
void |
setWidgetFactoryNative(UiWidgetFactoryNative widgetFactoryNative) |
createLogger, getLoggerdoInitialized, getInitializationState, initializeclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateButton, createButton, createButton, createButton, createComboBox, createComboBox, createImage, createIntegerField, createLabel, createListTable, createLongField, createPopup, createPopup, createSection, createSplitPanel, createTextAreaField, createTextField, createTreeprivate AbstractUiContext context
getContext()private UiWidgetFactoryNative widgetFactoryNative
private UiWidgetFactoryDatatype widgetFactoryDatatype
protected void doInitialize()
initialization. It is called when AbstractComponent.initialize() is
invoked for the first time. super.AbstractComponent.doInitialize().doInitialize in class AbstractLoggableComponent@Inject public void setContext(AbstractUiContext context)
context - is the UiContext to Inject.@Inject public void setWidgetFactoryDatatype(UiWidgetFactoryDatatype widgetFactoryDatatype)
widgetFactoryDatatype - is the UiWidgetFactoryDatatype to Inject.@Inject public void setWidgetFactoryNative(UiWidgetFactoryNative widgetFactoryNative)
widgetFactoryNative - is the UiWidgetFactoryNative to Inject.public UiWidgetMainWindow getMainWindow()
main window. In case of a web application
this will be the browser window (respective the current tab). In case of a MDI (multiple document
interface) client this is the master window. Otherwise it will be a new window that should be
opened initially.getMainWindow in interface AbstractUiWidgetFactoryNativemain window.public <WIDGET extends UiWidgetNative> WIDGET create(Class<WIDGET> widgetInterface)
UiWidget instance of the given type (
widgetInterface). field widgets such as
UiWidgetLocalDateField or
UiWidgetTextField. Instead use
UiWidgetFactoryDatatype.createForDatatype(Class). API of UiWidget
defines base interfaces marks as abstract. These interfaces cannot be used as argument to
this method. Further some widget interfaces are NOT abstract but will not be created via this method but
from some other widget. To avoid confusion the widgets that can be created here are marked via the
interface UiWidgetNative. All these interfaces except for UiWidgetNative itself can be
created and should be supported as legal arguments to this method.create in interface AbstractUiWidgetFactoryNativeWIDGET - is the generic type of the UiWidget to create.widgetInterface - is the interface reflecting the UiWidget
to create. Must NOT be abstract.UiWidget.public Object getNativeWidget(UiWidgetRegular widget)
regular widget.getNativeWidget in interface AbstractUiWidgetFactoryNativewidget - is the regular widget to unwrap. It has to be an instance
created by this factory.public <VALUE> UiWidgetField<VALUE> createForDatatype(Class<VALUE> datatype)
field widget to view and edit the given
datatype. custom datatypes (e.g. CustomerNumber) and use them in your data-model to make it more
expressive. For each datatype you are using (including standard datatypes such as String as well
as complex datatypes that require a composition of multiple widgets) you can register a sub-factory for
each datatype and then consequently use this method in your presentation code to receive the proper
field widget. The end-user will thank you for a consistent UI (where the
CustomerNumber is viewed and edited in exactly the same way in each dialog). Also you can stay
(a lot more) relaxed in case a change request comes up that CustomerNumber has to change its
format and validation rules in the entire data-model and UI.createForDatatype in interface AbstractUiWidgetFactoryDatatypeVALUE - is the generic type of the Datatype.datatype - is the Datatype.field widget to display and edit the specified
datatype.Copyright © 2001–2016 mmm-Team. All rights reserved.