My Diversions

October 3, 2007

CAL and Tapestry 5, Part 2: Algebraic Types and Forms

Filed under: CAL and Open Quark, Computer Science, Java, Tapestry — Tom Davies @ 5:29 am

In my previous post I described how to use a CAL function as part of the implementation of a Java class.

This post looks at interfacing CAL to Tapestry 5 using the ‘Java Bean’ conventions of getter and setter methods for the fields in an object.

Tapestry 5 provides a BeanEditForm component which simplifies providing CRUD operations for Beans. This is described in the second part of the Tapestry 5 tutorial.

By creating a Java class which provides a Bean with fields equivalent to the constructor parameters of a CAL algebraic data type we can use CAL to provide the data model for a web UI created with Tapestry. (more…)

September 24, 2007

CAL and the Tapestry 5 Tutorial

Filed under: CAL and Open Quark, Computer Science, Tapestry — Tom Davies @ 10:13 pm

The technique described in my previous post can be used to create Tapestry 5 pages which call CAL functions. Tapestry also uses Javassist to enhance pages, so adding CAL integration requires that Tapestry is reconfigured to apply the CAL transformations in addition to its own — I wasn’t able to find a way to transparently modify the classes before Tapestry sees them.

I’ve modified the Hi/Lo Guessing Game from the Tapestry Tutorial to use CAL implementations for some functions:

(more…)

Powered by WordPress