public abstract class AbstractUiWidgetFactoryNative extends AbstractComponent implements UiWidgetFactoryNative
UiContext
using
UiSingleWidgetFactoryNative
. This is helpful for implementations that can NOT use reflection.
Implementations extending this Class
need to register
instances of UiSingleWidgetFactoryNative
for all supported types of UiWidget
s.Modifier and Type | Field and Description |
---|---|
private UiContext |
context |
private Map<Class<? extends UiWidgetNative>,UiSingleWidgetFactoryNative<?>> |
interface2subFactoryMap |
private UiWidgetMainWindow |
mainWindow |
CDI_NAME
Constructor and Description |
---|
AbstractUiWidgetFactoryNative()
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 ). |
protected abstract UiWidgetMainWindow |
createMainWindow() |
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 . |
protected void |
register(UiSingleWidgetFactoryNative<?> subFactory)
This method registers the given
UiSingleWidgetFactoryNative as sub-factory of this factory. |
void |
setContext(UiContext context) |
doInitialize, doInitialized, getInitializationState, initialize
private final Map<Class<? extends UiWidgetNative>,UiSingleWidgetFactoryNative<?>> interface2subFactoryMap
create(Class)
private UiContext context
getContext()
private UiWidgetMainWindow mainWindow
getMainWindow()
public AbstractUiWidgetFactoryNative()
@Inject public void setContext(UiContext context)
context
- is the instance of UiContext
to Inject
protected void register(UiSingleWidgetFactoryNative<?> subFactory)
UiSingleWidgetFactoryNative
as sub-factory of this factory.subFactory
- is the UiSingleWidgetFactoryNative
to register.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 AbstractUiWidgetFactoryNative
WIDGET
- 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 AbstractUiWidgetFactoryNative
widget
- is the regular widget
to unwrap. It has to be an instance
created
by this factory.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 AbstractUiWidgetFactoryNative
main window
.protected abstract UiWidgetMainWindow createMainWindow()
UiWidgetMainWindow
for getMainWindow()
.Copyright © 2001–2016 mmm-Team. All rights reserved.