/** * Construct with a transition model. * <p> * For most clients, this is typically the right constructor to use. * </p> * * @param id * The component id * @param wizardModel * The transitions model * @param addDefaultCssStyle * Whether to add the {@link #addDefaultCssStyle() default style} */ public Wizard(String id, IWizardModel wizardModel, boolean addDefaultCssStyle) { super(id); init(wizardModel); if (addDefaultCssStyle) { addDefaultCssStyle(); } }
/** * Convenience method to get the active step from the model. * * @return The active step */ public final IWizardStep getActiveStep() { return getWizardModel().getActiveStep(); }
/** * Initialize this wizard with a transition model. * <p> * If you constructed this wizard using a constructor without the transitions model argument, * <strong>you must</strong> call this method prior to actually using it. * </p> * * @param wizardModel */ protected void init(final IWizardModel wizardModel) { if (wizardModel == null) { throw new IllegalArgumentException("argument wizardModel must be not null"); } this.wizardModel = wizardModel; form = newForm(FORM_ID); addOrReplace(form); // dummy view to be replaced form.addOrReplace(new WebMarkupContainer(HEADER_ID)); form.addOrReplace(newFeedbackPanel(FEEDBACK_ID)); // add dummy view; will be replaced on initialization form.addOrReplace(new WebMarkupContainer(VIEW_ID)); form.addOrReplace(newButtonBar(BUTTONS_ID)); form.addOrReplace(newOverviewBar(OVERVIEW_ID)); wizardModel.addListener(this); // reset model to prepare for action wizardModel.reset(); }
/** * Construct with a transition model. Adds the default style. * <p> * For most clients, this is typically the right constructor to use. * </p> * * @param id * The component id * @param wizardModel * The transitions model */ public Wizard(final String id, final IWizardModel wizardModel) { super(id); init(wizardModel); }
/** * Construct. * <p> * If you override this class, it makes sense to call this constructor (super(id)), then - in * your constructor - construct a transition model and then call {@link #init(IWizardModel)} to * initialize the wizard. * </p> * <p> * This constructor is not meant for normal clients of this class * </p> * * @param id * The component model * @param addDefaultCssStyle * Whether to add the {@link #addDefaultCssStyle() default style} */ public Wizard(String id, boolean addDefaultCssStyle) { super(id); if (addDefaultCssStyle) { addDefaultCssStyle(); } }
/** * Will let the wizard contribute a CSS include to the page's header. It will add Wizard.css * from this package. This method is typically called by the class that creates the wizard. */ public void addDefaultCssStyle() { add(CSSPackageResource.getHeaderContribution(Wizard.class, "Wizard.css")); }
form = newForm(FORM_ID); addOrReplace(form); form.addOrReplace(newFeedbackPanel(FEEDBACK_ID)); form.addOrReplace(newButtonBar(BUTTONS_ID)); form.addOrReplace(newOverviewBar(OVERVIEW_ID));
@Override protected void init(final IWizardModel wizardModel) { super.init(wizardModel); getForm().remove(FEEDBACK_ID); if (mode == Mode.READONLY) { final Iterator<IWizardStep> iter = wizardModel.stepIterator(); while (iter.hasNext()) { WizardStep.class.cast(iter.next()).setEnabled(false); } } }
/** * Convenience method to get the active step from the model. * * @return The active step */ public final IWizardStep getActiveStep() { return getWizardModel().getActiveStep(); }