I am currently using wizards for vaadin and I simply want my wizard to end properly when I click on the “Cancel” button.
How do I achieve this? I know that Wizards for Vaadin provides us with predefined methods such as
wizardCancelled but this doesnt really seem to work:
public void wizardCancelled(WizardCancelledEvent event) {
endWizard("Wizard cancelled!");
Notification notification = new Notification("Wizard cancelled!");
notification.setDelayMsec(1000);
notification.show(Page.getCurrent());
}
When I click on cancel, nothing happens. Not even the notification shows. Do I need to do anything else?
I haven’t tried it, but looking at the Wizards for Vaadin source, it looks like a WizardCancelledEvent should be fired when the Cancel button is pressed. Your snippet only shows a method that takes an event parameter; do you also have a listener added to your wizard? From the
Wizard’s source docs :
* To react on the progress, cancellation or completion of this {@code Wizard}
* you should add one or more listeners that implement the
* {@link WizardProgressListener} interface. These listeners are added using the
* {@link #addListener(WizardProgressListener)} method and removed with the
* {@link #removeListener(WizardProgressListener)}.