Repository: wicket
Updated Branches:
  refs/heads/master 71de9964f -> 702196249


WICKET-6541 reordered method for better readability and javadoc


Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/70219624
Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/70219624
Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/70219624

Branch: refs/heads/master
Commit: 702196249009bab5c014a38762a98b807a7e176d
Parents: 401daa2
Author: Sven Meier <svenme...@apache.org>
Authored: Fri Mar 2 14:15:49 2018 +0100
Committer: Sven Meier <svenme...@apache.org>
Committed: Tue Apr 10 22:00:54 2018 +0200

----------------------------------------------------------------------
 .../org/apache/wicket/examples/style.css        |  52 +++---
 .../wicket/extensions/wizard/IWizardModel.java  | 157 +++++++++----------
 .../wicket/extensions/wizard/IWizardStep.java   |  36 +++--
 .../wizard/dynamic/IDynamicWizardStep.java      |  64 ++++----
 4 files changed, 163 insertions(+), 146 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/wicket/blob/70219624/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
----------------------------------------------------------------------
diff --git 
a/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css 
b/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
index db8b754..bd2c42f 100644
--- a/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
+++ b/wicket-examples/src/main/resources/org/apache/wicket/examples/style.css
@@ -309,35 +309,41 @@ input[type=button],
 button {
   background: #FF9925;
   color: #fff; }
-  .button:hover,
-  input[type=submit]:hover,
-  input[type=reset]:hover,
-  button:hover {
-    background: #ffb158;
-    color: #fff; }
-  .button:active, .button:focus,
-  input[type=submit]:active,
-  input[type=submit]:focus,
-  button:active,
-  button:focus {
-    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); }
+.button:hover,
+input[type=submit]:hover,
+input[type=reset]:hover,
+button:hover {
+  background: #ffb158;
+  color: #fff; }
+.button:active, .button:focus,
+input[type=submit]:active,
+input[type=submit]:focus,
+button:active,
+button:focus {
+  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); }   
+.button[disabled],
+input[type=submit][disabled],
+input[type=reset][disabled],
+input[type=button][disabled],
+button[disabled] {
+  background: #DDDDDD; }
 
 .button--neutral,
 input[type=submit].button--neutral,
 button.button--neutral {
   background: #ccd6d2;
   color: #3f4542; }
-  .button--neutral:hover,
-  input[type=submit].button--neutral:hover,
-  button.button--neutral:hover {
-    background: #8d9994;
-    color: #3f4542; }
-  .button--neutral:active, .button--neutral:focus,
-  input[type=submit].button--neutral:active,
-  input[type=submit].button--neutral:focus,
-  button.button--neutral:active,
-  button.button--neutral:focus {
-    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); }
+.button--neutral:hover,
+input[type=submit].button--neutral:hover,
+button.button--neutral:hover {
+  background: #8d9994;
+  color: #3f4542; }
+.button--neutral:active, .button--neutral:focus,
+input[type=submit].button--neutral:active,
+input[type=submit].button--neutral:focus,
+button.button--neutral:active,
+button.button--neutral:focus {
+  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.2); }
 
 .button--success,
 input[type=submit].button--success,

http://git-wip-us.apache.org/repos/asf/wicket/blob/70219624/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModel.java
----------------------------------------------------------------------
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModel.java
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModel.java
index a66c1e8..b9b77b8 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModel.java
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardModel.java
@@ -58,19 +58,39 @@ public interface IWizardModel extends IClusterable
         *            The wizard model listener to add
         */
        void addListener(IWizardModelListener listener);
-
+       
        /**
-        * Cancels further processing. Implementations may clean up and reset 
the model. Implementations
-        * should notify the registered {@link IWizardModelListener#onCancel() 
model listeners}.
+        * Removes a wizard model listener.
+        * 
+        * @param listener
+        *            The listener to remove
         */
-       void cancel();
-
+       void removeListener(IWizardModelListener listener);
+       
        /**
-        * Instructs the wizard to finish succesfully. Typically, 
implementations check whether this
-        * option is available at all. Implementations may clean up and reset 
the model. Implementations
-        * should notify the registered {@link IWizardModelListener#onFinish() 
model listeners}.
+        * Resets the model, setting it to the first step. Implementors should 
notify
+        * {@link IWizardModelListener listeners} through calling
+        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
         */
-       void finish();
+       void reset();
+       
+       /**
+        * Returns an iterator over all the steps in the model. The iteration 
order is not guaranteed to
+        * the be the order of visit. This is an optional operation; dynamic 
models can just return
+        * null, and should call init the first time a step is encountered 
right before rendering it.
+        * 
+        * @return an iterator over all the steps of the model or null if the 
wizard model is not static
+        */
+       Iterator<IWizardStep> stepIterator();
+       
+       /**
+        * Gets whether the specified step is the last step in the wizard.
+        * 
+        * @param step
+        *            the step to check
+        * @return True if its the final step in the wizard, false< otherwise.
+        */
+       boolean isLastStep(IWizardStep step);
 
        /**
         * Gets the current active step the wizard should display.
@@ -89,35 +109,29 @@ public interface IWizardModel extends IClusterable
        boolean isCancelVisible();
 
        /**
-        * Gets whether the last button should be displayed. This method should 
only return true if the
-        * {@link #isLastAvailable} will return true at any point. Returning 
false will prevent the last
-        * button from appearing on the wizard at all.
-        * 
-        * @return True if the last button should be displayed, False otherwise.
-
-        * @see #isLastAvailable()
-        * @see #last()
+        * Cancels further processing. Implementations may clean up and reset 
the model. Implementations
+        * should notify the registered {@link IWizardModelListener#onCancel() 
model listeners}.
         */
-       boolean isLastVisible();
+       void cancel();
 
        /**
-        * Checks if the last button should be enabled.
+        * Gets whether the previous button should be enabled.
         * 
-        * @return <tt>true</tt> if the last button should be enabled, 
<tt>false</tt> otherwise.
+        * @return True if the previous button should be enabled, false 
otherwise.
         * 
-        * @see #isLastVisible()
-        * @see #last()
+        * @see #previous()
         */
-       boolean isLastAvailable();
+       boolean isPreviousAvailable();
 
        /**
-        * Gets whether the specified step is the last step in the wizard.
+        * Takes the model to the previous step.This method must only be called 
if
+        * {@link #isPreviousAvailable} returns <tt>true</tt>. Implementors 
should notify
+        * {@link IWizardModelListener listeners} through calling
+        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
         * 
-        * @param step
-        *            the step to check
-        * @return True if its the final step in the wizard, false< otherwise.
+        * @see #isPreviousAvailable()
         */
-       boolean isLastStep(IWizardStep step);
+       void previous();
 
        /**
         * Gets whether the next button should be enabled.
@@ -129,28 +143,36 @@ public interface IWizardModel extends IClusterable
        boolean isNextAvailable();
 
        /**
-        * Gets whether the previous button should be enabled.
-        * 
-        * @return True if the previous button should be enabled, false 
otherwise.
+        * Increments the model to the next step. This method must only be 
called if
+        * {@link #isNextAvailable} returns <tt>true</tt>. Implementors should 
notify
+        * {@link IWizardModelListener listeners} through calling
+        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
         * 
-        * @see #previous()
+        * @see #isNextAvailable()
         */
-       boolean isPreviousAvailable();
-       
+       void next();
+
        /**
-        * Gets whether the finish button should be enabled.
-        * <p>
-        * By default the finish button is available for the last step only.
+        * Gets whether the last button should be displayed. This method should 
only return true if the
+        * {@link #isLastAvailable} will return true at any point. Returning 
false will prevent the last
+        * button from appearing on the wizard at all.
         * 
-        * @see #isLastStep(IWizardStep)
+        * @return True if the last button should be displayed, False otherwise.
+       
+        * @see #isLastAvailable()
+        * @see #last()
+        */
+       boolean isLastVisible();
+
+       /**
+        * Checks if the last button should be enabled.
         * 
-        * @return True if the finish button should be enabled, false otherwise.
+        * @return <tt>true</tt> if the last button should be enabled, 
<tt>false</tt> otherwise.
         * 
-        * @see #finish()
+        * @see #isLastVisible()
+        * @see #last()
         */
-       default boolean isFinishAvailable() {
-               return isLastStep(getActiveStep());
-       }
+       boolean isLastAvailable();
 
        /**
         * Takes the model to the last step in the wizard. This method must 
only be called if
@@ -164,46 +186,23 @@ public interface IWizardModel extends IClusterable
        void last();
 
        /**
-        * Increments the model to the next step. This method must only be 
called if
-        * {@link #isNextAvailable} returns <tt>true</tt>. Implementors should 
notify
-        * {@link IWizardModelListener listeners} through calling
-        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
-        * 
-        * @see #isNextAvailable()
-        */
-       void next();
-
-       /**
-        * Takes the model to the previous step.This method must only be called 
if
-        * {@link #isPreviousAvailable} returns <tt>true</tt>. Implementors 
should notify
-        * {@link IWizardModelListener listeners} through calling
-        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
+        * Gets whether the finish button should be enabled.
+        * <p>
+        * By default the finish button is available for the last step only.
         * 
-        * @see #isPreviousAvailable()
-        */
-       void previous();
-
-       /**
-        * Removes a wizard model listener.
+        * @return True if the finish button should be enabled, false otherwise.
         * 
-        * @param listener
-        *            The listener to remove
-        */
-       void removeListener(IWizardModelListener listener);
-
-       /**
-        * Resets the model, setting it to the first step. Implementors should 
notify
-        * {@link IWizardModelListener listeners} through calling
-        * {@link IWizardModelListener#onActiveStepChanged(IWizardStep)}.
+        * @see #isLastStep(IWizardStep)
+        * @see #finish()
         */
-       void reset();
+       default boolean isFinishAvailable() {
+               return isLastStep(getActiveStep());
+       }
 
        /**
-        * Returns an iterator over all the steps in the model. The iteration 
order is not guaranteed to
-        * the be the order of visit. This is an optional operation; dynamic 
models can just return
-        * null, and should call init the first time a step is encountered 
right before rendering it.
-        * 
-        * @return an iterator over all the steps of the model or null if the 
wizard model is not static
+        * Instructs the wizard to finish succesfully. Typically, 
implementations check whether this
+        * option is available at all. Implementations may clean up and reset 
the model. Implementations
+        * should notify the registered {@link IWizardModelListener#onFinish() 
model listeners}.
         */
-       Iterator<IWizardStep> stepIterator();
+       void finish();
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/70219624/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardStep.java
----------------------------------------------------------------------
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardStep.java
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardStep.java
index 03f7a17..5097299 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardStep.java
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/IWizardStep.java
@@ -37,8 +37,20 @@ import org.apache.wicket.util.io.IClusterable;
 public interface IWizardStep extends IClusterable
 {
        /**
+        * Initializes this step with the model it will belong to.
+        * <p>
+        * This method is called at least once before this step becomes the 
actual step.
+        * 
+        * @param wizardModel
+        *            the owning wizard model
+        */
+       void init(IWizardModel wizardModel);
+       
+       /**
         * Gets the header component for this step. This component is displayed 
in a special section of
         * the wizard.
+        * <p>
+        * This method is called every time this step becomes the active step 
of the wizard.
         * 
         * @param id
         *            The id that the component should be created with
@@ -52,8 +64,9 @@ public interface IWizardStep extends IClusterable
 
        /**
         * Returns the current view this step is displaying. This component 
will be displayed in the
-        * main section of the wizard with this step is active. This may 
changed at any time by as long
-        * as an appropriate property change event is fired.
+        * main section of the wizard.
+        * <p>
+        * This method is called every time this step becomes the active step 
of the wizard.
         * 
         * @param id
         *            The id that the component should be created with
@@ -66,17 +79,12 @@ public interface IWizardStep extends IClusterable
        Component getView(String id, Component parent, IWizard wizard);
 
        /**
-        * Initializes this step with the model it will belong to.
+        * This method is called whenever the wizard proceeds from this step to 
another step. It is not
+        * called when returning to a previous step.
         * 
-        * @param wizardModel
-        *            the owning wizard model
-        */
-       void init(IWizardModel wizardModel);
-
-       /**
-        * This method is called whenever the user presses next while this step 
is active.
-        * <p>
-        * This method will only be called if {@link 
IWizardModel#isNextAvailable} returns {@code true}.
+        * @see IWizardModel#next() 
+        * @see IWizardModel#last() 
+        * @see IWizardModel#finish() 
         */
        void applyState();
 
@@ -85,6 +93,10 @@ public interface IWizardStep extends IClusterable
         * proceed to the next step.
         * 
         * @return {@code true} if the wizard can proceed from this step, 
{@code false} otherwise.
+        * 
+        * @see IWizardModel#next() 
+        * @see IWizardModel#last() 
+        * @see IWizardModel#finish() 
         */
        boolean isComplete();
 }

http://git-wip-us.apache.org/repos/asf/wicket/blob/70219624/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/IDynamicWizardStep.java
----------------------------------------------------------------------
diff --git 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/IDynamicWizardStep.java
 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/IDynamicWizardStep.java
index 94cacde..a68b5eb 100644
--- 
a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/IDynamicWizardStep.java
+++ 
b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/dynamic/IDynamicWizardStep.java
@@ -34,22 +34,31 @@ import org.apache.wicket.extensions.wizard.IWizardStep;
 public interface IDynamicWizardStep extends IWizardStep
 {
        /**
-        * Checks if the last button should be enabled.
+        * Gets whether this is the last step in the wizard.
         * 
-        * @return <tt>true</tt> if the last button should be enabled, 
<tt>false</tt> otherwise.
+        * @return True if its the final step in the wizard, false< otherwise.
         * 
-        * @see IWizardModel#isLastAvailable()
+        * @see IWizardModel#isLastStep(IWizardStep)
         */
-       boolean isLastAvailable();
+       boolean isLastStep();
 
        /**
-        * Gets whether this is the last step in the wizard.
+        * Gets whether the previous button should be enabled.
         * 
-        * @return True if its the final step in the wizard, false< otherwise.
+        * @return True if the previous button should be enabled, false 
otherwise.
         * 
-        * @see IWizardModel#isLastStep(IWizardStep)
+        * @see IWizardModel#isPreviousAvailable()
         */
-       boolean isLastStep();
+       boolean isPreviousAvailable();
+
+       /**
+        * Gets the previous wizard step from here. Can only be called when
+        * {@link #isPreviousAvailable()} returns true.
+        * 
+        * @return The next wizard step. May not be null unless this is the 
first step (in which case it
+        *         should never be called).
+        */
+       IDynamicWizardStep previous();
 
        /**
         * Gets whether the next button should be enabled.
@@ -61,24 +70,22 @@ public interface IDynamicWizardStep extends IWizardStep
        boolean isNextAvailable();
 
        /**
-        * Gets whether the previous button should be enabled.
-        * 
-        * @return True if the previous button should be enabled, false 
otherwise.
+        * Gets the next wizard step from here. Can only be called when {@link 
#isNextAvailable()}
+        * returns true.
         * 
-        * @see IWizardModel#isPreviousAvailable()
+        * @return The next wizard step. May not be null unless this is the 
last step (
+        *         {@link #isLastStep()} returns true).
         */
-       boolean isPreviousAvailable();
+       IDynamicWizardStep next();
 
        /**
-        * Gets whether the finish button should be enabled.
+        * Checks if the last button should be enabled.
         * 
-        * @return True if the finish button should be enabled, false otherwise.
+        * @return <tt>true</tt> if the last button should be enabled, 
<tt>false</tt> otherwise.
         * 
-        * @see IWizardModel#isFinishAvailable()
+        * @see IWizardModel#isLastAvailable()
         */
-       default boolean isFinishAvailable() {
-               return isLastStep();
-       }
+       boolean isLastAvailable();
 
        /**
         * Gets the next wizard step from here. Can only be called when
@@ -89,20 +96,13 @@ public interface IDynamicWizardStep extends IWizardStep
        IDynamicWizardStep last();
 
        /**
-        * Gets the next wizard step from here. Can only be called when {@link 
#isNextAvailable()}
-        * returns true.
+        * Gets whether the finish button should be enabled.
         * 
-        * @return The next wizard step. May not be null unless this is the 
last step (
-        *         {@link #isLastStep()} returns true).
-        */
-       IDynamicWizardStep next();
-
-       /**
-        * Gets the previous wizard step from here. Can only be called when
-        * {@link #isPreviousAvailable()} returns true.
+        * @return True if the finish button should be enabled, false otherwise.
         * 
-        * @return The next wizard step. May not be null unless this is the 
first step (in which case it
-        *         should never be called).
+        * @see IWizardModel#isFinishAvailable()
         */
-       IDynamicWizardStep previous();
+       default boolean isFinishAvailable() {
+               return isLastStep();
+       }
 }

Reply via email to