Example usage for org.apache.wicket.extensions.wizard IWizardStep isComplete

List of usage examples for org.apache.wicket.extensions.wizard IWizardStep isComplete

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.wizard IWizardStep isComplete.

Prototype

boolean isComplete();

Source Link

Document

Checks if this step is complete.

Usage

From source file:com.antilia.web.wizard.AjaxFinishButton.java

License:Apache License

@Override
protected void onClick(AjaxRequestTarget target, Form<?> form) {
    IWizardModel wizardModel = getWizardModel();
    IWizardStep step = wizardModel.getActiveStep();

    // let the step apply any state
    step.applyState();// w  w w  . j  av  a 2  s . com

    if (step instanceof IValidatableStep) {
        IValidatableStep validatableStep = (IValidatableStep) step;
        if (!validatableStep.isValid()) {
            AjaxWizard ajaxWizard = findParent(AjaxWizard.class);
            target.addComponent(ajaxWizard);
            return;
        }
    }

    // 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));
    }
}

From source file:com.antilia.web.wizard.AjaxNextButton.java

License:Apache License

@Override
protected void onClick(AjaxRequestTarget target, Form<?> form) {
    IWizardModel wizardModel = getWizardModel();
    IWizardStep step = wizardModel.getActiveStep();

    // let the step apply any state
    step.applyState();//from   w  w w.  j  a va 2s .c  om

    if (step instanceof IValidatableStep) {
        IValidatableStep validatableStep = (IValidatableStep) step;
        if (!validatableStep.isValid()) {
            AjaxWizard ajaxWizard = findParent(AjaxWizard.class);
            target.addComponent(ajaxWizard);
            return;
        }
    }
    // if the step completed after applying the state, move the
    // model onward
    if (step.isComplete()) {
        wizardModel.next();
    } else {
        error(getLocalizer().getString("org.apache.wicket.extensions.wizard.NextButton.step.did.not.complete",
                this));
    }
}

From source file:ro.nextreports.server.web.common.misc.AjaxWizardButtonBar.java

License:Apache License

public AjaxWizardButtonBar(String id, final Wizard wizard) {
    super(id, wizard);

    addOrReplace(new AjaxWizardButton("next", wizard, "next") {
        @Override/*from  www .  j  ava 2  s  .c o m*/
        protected void onClick(AjaxRequestTarget target, Form form) {
            IWizardModel wizardModel = getWizardModel();
            IWizardStep step = wizardModel.getActiveStep();
            // let the step apply any state step.applyState();
            // if the step completed after applying the state, move the model onward
            if (step.isComplete()) {
                wizardModel.next();
            } else {
                error(getLocalizer().getString(
                        "org.apache.wicket.extensions.wizard.NextButton.step.did.not.complete", this));
            }
            target.add(wizard);
        }

        protected void onError(AjaxRequestTarget target, Form<?> form) {
            //@todo how to get feedbackPanel only
            target.add(wizard);
        }

        public final boolean isEnabled() {
            return getWizardModel().isNextAvailable();
        }
    });

    AjaxWizardButton prevButton = new AjaxWizardButton("previous", wizard, "prev") {
        @Override
        protected void onClick(AjaxRequestTarget target, Form form) {
            getWizardModel().previous();
            target.add(wizard);
        }

        protected void onError(AjaxRequestTarget target, Form<?> form) {
            //@todo how to get feedbackPanel only
            target.add(wizard);
        }

        public final boolean isEnabled() {
            return getWizardModel().isPreviousAvailable();
        }

    };
    //no validation is done clicking previous
    prevButton.setDefaultFormProcessing(false);
    addOrReplace(prevButton);

    AjaxWizardButton cancelButton = new AjaxWizardButton("cancel", wizard, "cancel") {
        @Override
        protected void onClick(AjaxRequestTarget target, Form form) {
            //getWizardModel().cancel();
            onCancel(target);
            target.add(wizard);
        }

        protected void onError(AjaxRequestTarget target, Form<?> form) {
            //@todo how to get feedbackPanel only
            target.add(wizard);
        }

        public final boolean isEnabled() {
            return getWizardModel().isCancelVisible();
        }
    };
    //no validation is done clicking cancel
    cancelButton.setDefaultFormProcessing(false);
    addOrReplace(cancelButton);

    finishButton = new AjaxWizardFinishButton("finish", wizard);
    addOrReplace(finishButton);
}

From source file:ro.nextreports.server.web.common.misc.AjaxWizardFinishButton.java

License:Apache License

/**
 * @see org.apache.wicket.extensions.wizard.WizardButton#onClick()
 */// www  . ja  v a  2s. com
@Override
public void onClick(AjaxRequestTarget target, Form form) {
    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));
    }
    target.add((Wizard) getWizard());
}