6.2 Web WidgetBuilders

Metawidget supports multiple WidgetBuilders for each Web framework, targeting specific widget libraries within each environment.

6.2.1 GWT WidgetBuilders

ExtGwtWidgetBuilder

ExtGwtWidgetBuilder is a pluggable WidgetBuilder for the ExtGWT library. It is intended to be used in conjunction with the default GwtWidgetBuilder. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.extjs.gxt.ui.client.widget.form
DateField type="java.util.Date"
Slider type is a primitive (except boolean and char) and has both minimum-value and maximum-value

GwtWidgetBuilder

GwtWidgetBuilder is the default WidgetBuilder for GwtMetawidget. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.google.gwt.user.client.ui
Button action (except when also read-only)
CheckBox type="boolean" (and type="java.lang.Boolean" when also required)
ListBox lookup
PasswordTextBox masked (except when also read-only)
TextArea type="java.lang.String" and large
TextBox type of java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
org.metawidget.gwt.client.ui
Stub hidden

OverriddenWidgetBuilder

OverriddenWidgetBuilder locates child widgets designed to override default generation. It matches widgets that implement HasName and whose getName equals the same name Metawidget would have generated.

ReadOnlyWidgetBuilder

ReadOnlyWidgetBuilder returns read-only widgets when either the business property is read-only or the Metawidget has setReadOnly. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.google.gwt.user.client.ui
Label read-only (except when also type="java.util.Collection" or masked)
SimplePanel read-only and masked
org.metawidget.gwt.client.ui
Stub action when also read-only, type="java.util.Collection" when also read-only

6.2.2 JavaScript WidgetBuilders

HtmlWidgetBuilder

HtmlWidgetBuilder is the default WidgetBuilder for metawidget.js. It returns the following DOM nodes for the following Metawidget attributes:

.
DOM Node Metawidget Attribute
<input type="button"> type: "function"
<input type="submit"> type: "function" and submit: true
<input type="checkbox"> type: "boolean"
<input type="date"> type: "date"
<input type="number"> type: "number" or type: "integer"
<input type="password"> masked (except when also read-only)
<input type="range"> type: "number" and both minimum and maximum are set
<input type="text"> type: "string". Also if property is of unknown type but dontExpand. If maxLength, adds maxlength="..."
<select> enum
<stub> hidden
<table> type: "array". Child properties will be inspected to determine table columns. Also supports columnWidth metadata
<textarea> type: "string" and large

OverriddenWidgetBuilder

OverriddenWidgetBuilder locates child widgets designed to override default generation. It matches based on the id of the DOM node. It does not match on name, because name is not a legal attribute for many nodes (e.g. table).

ReadOnlyWidgetBuilder

ReadOnlyWidgetBuilder returns read-only widgets when either the business property is read-only or the Metawidget has setReadOnly. It instantiates the following DOM nodes for the following Metawidget attributes:

DOM Node Metawidget Attribute
output read-only and enum, type: "string", type: "boolean", type: "number" or type: "date". Also masked (but the populated data will be filled with '*' characters).
stub read-only and hidden or type: "function". Also if property is of unknown type but dontExpand.

6.2.3 JSP WidgetBuilders

DisplayTagWidgetBuilder

DisplayTagWidgetBuilder is a pluggable WidgetBuilder for the DisplayTag library. It is intended to be used in conjunction with the JSP HtmlWidgetBuilder, SpringWidgetBuilder or StrutsWidgetBuilder. It instantiates the following widgets for the following Metawidget attributes:

Widget Type of field
org.displaytag.tags
TableTag type="java.util.Collection" or an array, except when also hidden or lookup. The columns in the table are based on inspecting parameterized-type or the component type of the array. If neither can be determined, the table will only have a single column

HtmlWidgetBuilder

HtmlWidgetBuilder is the default WidgetBuilder for the JSP HtmlMetawidgetTag. Since JSP has only a light component model (i.e. HTML tags such as <input> and <select> are just strings, not modelled as JSP tags), HtmlWidgetBuilder uses org.metawidget.jsp.tagext.LiteralTag to wrap string-based fragments. It returns the following literals for the following Metawidget attributes:

Widget Metawidget Attribute
<input type="checkbox"> type="boolean" (and type="java.lang.Boolean" when also required)
<input type="password"> masked (except when also read-only)
<input type="submit"> action (except when also read-only)
<input type="text"> type is a java.lang.String, java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If specified, adds maximum-length, minimum-value, maximum-value and required
<select> lookup
<textarea> type="java.lang.String" and large
org.metawidget.jsp.tagext
StubTag hidden

OverriddenWidgetBuilder

OverriddenWidgetBuilder locates child widgets designed to override default generation. It matches StubTags whose value (path for Spring environments; property for Struts environments) equals the same value Metawidget would have generated.

ReadOnlyWidgetBuilder

ReadOnlyWidgetBuilder returns read-only widgets when either the business property is read-only or the Metawidget has setReadOnly. The base class manages 'pure' JSP, with subclasses for both Spring and Struts environments. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.metawidget.jsp.tagext
(raw text) read-only (except when also type="java.util.Collection" or masked)
LiteralTag read-only and masked
StubTag action when also read-only, type="java.util.Collection" when also read-only

SpringWidgetBuilder

SpringWidgetBuilder is the default WidgetBuilder for SpringMetawidgetTag. It returns the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.springframework.web.servlet.tags.form
CheckboxTag type="boolean" (and type="java.lang.Boolean" when also required)
InputTag type is a java.lang.String, java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
PasswordInputTag masked (except when also read-only)
SelectTag lookup
TextareaTag type="java.lang.String" and large
org.metawidget.jsp.tagext
StubTag action when not read-only

StrutsWidgetBuilder

StrutsWidgetBuilder is the default WidgetBuilder for StrutsMetawidgetTag. It returns the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.apache.struts.taglib.html
CheckboxTag type="boolean" (and type="java.lang.Boolean" when also required)
SelectTag lookup
PasswordTag masked (except when also read-only)
TextTag type of java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
TextareaTag type="java.lang.String" and large
org.metawidget.jsp.tagext
StubTag action when not read-only

6.2.4 JSF WidgetBuilders

HtmlWidgetBuilder

HtmlWidgetBuilder is the default WidgetBuilder for the JSF HtmlMetawidget. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
javax.faces.component.html
HtmlCommandButton action (except when also read-only)
HtmlDataTable type of List, DataModel or array, except when also hidden or lookup. The columns in the table are based on inspecting parameterized-type or the component type of the array (if neither can be determined, the table will only have a single column). An additional dataTableRowAction facet can be used to add an 'action' column (for viewing or editing) - see Section 1.4.5, “ICEfaces Example”
HtmlInputSecret masked (except when also read-only)
HtmlInputText type of java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
HtmlInputTextarea type="java.lang.String" and large
HtmlSelectBooleanCheckbox type="boolean" (and type="java.lang.Boolean" when also required)
HtmlSelectManyCheckbox type of List or array, with lookup
HtmlSelectOneMenu lookup
org.metawidget.faces.component
UIStub hidden

IceFacesWidgetBuilder

IceFacesWidgetBuilder is a pluggable WidgetBuilder for the JSF UIMetawidget. It is intended to be used in conjunction with the default JSF HtmlWidgetBuilder. For an example, see Section 1.4.5, “ICEfaces Example”. IceFacesWidgetBuilder instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.icesoft.faces.component.ext
HtmlCommandButton action (except when also read-only)
HtmlInputSecret masked (except when also read-only)
HtmlInputText type of java.util.Date, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
HtmlInputTextarea type="java.lang.String" and large
HtmlSelectBooleanCheckbox type="boolean" (and type="java.lang.Boolean" when also required)
HtmlSelectManyCheckbox type="boolean" (and type="java.lang.Boolean" when also required)
HtmlSelectOneMenu lookup
com.icesoft.faces.component
SelectInputDate type="java.util.Date"

Important: see the section called “Special considerations for Java Server Faces”

By default, all components are instantiated with partialSubmit set to true. This can be configured through IceFacesWidgetBuilderConfig.

OverriddenWidgetBuilder

OverriddenWidgetBuilder locates child widgets designed to override default generation. It matches UIComponents whose value binding or action binding equals the same binding Metawidget would have generated.

ReadOnlyWidgetBuilder

ReadOnlyWidgetBuilder returns read-only widgets when either the business property is read-only or the Metawidget has setReadOnly. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
javax.faces.component.html
HtmlOutputText read-only (except when also type="java.util.Collection" or masked)
org.metawidget.faces.component
HtmlLookupOutputText read-only with lookup-label
UIStub action when also read-only, masked when also read-only, type="java.util.Collection" when also read-only

PrimeFacesWidgetBuilder

PrimeFacesWidgetBuilder is a pluggable WidgetBuilder for the JSF UIMetawidget. It is intended to be used in conjunction with the default JSF HtmlWidgetBuilder. PrimeFacesWidgetBuilder instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.primefaces.component
AutoComplete faces-suggest
Calendar type="java.util.Date"
ColorPicker type="java.awt.Color"
Stub containing an InputText and a Slider type is a primitive (except boolean and char) and has both minimum-value and maximum-value
Spinner type is a primitive (except boolean and char) or a Number and has only one, or neither minimum-value and maximum-value

RichFacesWidgetBuilder

RichFacesWidgetBuilder is a pluggable WidgetBuilder for the JSF UIMetawidget. It is intended to be used in conjunction with the default JSF HtmlWidgetBuilder. For an example, see the section called “Alternate Widget Libraries (JSF 1.x)”. RichFacesWidgetBuilder instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.richfaces.component.html
HtmlCalendar type="java.util.Date"
HtmlColorPicker type="java.awt.Color"
HtmlInputNumberSlider type is a primitive (except boolean and char) and has both minimum-value and maximum-value
HtmlInputNumberSpinner type is a primitive (except boolean and char) or a Number and has only one, or neither minimum-value and maximum-value
HtmlSuggestionBox faces-suggest

TomahawkWidgetBuilder

TomahawkWidgetBuilder is a pluggable WidgetBuilder for the JSF UIMetawidget. It is intended to be used in conjunction with the default JSF HtmlWidgetBuilder. TomahawkWidgetBuilder instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
org.apache.myfaces.custom
HtmlInputFileUpload type="org.apache.myfaces.custom.fileupload.UploadedFile"

6.2.5 Vaadin WidgetBuilders

OverriddenWidgetBuilder

OverriddenWidgetBuilder locates child widgets designed to override default generation. It matches Components whose getData equals the name of the business property.

ReadOnlyWidgetBuilder

ReadOnlyWidgetBuilder returns read-only widgets when either the business property is read-only or the Metawidget has setReadOnly. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.vaadin.ui
Button (disabled) read-only and action
Label read-only (except when action, masked or large)
Panel read-only and masked
TextArea (disabled) read-only and large
org.metawidget.vaadin.ui.widgetbuilder
LookupLabel read-only with lookup-label

VaadinWidgetBuilder

VaadinWidgetBuilder is the default WidgetBuilder for VaadinMetawidget. It instantiates the following widgets for the following Metawidget attributes:

Widget Metawidget Attribute
com.vaadin.ui
Button action (except when also read-only)
CheckBox type="boolean" (and type="java.lang.Boolean" when also required)
ComboBox lookup
PasswordField masked (except when also read-only)
PopupDateField type of java.util.Date
Slider type is a primitive (except boolean and char) and has both minimum-value and maximum-value
TextArea type="java.lang.String" and large
TextField type of java.lang.String, primitive wrapper (e.g. Integer or Float) except java.lang.Boolean. Also if property is of unknown type but dont-expand. If maximum-length, calls setMaxlength
org.metawidget.vaadin.ui
Stub hidden