Skip to content

Instantly share code, notes, and snippets.

@TrentBrown
Last active December 17, 2015 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TrentBrown/5667726 to your computer and use it in GitHub Desktop.
Save TrentBrown/5667726 to your computer and use it in GitHub Desktop.
Generating a GUI from FileThis "question" data

The following two files may be helpful in understanding how to go about generating a GUI from the FileThis "complex" question data, and in constructing an answer string from what the user enters:

QuestionDialogMediator.as

ComplexQuestionMediator.as

These are taken from the FileThis Flex web client. Both files define classes that mediate between passive presentation views and data models.

The first manages a user dialog view whose content will contain one of several view/mediator pairs, depending on the type of question that has been posed. See the onRegister method of the QuestionDialogMediator class.

The second class is a mediator that manages the more interesting of these question types, the "complex" question. Note that the constructor accepts value objects for connection and question records. The generateGui method is invoked in the constructor. It parses the complex question data and instantiates views for each question part --things like radio buttons, and text entry fields. When the user clicks the button to commit his answer, the QuestionDialogMediator will call the ComplexQuestionMediator's answer method, which is responsible for extracting the answer data from the UI controls and for building a string which has a format that the FileThis service expects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment