@Named(value="net.sf.mmm.client.ui.api.widget.UiWidgetFactoryAdvanced") public class UiWidgetFactoryImpl extends AbstractUiWidgetFactory
UiWidgetFactory
.Modifier and Type | Field and Description |
---|---|
private NlsBundleClientUiRoot |
clientUiBundle |
private EnumProvider |
enumProvider |
private Map<Class<? extends UiHandlerAction>,UiSingleWidgetButtonFactory<?>> |
handlerType2ButtonFactoryMap |
CDI_NAME
Constructor and Description |
---|
UiWidgetFactoryImpl()
The constructor.
|
create, createForDatatype, getContext, getMainWindow, getNativeWidget, setContext, setWidgetFactoryDatatype, setWidgetFactoryNative
createLogger, getLogger
doInitialized, getInitializationState, initialize
private EnumProvider enumProvider
getEnumProvider()
private NlsBundleClientUiRoot clientUiBundle
getClientUiBundle()
private Map<Class<? extends UiHandlerAction>,UiSingleWidgetButtonFactory<?>> handlerType2ButtonFactoryMap
protected void registerButtonFactory(UiSingleWidgetButtonFactory<?> factory)
factory
.factory
- is the UiSingleWidgetButtonFactory
to register.protected void registerButtonFactories()
registers
all available
button-factories
.protected void doInitialize()
initialization
. It is called when AbstractComponent.initialize()
is
invoked for the first time. super.
AbstractComponent.doInitialize()
.doInitialize
in class AbstractUiWidgetFactory
protected EnumProvider getEnumProvider()
@Inject public void setEnumProvider(EnumProvider enumProvider)
enumProvider
- is the enumProvider to setprotected NlsBundleClientUiRoot getClientUiBundle()
NlsBundleClientUiRoot
.public UiWidgetButton createButton(String label, UiHandlerEventClick clickHandler)
UiWidgetButton
.label
- is the label
.clickHandler
- is the UiHandlerEventClick
invoked if the button is clicked.UiWidgetFactory.createButton(UiHandlerAction)
public UiWidgetButton createButton(UiHandlerAction handler)
UiWidgetButton
for the given UiHandlerAction
. E.g. passing an
instance of UiHandlerActionSave
will create a save-button
that invokes
UiHandlerActionSave.onSave(net.sf.mmm.client.ui.api.event.UiEvent)
if clicked. handler
implements more than one known
UiHandlerAction
interface. Use UiWidgetFactory.createButton(Class, UiHandlerAction)
to prevent this.handler
- is the UiHandlerAction
instance.public <HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> handlerType, HANDLER handler)
UiWidgetButton
for the given UiHandlerAction
. In advance to
UiWidgetFactory.createButton(UiHandlerAction)
this method can be used for an handler implementation that
realizes multiple UiHandlerAction
interfaces as the proper one to choose is identified by
handlerType
.HANDLER
- is the generic type of the UiHandlerAction
.handlerType
- is the Class
reflecting the UiHandlerAction
interface to create a
button for.handler
- is the UiHandlerAction
instance.public <HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> handlerType, HANDLER handler, boolean preventConfirmationPopup)
UiWidgetButton
for the given UiHandlerAction
. In advance to
UiWidgetFactory.createButton(UiHandlerAction)
this method can be used for an handler implementation that
realizes multiple UiHandlerAction
interfaces as the proper one to choose is identified by
handlerType
.HANDLER
- is the generic type of the UiHandlerAction
.handlerType
- is the Class
reflecting the UiHandlerAction
interface to create a
button for.handler
- is the UiHandlerAction
instance.preventConfirmationPopup
- - some plain handlers
represent operations like
UiHandlerActionDelete.onDelete(net.sf.mmm.client.ui.api.event.UiEvent)
that should be confirmed by the user to prevent accidental invocations. In such case the returned
UiWidgetButton
will by itself open a confirmation popup allowing to cancel to operation.
This will make your life easier. However, if you want to customize the popup with contextual
information (e.g. "Are you sure you want to delete the 23 selected documents?") you can implement
that inside the given handler
and prevent the default popup by providing
true
here. Use false
for the default behavior.public UiWidgetImage createImage(String url, String altText)
UiWidgetImage
.url
- is the URL
.altText
- is the alternative text
.public UiWidgetLabel createLabel(String label)
UiWidgetLabel
.label
- is the label
.public UiWidgetSection createSection(String label)
UiWidgetSection
.label
- is the label
.public UiWidgetTextField createTextField(String label)
UiWidgetTextField
.label
- is the label
.public UiWidgetTextAreaField createTextAreaField(String label)
UiWidgetTextAreaField
.label
- is the label
.public UiWidgetIntegerField createIntegerField(String label)
UiWidgetIntegerField
.label
- is the label
.public UiWidgetLongField createLongField(String label)
UiWidgetLongField
.label
- is the label
.public <VALUE> UiWidgetComboboxField<VALUE> createComboBox(String label, List<VALUE> options)
UiWidgetComboboxField
.VALUE
- is the generic type of the available selection options.label
- is the label
.options
- are the options
of the combobox. E.g.
enum values
via
Arrays.asList
(MyEnum.values())
.public <VALUE> UiWidgetComboboxField<VALUE> createComboBox(String label, EnumDefinition<VALUE,?> enumDefinition)
UiWidgetComboboxField
.VALUE
- is the generic type of the available selection options.label
- is the label
.enumDefinition
- is the EnumDefinition
identifying the available
options
. These may be loaded asynchronous via
EnumProvider
.public <NODE> UiWidgetTree<NODE> createTree(UiWidgetAbstractTree.UiTreeModel<NODE> model, String title)
UiWidgetTree
for the given model
.NODE
- is the generic type of the tree nodes.model
- is the UiWidgetAbstractTree.UiTreeModel
.title
- is the title
of the tree. See also
AttributeReadTitleVisible.isTitleVisible()
.public <ROW> UiWidgetListTable<ROW> createListTable(Class<ROW> rowType)
UiWidgetListTable
for the given rowType
.ROW
- is the generic type of rowType
.rowType
- is the Class
reflecting a row in the value
list
.public UiWidgetSplitPanel createSplitPanel(Orientation orientation, UiWidgetRegular... children)
UiWidgetSplitPanel
.orientation
- - Orientation.HORIZONTAL
for
UiWidgetHorizontalSplitPanel
or
Orientation.VERTICAL
for
UiWidgetVerticalSplitPanel
.children
- are the children
. You need to provide at
least two children.public UiWidgetPopup createPopup(String title)
UiWidgetPopup
.title
- is the title
.public UiWidgetPopup createPopup(String title, boolean closable, boolean resizable, boolean movable)
UiWidgetPopup
.title
- is the title
.closable
- is the value of AttributeReadClosable.isClosable()
.resizable
- is the value of AttributeReadResizable.isResizable()
.movable
- is the value of AttributeReadMovable.isMovable()
.Copyright © 2001–2016 mmm-Team. All rights reserved.