All Tohu items (Question, Note, Group etc) can specify presentation styles (using setPresentationStyles
) which are hints to the UI layer. This hints along with a Tohu entities answerType field determine how the browser renders the content for display. For example this could be used to determine:
- whether a yes/no question shows as a checkbox, a drop down list, or yes/no radio buttons
- whether a note shows next to a question, or as a mouseover tip, or in a separate panel at the side/bottom
- whether a group represents a section with a heading, a multi-column layout, or centre-aligning the items within it
The developer is free to define any presentation styles they can think of but Tohu comes with the following pre-defined styles:
radio | Displays a boolean or multiple-choice question as a group of radio buttons |
textarea | Displays a question as a textarea |
file | Displays a question as a file upload |
datepicker | Attaches a datepicker widget to a date question unless it is read-only |
readonly | Makes a question read-only, or all questions within a group read-only |
image | Displays a note as an image by using the label as the source url |
text | Displays the traditional text box |
Note that it is intended that these presentation styles be independent of the particular UI layer. For now the only option is an HTML UI using JQuery but if for example an Eclipse Rich Client UI layer was added then these presentation styles would all have the same names and meanings.
Comments