|
|
Screenshots •
Videos •
Demos •
Documentation •
Tutorials •
Articles •
Knowledge Base •
Zone Templates in Survey Applications The layout of survey application pages can be configured via an included templates. This is makes it possible to define custom layout for each question or for subcomponents. Question Page templates Question Page templates define a layout for questions that appear on a single page. A simple example of such template is shown below.
The question_page attribute of the <XPage> element specifies the next question page that should be shown (in most cases this will be same page as the current one). The finish_page is a page that will be shown when the survey is over. The com.xoetrope.swing.survey.XQuestionPage class, associated with the page, serves as a main "entry point" to the survey API. Question Component templates Each Question Component template contains an xml defining how the questions of certain type should appear on the page. The Listing 2 shows a sample template for the mutually exclusive type of question.
The template "iterates" over the options of the current question taking an advantage of the API provided by the XQuestionPage class. Each iteration includes a subcomponent template which, in this case is a radioButton as the current question type is mutually exclusive. Subcomponent templates Subcomponent templates specify the layout of the question's available responses, set up the bindings and define the action events.
The template from the listing above includes the actual radioButton component to the page, sets up the required bindings and events in order to save the answers given by the user. Each method being used by the template is defined in the XQuestionPage class Generated Question Page The screenshot below shows one of the sample application's question pages built with the templates described above
|