March 26, 2006

Tapestry Edit Component

Howard Lewis-Ship wrote about having an edit component for a pojo.

<span jwcid="@edit:EditObject" object="ognl:pojo"/>

I had already started working on such a component, after getting fed up of creating edit pages by hand. I have posted some (alpha) code at

The component is referenced as Edit<>.

The object to edit is passed using the item parameter.

The layout parameter can be used to pass a literal string selecting a layout. The default layout is "table", which produces a table, where each property is on a new table row. Template layouts can be contributed to a hivemind service. eg. TemplateLayoutTableColumns provides a layout for one row per object views of a collection.

The type of component used to display a property can be specified in the component specification, eg. Edit<,myfield=TextFieldPropertyComponent>. Selecting a component of null suppresses the property from being displayed.

The default type of component selected to display and edit a property can be set by contributing a IComponentProvider to the tapestry.contrib.editor.ComponentProviders configuration point.

Bindings on this component of the form "subcomponent.parameter" are forwarded to the subcomponent.

To display collections, parameters mimicking the For component parameters are used.

A sequence parameter can be used to specify the order in which the properties are displayed.

1 comment:

s_dani_g said...

This code looks extremely comprehensive, but I'm afraid to dive in without at least one example to tell me what it is that I'm getting into!

You should also try to get this into core Tap!