@ComponentSpecification public interface UiWidgetFactory extends AbstractUiWidgetFactoryNative, AbstractUiWidgetFactoryDatatype
UiContext
that gives access to this UiWidgetFactory
via
UiContext.getWidgetFactory()
. net.sf.mmm.client.ui.base.widget.custom.UiWidgetCustom
for details. UiWidgetFactoryNative
allows to create any
UiWidget
via a generic and stable API this interface defines a higher-level factory that offers
more comfort. So UiWidgetFactoryNative
is the low-level
factory to abstract from the underlying implementation this factory is the higher-level
API
for end-users and is implemented independent from the UI
toolkit. However, it is a more comfortable to do:UiWidgetButton
saveButton = factory.create
(UiWidgetButton
.class); saveButton.setLabel
("save"); saveButton.addClickHandler
(clickHandler);
But you maybe also want to have a icon and a tooltip andUiWidgetButton
saveButton = factory.createButton
("save", clickHandler);
NLS/I18N
. And you discover that you do not only need this code once in your application but all over the
place. Then you will be happy to see that you get all the comfort this way:
Now this is just the beginning of this awesome UI framework. You will discover that there are even much higher level features such as e.g. the editor pattern. So seeUiHandlerActionSave
saveHandler = ...;UiWidgetButton
saveButton = factory.createButton
(saveHandler);
net.sf.mmm.client.ui.base.widget.custom.pattern.UiWidgetCustomEditor
for more.
ATTENTION:extendable interface
.create, getMainWindow, getNativeWidget
createForDatatype
static final String CDI_NAME
CDI name
.UiWidgetButton createButton(String label, UiHandlerEventClick clickHandler)
UiWidgetButton
.label
- is the label
.clickHandler
- is the UiHandlerEventClick
invoked if the button is clicked.createButton(UiHandlerAction)
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 createButton(Class, UiHandlerAction)
to prevent this.handler
- is the UiHandlerAction
instance.<HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> handlerType, HANDLER handler)
UiWidgetButton
for the given UiHandlerAction
. In advance to
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.<HANDLER extends UiHandlerAction> UiWidgetButton createButton(Class<HANDLER> handlerType, HANDLER handler, boolean preventConfirmationPopup)
UiWidgetButton
for the given UiHandlerAction
. In advance to
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.UiWidgetLabel createLabel(String label)
UiWidgetLabel
.label
- is the label
.UiWidgetSection createSection(String label)
UiWidgetSection
.label
- is the label
.UiWidgetImage createImage(String url, String altText)
UiWidgetImage
.url
- is the URL
.altText
- is the alternative text
.UiWidgetTextField createTextField(String label)
UiWidgetTextField
.label
- is the label
.UiWidgetTextAreaField createTextAreaField(String label)
UiWidgetTextAreaField
.label
- is the label
.UiWidgetIntegerField createIntegerField(String label)
UiWidgetIntegerField
.label
- is the label
.UiWidgetLongField createLongField(String label)
UiWidgetLongField
.label
- is the label
.<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())
.<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
.<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()
.<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
.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.UiWidgetPopup createPopup(String title)
UiWidgetPopup
.title
- is the title
.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.