See Tohu - FAQ for instructions on how to build and run the examples.
simple-example
Shows the basics of using Tohu to generate a dynamic UI from rules.
Covers: Questionnaire.items, Questionnaire.completionAction, Question, MultipleChoiceQuestion, Note (dynamic), truth-maintenance, getting answers out
pages-example
Shows how to do multiple pages.
Covers: Questionnaire.activeItem
doesn't exist yet - see loyalty-medium-example instead
presentation-example
Shows the various presentation styles built-in.
Covers: Item.presentationStyles, readonly
doesn't exist yet - search other .drl files for setPresentationStyles
See also: Tohu - Presentation styles
branching-example
Shows how to do branches in a page-flow.
Covers: Questionnaire.navigationBranch, custom javscript to present a boolean question as Yes/No buttons.
domain-example
Shows how to integrate with a Java domain model.
Covers: DomainModelAssociation, creating a session, getting Java object data in/out, reuse of business rules between Tohu and backend systems
xml-example
Shows a simple way to get data in and out via XML.
Covers: creating a session, getting XML data in/out
persistence-example
Shows how to persist the answers captured using the Tohu questionnaire model rather than a Java domain model.
Covers: QueryHelper.getPersistentObjects, when you should use insert instead of insertLogical
doesn't exist yet - for now see the Javadoc for QueryHelper.getPersistentObjects
departure-example
An example of an airport departure card.
Covers: data validation, using Group for layout, displaying dynamic images
Note: this example was actually written as a test of how productive this technology is. The author wrote the rules in 1 hour and then a UI developer (who doesn't know the underlying technology) spent another 1 hour making it look nice using CSS. The example (and the original paper version from which it was modelled) includes 5 separate branching points.
genealogy-example
A simple family tree example.
Covers: multiple copies of the same question with different ids, custom javascript to present a boolean question as an icon.
loyalty-card-examples
3 examples of increasing complexity which build up a ficticious Solnet Loyalty Card.
- simple - single page with some dynamic behaviour
- medium - multiple pages and more dynamic behaviour, multiple skins/brands using different CSS on the same rules, custom javascript to present a note as a progress bar
- complex - joint account (reuse of question rules), other loyalty programs (page branching), custom answerType to aid validation, readonly questions
- complete - it would be nice to extend this into a compete end-to-end working application by adding persistence so you can enter your name and it opens your record allowing you to edit the fields (but perhaps with some readonly).
SpreadsheetBiology and SpreadsheetLoyaltyGold
These two examples demonstrate how to use tohu-loader to generate drl files from an Excel spreadsheet.
The readme.txt file explains how to enable auto-reloading of the rules if the spreadsheet is edited.
liferay-example
This example shows how to use Tohu within a JSR-286 portlet that runs on Liferay.
Comments