Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Typos and grammar corrections. Further clarification of various points as I learned more about them. Additionally, some useful one liners for finding examples in the code.

...

The result of the lookup is a Java class - org.ofbiz.widget.screen.ScreenWidgetViewHandler in this case - which extends the AbstractViewHandler class, which implements the ViewHandler inteface interface.

The control servlet will now pass on the processing to the specified view handler by calling the render method using the a, b and c as parameters. It's entirely up to the implementation of the view handler to generate the response and write it to the servlet response channel.

...

  • Labels actions
    • property-map: to define labels (in a map) from a xml labels file
    • property-to-field: to define a field value from a properties file
  • Entity actions, this is simple action directly on entities, they are
    • entity-and
    • entity-condition
    • entity-one
    • get-related-one
    • get-related
  • Set actions, mostly 2 "sub-types"
    • set : simple assignation
    • use of Groovy snippet for a bit more involved assignation (filtered, modified, etc.). Advantage: no need to create/open a new file, immediately visible/readable.
      • syntax : <set field="fieldName" value="${groovy: 1+1}"/> (you may need to set a type using the type attribute of the set element)
  • Script
    • script: to call a Groovy script from a file, not short enough to be snippet.  Inside your Groovy script you prepare and set your data in a context variable.
  • Service
    • service: to call a service

...

We can get away with some guesswork about the implementation details of the decorator here, though, to make sure we maintain the bidbird's eye perspective. You can examine the detailed definition of the decorator later. It's just another widget.

...

Code Block
<widgets>
  <platform-specific>
    <html>
      <html-template location="component://party/webapp/partymgr/party/findparty.ftl"/>
    </html>
  </platform-specific>
</widgets>

The plaformplatform-specific widget again is a kind of switch-case-statement. The OFBiz widget toolkit isn't limited to rendering HTML user interfaces. It can could theoretically render the user interface in any different technology you can imaging, like Swing, XUML, Flash, speech, ... In case the UI is being rendered in HTML (which is the case most of the time in OFBiz) all widgets which are children of the html element will be rendered.

In this simple example, there is just one widget as a child element of html, which is html-template. That widget uses Freemarker to fill in actual content into a FreeMaker HTML template. The template is pointed to by the component attribute of the html-element widget. The component protocol means that the location of the template is relative to the application.

Stricly Strictly speaking, this is where we leave the OFBiz widget toolkit and you would have to turn to a FreeMaker tutorial to understand the template being used there. Please refer to the FreeMarker Manual.

You may also use the form widget (using <include-form...) instead of a Freemarker template here.  A form widget is a definition in xml of a list or single form.  The form widget is discussed here.

There are few more include possibitiespossibilities, at all:

What to display: Data Binding in Forms

Depending of on the tool you will use for final rendering, you will use one of the technic techniques below to bind data to your fields:

...

If you include one or more form widgets, the better way to prepare your data is to use the action part of the screen for the sub element to specify actions specific to the screenform. If This helps if you want to reuse your form elsewhere, or have the actions legible when defining your form, you may prefer to use the action part of the form (we will not detail it here). There, you will also find a row-action element to prepare forms of the list type (or multi type, which is variation of the list type). You  You may also call a service using the service element. Anyway, there  There are plenty of examples of form action available OOTB.

Groovy script

...

actions available OOTB, which can be found with the following one line script:

Code Block
languagebash
find -name "*Forms.xml" -printf '\n\n%p\n\n' -exec sed -n -e '/<actions>/,/<\/actions>/p' {} \;

Groovy script form action

If you use Freemarker the better way to prepare your form data is to call one or more Groovy scripts. You call them in the action part of the screen. Inside you prepare and set your data in a context variable. There are several examples of Groovy form actions available OOTB, which can be found with the following one line script:

Code Block
languagebash
find -name "*Forms.xml" -printf '\n\n%p\n\n' -exec xmllint --xpath "//form//actions//script" {} \;
Panel
titletutorial

To continue on screen and form widget, see OFBiz Tutorial - A Beginners Development Guide