You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Martin Grigorov <mg...@apache.org> on 2016/01/10 16:08:54 UTC

Re: wicket git commit: WICKET-6070 Provide factory methods for WizardButtonBar buttons

Hi Sebastien.


On Sat, Jan 9, 2016 at 9:01 PM, <sb...@apache.org> wrote:

> Repository: wicket
> Updated Branches:
>   refs/heads/master e72ed7e22 -> 2e36671c6
>
>
> WICKET-6070 Provide factory methods for WizardButtonBar buttons
>
>
> Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2e36671c
> Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2e36671c
> Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2e36671c
>
> Branch: refs/heads/master
> Commit: 2e36671c683e1a759d993369253672518a9c2882
> Parents: e72ed7e
> Author: Sebastien <se...@gmail.com>
> Authored: Sat Jan 9 20:32:49 2016 +0100
> Committer: Sebastien <se...@gmail.com>
> Committed: Sat Jan 9 20:33:27 2016 +0100
>
> ----------------------------------------------------------------------
>  .../extensions/wizard/WizardButtonBar.java      | 70 ++++++++++++++++++--
>  1 file changed, 65 insertions(+), 5 deletions(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/wicket/blob/2e36671c/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> ----------------------------------------------------------------------
> diff --git
> a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> index a3b77db..b9d586b 100644
> ---
> a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> +++
> b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> @@ -46,11 +46,11 @@ public class WizardButtonBar extends Panel implements
> IDefaultButtonProvider
>         public WizardButtonBar(final String id, final IWizard wizard)
>         {
>                 super(id);
> -               add(new PreviousButton("previous", wizard));
> -               add(new NextButton("next", wizard));
> -               add(new LastButton("last", wizard));
> -               add(new CancelButton("cancel", wizard));
> -               add(new FinishButton("finish", wizard));
> +               add(newPreviousButton("previous", wizard));
> +               add(newNextButton("next", wizard));
> +               add(newLastButton("last", wizard));
> +               add(newCancelButton("cancel", wizard));
> +               add(newFinishButton("finish", wizard));
>

Usually it is a bad practice to expose overridable methods which are called
before the full construction of the object.
Is it OK to move all those calls to #onInitialize() ?


>         }
>
>         /**
> @@ -73,4 +73,64 @@ public class WizardButtonBar extends Panel implements
> IDefaultButtonProvider
>                 }
>                 return null;
>         }
> +
> +       /**
> +        * Creates a new {@link PreviousButton}
> +        *
> +        * @param id the button's markup-id
> +        * @param wizard the {@link IWizard}
> +        * @return a new {@code PreviousButton}
> +        */
> +       protected PreviousButton newPreviousButton(final String id, final
> IWizard wizard)
> +       {
> +               return new PreviousButton(id, wizard);
> +       }
> +
> +       /**
> +        * Creates a new {@link NextButton}
> +        *
> +        * @param id the button's markup-id
> +        * @param wizard the {@link IWizard}
> +        * @return a new {@code NextButton}
> +        */
> +       protected NextButton newNextButton(final String id, final IWizard
> wizard)
> +       {
> +               return new NextButton(id, wizard);
> +       }
> +
> +       /**
> +        * Creates a new {@link LastButton}
> +        *
> +        * @param id the button's markup-id
> +        * @param wizard the {@link IWizard}
> +        * @return a new {@code LastButton}
> +        */
> +       protected LastButton newLastButton(final String id, final IWizard
> wizard)
> +       {
> +               return new LastButton(id, wizard);
> +       }
> +
> +       /**
> +        * Creates a new {@link CancelButton}
> +        *
> +        * @param id the button's markup-id
> +        * @param wizard the {@link IWizard}
> +        * @return a new {@code CancelButton}
> +        */
> +       protected CancelButton newCancelButton(final String id, final
> IWizard wizard)
> +       {
> +               return new CancelButton(id, wizard);
> +       }
> +
> +       /**
> +        * Creates a new {@link FinishButton}
> +        *
> +        * @param id the button's markup-id
> +        * @param wizard the {@link IWizard}
> +        * @return a new {@code FinishButton}
> +        */
> +       protected FinishButton newFinishButton(final String id, final
> IWizard wizard)
> +       {
> +               return new FinishButton(id, wizard);
> +       }
>  }
>
>

Re: wicket git commit: WICKET-6070 Provide factory methods for WizardButtonBar buttons

Posted by Sebastien <se...@gmail.com>.
Hi Martin,

Definitely agree! I cannot explain how I missed this... :/
I will change it asap...

Thanks & best regards,
Sebastien.


On Sun, Jan 10, 2016 at 4:08 PM, Martin Grigorov <mg...@apache.org>
wrote:

> Hi Sebastien.
>
>
> On Sat, Jan 9, 2016 at 9:01 PM, <sb...@apache.org> wrote:
>
> > Repository: wicket
> > Updated Branches:
> >   refs/heads/master e72ed7e22 -> 2e36671c6
> >
> >
> > WICKET-6070 Provide factory methods for WizardButtonBar buttons
> >
> >
> > Project: http://git-wip-us.apache.org/repos/asf/wicket/repo
> > Commit: http://git-wip-us.apache.org/repos/asf/wicket/commit/2e36671c
> > Tree: http://git-wip-us.apache.org/repos/asf/wicket/tree/2e36671c
> > Diff: http://git-wip-us.apache.org/repos/asf/wicket/diff/2e36671c
> >
> > Branch: refs/heads/master
> > Commit: 2e36671c683e1a759d993369253672518a9c2882
> > Parents: e72ed7e
> > Author: Sebastien <se...@gmail.com>
> > Authored: Sat Jan 9 20:32:49 2016 +0100
> > Committer: Sebastien <se...@gmail.com>
> > Committed: Sat Jan 9 20:33:27 2016 +0100
> >
> > ----------------------------------------------------------------------
> >  .../extensions/wizard/WizardButtonBar.java      | 70
> ++++++++++++++++++--
> >  1 file changed, 65 insertions(+), 5 deletions(-)
> > ----------------------------------------------------------------------
> >
> >
> >
> >
> http://git-wip-us.apache.org/repos/asf/wicket/blob/2e36671c/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> > ----------------------------------------------------------------------
> > diff --git
> >
> a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> >
> b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> > index a3b77db..b9d586b 100644
> > ---
> >
> a/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> > +++
> >
> b/wicket-extensions/src/main/java/org/apache/wicket/extensions/wizard/WizardButtonBar.java
> > @@ -46,11 +46,11 @@ public class WizardButtonBar extends Panel implements
> > IDefaultButtonProvider
> >         public WizardButtonBar(final String id, final IWizard wizard)
> >         {
> >                 super(id);
> > -               add(new PreviousButton("previous", wizard));
> > -               add(new NextButton("next", wizard));
> > -               add(new LastButton("last", wizard));
> > -               add(new CancelButton("cancel", wizard));
> > -               add(new FinishButton("finish", wizard));
> > +               add(newPreviousButton("previous", wizard));
> > +               add(newNextButton("next", wizard));
> > +               add(newLastButton("last", wizard));
> > +               add(newCancelButton("cancel", wizard));
> > +               add(newFinishButton("finish", wizard));
> >
>
> Usually it is a bad practice to expose overridable methods which are called
> before the full construction of the object.
> Is it OK to move all those calls to #onInitialize() ?
>
>
> >         }
> >
> >         /**
> > @@ -73,4 +73,64 @@ public class WizardButtonBar extends Panel implements
> > IDefaultButtonProvider
> >                 }
> >                 return null;
> >         }
> > +
> > +       /**
> > +        * Creates a new {@link PreviousButton}
> > +        *
> > +        * @param id the button's markup-id
> > +        * @param wizard the {@link IWizard}
> > +        * @return a new {@code PreviousButton}
> > +        */
> > +       protected PreviousButton newPreviousButton(final String id, final
> > IWizard wizard)
> > +       {
> > +               return new PreviousButton(id, wizard);
> > +       }
> > +
> > +       /**
> > +        * Creates a new {@link NextButton}
> > +        *
> > +        * @param id the button's markup-id
> > +        * @param wizard the {@link IWizard}
> > +        * @return a new {@code NextButton}
> > +        */
> > +       protected NextButton newNextButton(final String id, final IWizard
> > wizard)
> > +       {
> > +               return new NextButton(id, wizard);
> > +       }
> > +
> > +       /**
> > +        * Creates a new {@link LastButton}
> > +        *
> > +        * @param id the button's markup-id
> > +        * @param wizard the {@link IWizard}
> > +        * @return a new {@code LastButton}
> > +        */
> > +       protected LastButton newLastButton(final String id, final IWizard
> > wizard)
> > +       {
> > +               return new LastButton(id, wizard);
> > +       }
> > +
> > +       /**
> > +        * Creates a new {@link CancelButton}
> > +        *
> > +        * @param id the button's markup-id
> > +        * @param wizard the {@link IWizard}
> > +        * @return a new {@code CancelButton}
> > +        */
> > +       protected CancelButton newCancelButton(final String id, final
> > IWizard wizard)
> > +       {
> > +               return new CancelButton(id, wizard);
> > +       }
> > +
> > +       /**
> > +        * Creates a new {@link FinishButton}
> > +        *
> > +        * @param id the button's markup-id
> > +        * @param wizard the {@link IWizard}
> > +        * @return a new {@code FinishButton}
> > +        */
> > +       protected FinishButton newFinishButton(final String id, final
> > IWizard wizard)
> > +       {
> > +               return new FinishButton(id, wizard);
> > +       }
> >  }
> >
> >
>