Find the panel you want to modify, say the WizardButtonBar and extend it:

public class MyWizardButtonBar extends WizardButtonBar {
    private static final long serialVersionUID = 1L;

    public MyWizardButtonBar(String id, Wizard wizard, final boolean
finishOnAnyStep) {
        super(id, wizard);
        addOrReplace(new MyFinishButton("finish", wizard) {
            private static final long serialVersionUID = 1L;
            @Override
            public boolean isEnabled() {
                return (super.isEnabled() || finishOnAnyStep);
            }
        });
    }
}

Then change its HTML to whatever you want, ie MyWizardButtonBar.html I have
as:
<html xmlns:wicket="http://wicket.apache.org";>
 <wicket:panel>
     <div align="right">
      <input wicket:id="previous"   type="submit"
class="toolbox-form-submit" value="[Previous]" />
      <input wicket:id="next"       type="submit"
class="toolbox-form-submit" value="[Next]" />
      <input wicket:id="last"       type="submit"
class="toolbox-form-submit" value="[Last]" />
      <input wicket:id="cancel"     type="submit"
class="toolbox-form-submit" value="[Cancel]" />
      <input wicket:id="finish"     type="submit"
class="toolbox-form-submit" value="[Finish]" />
  </div>
 </wicket:panel>
</html>

Finally, extend the Wizard itself and override the factory method you need
changed:

public class MyWizard extends Wizard {
...
@Override
    protected Component newButtonBar(String id) {
        return new MyWizardButtonBar(id, this, finishOnAnyStep());
    }
...
}

Then change the Wizard's HTML as you please but preserve the Wicket
component tree hirarachy.
Something like this:

<html xmlns:wicket="http://wicket.apache.org";>
    <wicket:panel>
        <form wicket:id="form">
            <table class="wicketExtensionsWizardOuterTable">
                <tr>
                    <td valign="top">
                        <span wicket:id="overview">[[Overview]]</span>
                    </td>
                    <td valign="top">
                        <table class="wicketExtensionsWizardInnerTable">
                            <tr class="wicketExtensionsWizardHeaderRow">
                                <td valign="top"
class="wicketExtensionsWizardHeader"><span
wicket:id="header">[[Header]]</span></td>
                            </tr>
                            <tr class="wicketExtensionsWizardViewRow">
                                <td valign="top"
class="wicketExtensionsWizardView"><div wicket:id="view"
class="wicketExtensionsWizardViewInner">[[View]]</div></td>
                            </tr>
                            <tr class="wicketExtensionsWizardFeedbackRow">
                                <td valign="top"
class="wicketExtensionsWizardFeedback"><span
wicket:id="feedback">[[Feeback]]</span></td>
                            </tr>
                            <tr class="wicketExtensionsWizardButtonBarRow">
                                <td valign="top"
class="wicketExtensionsWizardButtonBar"><span
wicket:id="buttons">[[Buttons]]</span></td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </form>
    </wicket:panel>
</html>

On a side note, I didn't like the default of the Finish button so I changed
that too:

public class MyFinishButton extends WizardButton {
    private static final long serialVersionUID = 1L;

    public MyFinishButton(String id, IWizard wizard) {
        super(id, wizard, "org.apache.wicket.extensions.wizard.finish");
    }

    /**
     * @see org.apache.wicket.Component#isEnabled()
     */
    public boolean isEnabled() {
        IWizardStep activeStep = getWizardModel().getActiveStep();
        return (activeStep != null &&
getWizardModel().isLastStep(activeStep));
    }

    /**
     * @see org.apache.wicket.extensions.wizard.WizardButton#onClick()
     */
    public final void onClick() {
        IWizardModel wizardModel = getWizardModel();
        IWizardStep step = wizardModel.getActiveStep();

        // let the step apply any state
        step.applyState();

        // if the step completed after applying the state, notify the wizard
        if(step.isComplete()) {
            getWizardModel().finish();
        } else {
            error(getLocalizer().getString(

"org.apache.wicket.extensions.wizard.FinishButton.step.did.not.complete",
this)
            );
        }
    }
}


On Fri, Feb 7, 2014 at 9:04 AM, Patrick Davids <patrick.dav...@nubologic.com
> wrote:

> Hi all,
> did someone already noticed, a custom overriden overview-bar of wickets
> wizzard is displayed in a <td> left of the Step contents ?
>
> I thought it would be on the top...
>
> Or did I misunderstood the meaning of the overview bar?
> Is it meant as kind of menu?!
>
> kind regards
> Patrick

Reply via email to