t5gui templates

  • thin client, all browsers, no need for ActiveX objects of client side java, only javascript
  • easy/efficient keyboard navigation
  • powerful automatic cross linking of records
  • fields can be distributed over (tab) pages with some fields be visible on all tabs
  • fields can be grouped
  • setting links using suggest values (*)
  • possible printout (pdf doc) of the result of selectors, with user configurable fields (screen and pdf), and column width (pdf) (*)
  • inclusion of reporting in the user interface (*)
  • generated components can be used to build custom pages
  • highly customizeably, layout components define how things are combined on screen
  • possible to change the components used for a specific type or field or on a case by case basis

(*) ^Items marked like this were available in the old tapestry4 version and will be available again for the tapestry5 version.^

Usage

To make sure the generated site works properly, you need to include the following dependencies.


<dependency>
<groupId>org.equanda</groupId>
<artifactId>equanda-tapestry5</artifactId>
<version>${tapestry-version}</version>
</dependency>
<dependency>
<groupId>org.equanda</groupId>
<artifactId>equanda-t5gui</artifactId>
<version>${tapestry-version}</version>
</dependency>
<dependency>
<groupId>org.apache.tapestry</groupId>
<artifactId>t5c-commons</artifactId>
<version>0.5.10</version>
</dependency>

and following repositories


<repositories>
<repository>
<id>progs</id>
<url>http://maven.progs.be/m2repo</url>
</repository>
<repository>
<id>t5components</id>
<name>T5Components Maven Repository</name>
<url>http://213.160.23.119:8080/t5components/maven-repository</url>
</repository>
</repositories>

Generated components

For each (root) table the following components are generated.

  • Edit : allows editing of an entire record, considering the configured authorization for the user.
  • Display : similar in layout as the edit components, except that all fields which are allowed to be viewed are displayed read only.
  • InlineLinkList : allows inline editing of the multiple records.
  • InlineLinkOne : allows inline editing of the one record.
  • LinkList : ...
  • LinkOne : ...
  • Select : allows to select one or more records to be assigned to edited record.
  • Summary : Short summary of a record. Displays the fields which have been configured for summary display.
  • SummaryEditLink : A summary on which you can click to edit the record.

Also one universal component are generated.

  • InlinePrimitiveList : allows inline editing of the multiple string, date and timestamp fields.

Generated pages

For each (root) table the following pages are generated.

  • Edit : allows editing of a record, considering the configured authorization for the user.

For each action on each table.

  • Action : pass the parameters to the action.
  • ActionRes : display the action result.

For each select defined on a table.

  • Select : allow applying the select, you can enter the parameters and see the results.

renderer support

In the domain model, it is possible to overwrite the rendering of specific fields or groups using the "renderer" parameter on the definition.
TODO : documentation to be completed

configuring how forms are generated

The generation of forms is multi-layered to allow configuration of how specific elements will be generated. This makes the user interface highly customizeable, it assures consistency and assures the user interface can be updated based on the domain model.
At field or group level, the rendering can be overwritten using the "renderer" parameter in the domain model. However, some generic changes can also be handled as generation parameters.

In the configuration file "dm.ini" you can define which files should be read to get the properties.


[t5gui]
keyvalue1=t5gui/templates.properties
keyvalue2=t5gui/mytemplates/templates.properties

The first file included above is always included and contains the default mappings. You can include as many keyvalueX keys as needed, but there should be no gaps in the numbering.
The references properties files are searched on the classpath. As an example the default (t5gui/templates.properties) is included below.
When several mappings exist for the same key, the last one is applied.
Note that any templates mentioned in the properties file should be in a path starting with "t5gui", and this should not be included in the file name (this is to allow several template sets to coexist easily).


pages=edit-tml/pages.tml.vm
page=edit-tml/page.tml.vm
group=edit-tml/group.tml.vm
field=edit-tml/field.tml.vm
fieldData=edit-tml/fieldData.tml.vm

edit.type.string=edit-tml/string.tml.vm
edit.type.clob=edit-tml/text.tml.vm
edit.type.double=edit-tml/double.tml.vm
edit.type.int=edit-tml/int.tml.vm
edit.type.date=edit-tml/date.tml.vm
edit.type.timestamp=edit-tml/timestamp.tml.vm
edit.type.boolean=edit-tml/boolean.tml.vm
edit.type.link.one=edit-tml/linkone.tml.vm
edit.type.link.list=edit-tml/linklist.tml.vm
edit.type.choice=edit-tml/choice.tml.vm

edit.field.EquandaUser.Password=edit-tml/password.tml.vm
edit.field.EquandaType=edit-tml/type.tml.vm

edit.renderer.text=edit-tml/text.tml.vm
edit.renderer.wiki=edit-tml/text.tml.vm

view.type.string=view-tml/string.tml.vm
view.type.clob=view-tml/text.tml.vm
view.type.double=view-tml/tostring.tml.vm
view.type.int=view-tml/tostring.tml.vm
view.type.date=view-tml/date.tml.vm
view.type.timestamp=view-tml/timestamp.tml.vm
view.type.boolean=view-tml/tostring.tml.vm
view.type.link.one=view-tml/linkone.tml.vm
view.type.link.list=view-tml/linklist.tml.vm
view.type.choice=view-tml/choice.tml.vm

view.field.EquandaUser.Password=view-tml/password.tml.vm
view.field.EquandaType=view-tml/type.tml.vm

view.renderer.text=view-tml/text.tml.vm
view.renderer.wiki=view-tml/text.tml.vm

list.type.string=list-tml/string.tml.vm
list.type.clob=list-tml/string.tml.vm
list.type.double=list-tml/tostring.tml.vm
list.type.int=list-tml/tostring.tml.vm
list.type.date=list-tml/date.tml.vm
list.type.timestamp=list-tml/timestamp.tml.vm
list.type.boolean=list-tml/boolean.tml.vm
list.type.link.one=list-tml/linkone.tml.vm
list.type.link.list=list-tml/linklist.tml.vm
list.type.choice=list-tml/choice.tml.vm

list.field.EquandaUser.Password=list-tml/password.tml.vm
list.field.EquandaType=list-tml/type.tml.vm

list.renderer.text=list-tml/string.tml.vm
list.renderer.wiki=list-tml/string.tml.vm

summary.type.string=list-tml/string.tml.vm
summary.type.clob=list-tml/text.tml.vm
summary.type.double=list-tml/tostring.tml.vm
summary.type.int=list-tml/tostring.tml.vm
summary.type.date=list-tml/date.tml.vm
summary.type.timestamp=list-tml/timestamp.tml.vm
summary.type.boolean=list-tml/tostring.tml.vm
summary.type.link.one=summary-tml/linkone.tml.vm
summary.type.link.list=summary-tml/linklist.tml.vm
summary.type.choice=list-tml/choice.tml.vm

summary.field.EquandaUser.Password=list-tml/password.tml.vm
summary.field.EquandaType=list-tml/type.tml.vm

summary.renderer.text=list-tml/string.tml.vm
summary.renderer.wiki=list-tml/string.tml.vm

You can define the templates (and thus tapestry objects) which are used for the display based on the structure.

  • pages : defines how the sequence of pages are handled, implemented using the Tabs component which creates tab pages. There is some special handling for the "ALL" and "metadata" pages.
  • page : handle the contents of one page, rendering the fields (which are not part of a group) and groups.
  • group : handling of a group, put the contents in a fieldset.
  • field : default rendering of individual fields.

The default field handling uses the keyvalue settings again to read the velocity templates used to build the .tml tapestry template.
Below are the possible configurations which are used, in order. Of course only the types which are possible according to the field type apply.
The names are aways prefixed by an indication of the usage. This can be either "edit." "view." or "list.".
When a renderer is specified, the name is prefixed by "edit.renderer." "view.renderer." or "list.renderer." to find the templates to be used.

  • type.TableName.FieldName : specific templates for a field in a table.
  • type.FieldName : specific tamplates for fields of that name in all tables.
  • type.link.TableName.one, type.link.TableName.list : templates to use for instances links to the table of the name as included in the key.
  • type.link.one, type.link.list : generic handling for link fields.
  • type.string, type.boolean, type.date, type.timestamp, type.int, type.double, type.blob, type.clob : templates for generic handling of fields of a certain type.
  • group.TableName.FieldName : specific templates for handling an entire group of fields. This can for example be used for dynamic selection of fields which needs to be visible.

Important
When customizing the templates which are used, you have to do a clean build ("mvn clean install") in your project to assure the modified templates are applied. As the templates are read from the classpath, the system is unable to know the timestamp for the templates and thus does not know when to overwrite the generated files if the domain model has not changed.

When you used the archetype to create your empty project, the t5compo module is intended to write your custom components and templates which are used during generation. It also contains a templates.properties file for you to extend.

Useful standard templates

For generating links, the default rendering is to have a compact display of the record, and all operations are done on different pages. There is also an option to have links being displayed inline. For this add lines like the following in your templates.properties file :


type.link.Address.list=edit-tml/inlinelinklist.tml.vm
type.link.Score.list=edit-tml/inlinelinklist.tml.vm

In this example, all links to the Address or Score table whill be rendered inline.