1 2 Previous Next 24 Replies Latest reply on Sep 29, 2009 9:17 AM by Cavaco Silva

    New console snapshot published, Task Forms included

    Heiko Braun Master

      You'd need to update trunk and rebuild with -U in order to avoid compilation errors.
      The new snapshot contains the first cut of the freemarker templating for task forms.

      Currently the form plugin builds on the following constraints:

      * templates need to be suffixed *.ftl and be included with the deployment
      * naming convention for templates: <task name>.ftl
      * html forms need to provide the correct enctype: "multipart/form-data"
      * form field names become process variables names and vice versa
      * a reserved field name for signaling execution upon task completion: "outcome"

      The form render context provides default context information useful for rendering templates: Currently that's ${form} and ${outcome}. These are used to provide runtime information to the form rendering.

      Let's do an example:

      <html>
      <body>
      
      <h2>Your employee would like to go on vacation</h2>
      <form action="${form.action}" method="POST" enctype="multipart/form-data"> (1)
      Number of days: ${number_of_days}<br/> (2)
      <hr>
      In case you reject, please provide a reason:<br/>
      <input type="textarea" name="reason"/><br/> (3)
      <#list outcome.values as transition> (4)
       <input type="submit" name="outcome" value="${transition}"> (5)
      </#list>
      </form>
      </body>
      </html>
      



      Accessing form action dynamically: 'form.action'
      Referencing a process variables named 'number_of_days'
      Create a new process variable named 'reason'
      Access transitions dynamically: 'outcome.values'
      Reserved field name to trigger execution: 'outcome'


      Dynamic render context
      As described above, some properties are provided at runtime, i.e. the actual form action parameter or the available outcomes (aka transitions).
      Some of those are required and cannot be derived at design time (the form action) others are just convenience (the available outcomes). The plugin design is not yet finished, so we can reasily extend or modify the dynamic properties available to the render context.

      Why form 'plugin'? What does it mean?
      It means that the freemarker templating for task forms is just one way of doing it. We provide it out of the box, however users may want to chose a different technology that better suits fits their needs.
      Basically the form plugin (or TaskDispatcherPlugin, how we call it) 'plugs' into the GWT console server. Task forms in the console are referenced by URL, which allows to embed any external form solution into the console. In case you want to change it, you'd need at least provide a plugin that can resolve the task form URL, so that the console can reference it. If you leave out the plugin (can be removed, hence the name) then the form functionality will not be available in the console.

        1 2 Previous Next