Author: ehillenius
Date: Mon Jul 16 22:39:15 2007
New Revision: 556818
URL: http://svn.apache.org/viewvc?view=rev&rev=556818
Log:
initialize dynamic steps
Modified:
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardModel.java
Modified:
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java?view=diff&rev=556818&r1=556817&r2=556818
==============================================================================
---
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java
(original)
+++
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardStep.java
Mon Jul 16 22:39:15 2007
@@ -23,6 +23,7 @@
import java.util.Set;
import org.apache.wicket.Component;
+import org.apache.wicket.extensions.wizard.dynamic.DynamicWizardModel;
import org.apache.wicket.markup.html.basic.Label;
import org.apache.wicket.markup.html.form.Form;
import org.apache.wicket.markup.html.form.FormComponent;
@@ -377,9 +378,18 @@
}
/**
- * Called to initialize the step. This method will be called when the
wizard
- * is first initialising. This method sets the wizard model and then
calls
- * template method [EMAIL PROTECTED] #onInit(IWizardModel)}
+ * Called to initialize the step. When this method is called depends on
the
+ * kind of wizard model that is used.
+ *
+ * The [EMAIL PROTECTED] WizardModel static wizard model} knows all the
steps upfront
+ * and initializes themm when starting up. This method will be called
when
+ * the wizard is [EMAIL PROTECTED] #init(IWizardModel) initializing}.
+ *
+ * The [EMAIL PROTECTED] DynamicWizardModel dynamic wizard model}
initializes steps
+ * every time they are encountered.
+ *
+ * This method sets the wizard model and then calls template method
+ * [EMAIL PROTECTED] #onInit(IWizardModel)}
*
* @param wizardModel
* the model to which the step belongs.
@@ -472,9 +482,10 @@
}
/**
- * Called when the step is being initialized.
+ * Template method that is called when the step is being initialized.
*
* @param wizardModel
+ * @see #init(IWizardModel)
*/
protected void onInit(IWizardModel wizardModel)
{
Modified:
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardModel.java
URL:
http://svn.apache.org/viewvc/incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardModel.java?view=diff&rev=556818&r1=556817&r2=556818
==============================================================================
---
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardModel.java
(original)
+++
incubator/wicket/trunk/jdk-1.4/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/DynamicWizardModel.java
Mon Jul 16 22:39:15 2007
@@ -16,9 +16,7 @@
*/
package org.apache.wicket.extensions.wizard.dynamic;
-import java.util.HashSet;
import java.util.Iterator;
-import java.util.Set;
import org.apache.wicket.extensions.wizard.AbstractWizardModel;
import org.apache.wicket.extensions.wizard.IWizardStep;
@@ -43,11 +41,6 @@
private IDynamicWizardStep activeStep;
/**
- * Holds initialized steps.
- */
- private final Set initializedSteps = new HashSet();
-
- /**
* Remember the first step for resetting the wizard.
*/
private final IDynamicWizardStep startStep;
@@ -155,26 +148,6 @@
}
/**
- * Prepares a step for activation. Steps typically are initialized (have
- * their method
- * [EMAIL PROTECTED]
IWizardStep#init(org.apache.wicket.extensions.wizard.IWizardModel)}
- * called) the first time they are about to be displayed (thus by
default
- * when the next button is pushed or when the wizard is starting for the
- * first step in the model). You can override this method you need more
- * control.
- *
- * @param step
- * The step to be activated
- */
- protected void prepareStep(IDynamicWizardStep step)
- {
- if (!wasStepInitialized(step))
- {
- step.init(this);
- }
- }
-
- /**
* Sets the active step.
*
* @param step
@@ -187,14 +160,9 @@
throw new IllegalArgumentException("argument step must
to be not null");
}
+ step.init(this);
this.activeStep = step;
fireActiveStepChanged(step);
}
-
- protected final boolean wasStepInitialized(IDynamicWizardStep step)
- {
- return initializedSteps.contains(step);
- }
-
}