ivelin 2002/10/27 00:21:30
Modified: src/java/org/apache/cocoon/samples/xmlform WizardAction.java
Log:
since this is a session scope form and the framework handles check boxes,
remove code from the reset() method
Revision Changes Path
1.9 +22 -24
xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/WizardAction.java
Index: WizardAction.java
===================================================================
RCS file:
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/samples/xmlform/WizardAction.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- WizardAction.java 21 Sep 2002 22:57:18 -0000 1.8
+++ WizardAction.java 27 Oct 2002 07:21:29 -0000 1.9
@@ -1,4 +1,4 @@
-/*
+/*
* $Header$
* $Revision$
* $Date$
@@ -106,7 +106,7 @@
* The first callback method which is called
* when an action is invoked.
*
- * It is called before population.
+ * It is called before population and validation.
*
*
* @return null if the Action is prepared to continue - the normal case.
@@ -118,7 +118,7 @@
*
*/
protected Map prepare()
- {
+ {
// following is navigation logic for the GUI version
if ( getCommand() == null )
@@ -129,10 +129,16 @@
else if ( getCommand().equals( CMD_START ) )
{
// reset workflow state if necessary
- // ...
+
+ // remove old form
+ Form.remove( getObjectModel(), getFormId() );
+
+ // create new form
+ getForm();
return page( VIEW_USERID );
}
+ // safe lookup, side effects free
else if ( Form.lookup ( getObjectModel(), getFormId() ) == null)
{
// session expired
@@ -238,29 +244,21 @@
/**
*
* FormListener callback
- * called in the beginning Form.populate()
+ * called in the beginning of Form.populate()
* before population starts.
*
- * This is the place to handle unchecked checkboxes.
+ * This is the place to intialize the model for this request.
+ *
+ * This method should not handle unchecked check boxes
+ * when the form is session scope, which is the most common case.
+ * It should only do so, if the form is request scoped.
*
*/
public void reset( Form form )
{
- // based on the current form view
- // make some decisions regarding checkboxes, etc.
- String formView = getFormView();
- if (formView == null) return;
- if ( formView.equals ( VIEW_DEPLOYMENT ) )
- {
- // deal with the publish checkbox
- form.setValue( "/publish", Boolean.FALSE );
- }
- else if ( formView.equals ( VIEW_USERID ) )
- {
- // deal with the publish checkbox
- UserBean ub = (UserBean) form.getModel();
- ub.initRoles ();
- }
+ // nothing to do in this case
+ // unchecked check boxes are handled by the framework !
+ return;
}
----------------------------------------------------------------------
In case of troubles, e-mail: [EMAIL PROTECTED]
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]