google/paco — pull request #82 by priyald17 (2013-07-30 22:16:44+00:00)
Title: Experiment validation for new creation flow

See issue #25

Validation takes on two forms. It is dynamic, in that when widgets' values are changed, their values are set to the data model (experiment or input) which either accepts the value or throws an exception. There is also save-time validation for items that start out in an invalid state (for instance, the experiment title starts out blank and may never be touched by the user, causing its value change events to never be fired. Thus, at save time, we make sure that the experiment title field is not blank.)

Any error discovered is sent eventually to the ExperimentCreationListener (which is the ExperimentCreationPanel), and error messages are accumulated in a list. The ExperimentCreationPanel uses this list to judge whether or not errors remain in the experiment.

Most panels have a reference to the ExperimentCreationListener directly. However, InputsPanel and its child panels (ResponseView, ListChoicePanel, ListChoicesPanel) do not -- they send messages to InputsListPanel, which collects and handles these messages. InputsListPanel then sends the appropriate message to ExperimentCreationPanel.
For instance, if two InputsPanels in Signal Group 2 are invalid because they both lack variable names, then they each send a message to the InputsListPanel. The InputsListPanel sees these duplicate messages, bundles them up, and sends one message to the ExperimentCreationPanel: that there are variable names missing in Signal Group 2. This allows the user to see fewer messages.

Please let me know if you have any questions!