5.2 Web Widget Builders

5.2.1 JSP Widget Builders

5.2.1.1 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 types of fields:

Widget Type of field
org.displaytag.tags
TableTag Collections and arrays (except if hidden, or if have a lookup). The columns in the table are based on inspecting the component type of the array or the parameterized type of the Collection (if neither can be determined, the table will only have a single column)

5.2.1.2 HtmlWidgetBuilder

HtmlWidgetBuilder is the default WidgetBuilder for the JSP HtmlMetawidgetTag. Since JSP has only a light component model (ie. 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 types of fields:

Widget Type of field
<input type="checkbox"> Primitive booleans and required Booleans
<input type="hidden"> Hidden fields when HtmlMetawidgetTag.setCreateHiddenFields is set to true
<input type="password"> Masked fields (except when read-only)
<input type="submit"> Actions (except read-only actions)
<input type="text"> Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, adds maxlength="..."
<select> Fields with lookups
raw text Read-only fields (except Collections and masked fields). If HtmlMetawidgetTag.setCreateHiddenFields is set to true, further adds a <input type="hidden"> so that something gets POSTed back
<textarea> Large String fields
org.metawidget.jsp.tagext
StubTag Hidden fields, read-only actions, read-only masked fields and Collections

5.2.1.3 SpringWidgetBuilder

SpringWidgetBuilder is the default WidgetBuilder for SpringMetawidgetTag, albeit used in conjunction with the JSP HtmlWidgetBuilder. Like HtmlWidgetBuilder, it simply returns fragments of HTML. The JSP component model is too light to support returning tags containing child tags (ie. a SelectTag containing OptionTags). SpringWidgetBuilder returns the following widgets for the following types of fields:

Widget Type of field
org.springframework.web.servlet.tags.form
CheckboxTag Primitive booleans and required Booleans
HiddenInputTag Hidden fields when HtmlMetawidgetTag.setCreateHiddenFields is set to true
InputTag Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, calls setMaxlength
PasswordInputTag Masked fields (except when read-only)
raw text Read-only fields (except Collections and masked fields). If HtmlMetawidgetTag.setCreateHiddenFields is set to true, further adds a HiddenInputTag so that something gets POSTed back
SelectTag Fields with lookups
TextareaTag Large String fields
org.metawidget.jsp.tagext
StubTag Actions

5.2.1.4 StrutsWidgetBuilder

StrutsWidgetBuilder is the default WidgetBuilder for StrutsMetawidgetTag, albeit used in conjunction with the JSP HtmlWidgetBuilder. Like HtmlWidgetBuilder, it simply returns fragments of HTML. The JSP component model is too light to support returning tags containing child tags (ie. a SelectTag containing OptionTags). StrutsWidgetBuilder returns the following widgets for the following types of fields:

Widget Type of field
org.apache.struts.taglib.html
CheckboxTag Primitive booleans and required Booleans
SelectTag Fields with lookups
HiddenTag Hidden fields when HtmlMetawidgetTag.setCreateHiddenFields is set to true
PasswordTag Masked fields (except when read-only)
raw text Read-only fields (except Collections and masked fields).If HtmlMetawidgetTag.setCreateHiddenFields is set to true, further adds a HiddenTag so that something gets POSTed back
TextTag Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, calls setMaxlength
TextareaTag Large String fields
org.metawidget.jsp.tagext
StubTag Actions

5.2.2 GWT Widget Builders

5.2.2.1 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 types of fields:

Widget Type of field
com.extjs.gxt.ui.client.widget.form
DateField Dates

To build applications that use ExtGwtWidgetBuilder, include metawidget.jar and examples\gwt\metawidget-gwt-client.jar and examples\gwt\metawidget-gwt-extgwt-client.jar in the CLASSPATH during the GWTCompiler phase.

5.2.2.2 GwtWidgetBuilder

GwtWidgetBuilder is the default WidgetBuilder for GwtMetawidget. It instantiates the following widgets for the following types of fields:

Widget Type of field
com.google.gwt.user.client.ui
Button Actions (except read-only actions)
CheckBox Primitive booleans and required Booleans
Label Read-only fields (except Collections and masked fields)
ListBox Fields with lookups
PasswordTextBox Masked fields (except when read-only)
SimplePanel Read-only masked fields
TextArea Large String fields
TextBox Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, calls setMaxLength
org.metawidget.gwt.client.ui
Stub Hidden fields, read-only actions and Collections

5.2.3 JSF Widget Builders

5.2.3.1 HtmlWidgetBuilder

HtmlWidgetBuilder is the default WidgetBuilder for the JSF HtmlMetawidget. It instantiates the following widgets for the following types of fields:

Widget Type of field
javax.faces.component.html
HtmlCommandButton Actions (except read-only actions)
HtmlDataTable Lists, DataModels and arrays (except if hidden, or if have a lookup). The columns in the table are based on inspecting the component type of the array or the parameterized type of the List (if neither can be determined, the table will only have a single column)
HtmlInputHidden Hidden fields when HtmlMetawidget.setCreateHiddenFields is set to true
HtmlInputSecret Masked fields (except when read-only)
HtmlInputText Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, calls setMaxlength
HtmlInputTextarea Large String fields
HtmlOutputText Read-only fields (except Collections and masked fields)
HtmlSelectBooleanCheckbox Primitive booleans and required Booleans
HtmlSelectManyCheckbox Lists or Arrays with a lookup
HtmlSelectOneListbox Fields with lookups
org.metawidget.faces.component
HtmlLookupOutputText Read-only fields with lookup labels
UIStub Hidden fields, read-only actions, read-only masked fields and Collections

5.2.3.2 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.3.5, “ICEfaces Example”. IceFacesWidgetBuilder instantiates the following widgets for the following types of fields:

Widget Type of field
com.icesoft.faces.component.ext
HtmlCommandButton Actions (except read-only actions)
HtmlInputSecret Masked fields (except when read-only)
HtmlInputText Primitives (except booleans), Characters, Dates, Strings, and fields of unknown type. If the field has a maximum length, calls setMaxlength
HtmlInputTextarea Large String fields
HtmlSelectBooleanCheckbox Primitive booleans and required Booleans
HtmlSelectManyCheckbox Lists or Arrays with a lookup
HtmlSelectOneListbox Fields with lookups
com.icesoft.faces.component
SelectInputDate Dates

Note: the ICEfaces SelectInputDate widget uses internal state to control its popup. Therefore Metawidget will not destroy and recreate it upon POSTback, as it does with most other widgets (in order to update them to reflect changes in business model state).

All components are instantiated with partialSubmit set to true.

5.2.3.3 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 Section 1.2.2.3, “Alternate Widget Libraries”. RichFacesWidgetBuilder instantiates the following widgets for the following types of fields:

Widget Type of field
org.richfaces.component.html
HtmlCalendar Dates
HtmlColorPicker java.awt.Color
HtmlInputNumberSlider Primitives (except boolean and char) that have a maximum and minimum value
HtmlInputNumberSpinner Primitives (except boolean and char) and Numbers that have only one or neither minimum/maximum value
HtmlSuggestionBox Fields with faces-suggest lookups

5.2.3.4 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 types of fields:

Widget Type of field
org.apache.myfaces.custom
HtmlInputFileUpload org.apache.myfaces.custom.fileupload.UploadedFile