Daisy documentation
 PreviousHomeNext 
5.16.2 ConfigurationBook Index5.17 Field editors

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.

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.

5.16.3.1 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>

5.16.3.2 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>
 PreviousHomeNext 
5.16.2 Configuration5.17 Field editors