5.16.3 Implementation info
A part editor is implemented by means of a CForm (Cocoon Form). This consists of a form definition and a form template. A part editor is considered to be a part of a larger form, and generates the form definition fragments and form template fragments needed to edit the part.
- In previous versions (<2.3) of Daisy you were required to add a dummy action widget, this is no longer necessary.
- The form template should not contain a ft:form-template element, as it will be embedded inside the document editors' template. The contents of your form template will be included in a ft:group element.
Besides the form definition and template, you need to implement the interface org.outerj.daisy.frontend.PartEditor (and corresponding PartEditorFactory). This interface defines methods that will be called for constructing, loading and saving of the form.
To learn more, it is best to explore the sources of the default Daisy part editors.
22.214.171.124 Form definition
The form definition shouldn't be too much. Actually this is usually enough. This little blurb of xml will be injected into a fd:group node with id 'part_<partTypeId>' (although your code should ideally not depend on this).
<?xml version="1.0"?> <fd:field id="part" xmlns:fd="http://apache.org/cocoon/forms/1.0#definition"> <fd:datatype base="string"/> </fd:field>
126.96.36.199 Form template
This is a little example of a part editor template.
<div xmlns:ft="http://apache.org/cocoon/forms/1.0#template"> <tr> <td> <!-- Part type label --> My Part </td> <td> <ft:widget id="part"/> </td> </tr> </div>