void resetButtonsToPanelRules() { // Reset the buttons to support the original panel rules, // including whether the next or back buttons are enabled or // disabled, or if the panel is finishable. WizardModel model = wizard.getModel(); WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor(); if (descriptor == null) return; // If the panel in question has another panel behind it, enable // the back button. Otherwise, disable it. if (descriptor.getBackPanelDescriptor() != null) wizard.setBackButtonEnabled(true); else wizard.setBackButtonEnabled(false); // If the panel in question has one or more panels in front of it, // enable the next button. Otherwise, disable it. if (descriptor.getNextPanelDescriptor() != null) wizard.setNextButtonEnabled(true); else wizard.setNextButtonEnabled(false); // If the panel in question is the last panel in the series, change // the Next button to Finish. Otherwise, set the text back to Next. if (descriptor.getNextPanelDescriptor() != null && descriptor.getNextPanelDescriptor().equals(WizardPanelDescriptor.FINISH_IDENTIFIER)) { wizard.setNextButtonText(Wizard.FINISH_TEXT); } else { wizard.setNextButtonText(Wizard.NEXT_TEXT); } }
void resetButtonsToPanelRules() { WizardModel model = this.wizard.getModel(); if (model != null) { model.setCancelButtonText("Cancel"); model.setCancelButtonIcon(null); model.setBackButtonText("<Back"); model.setBackButtonIcon(null); WizardPanelDescriptor descriptor = model.getCurrentPanel(); if (descriptor != null && descriptor.getBackPanelDescriptor() != null) model.setBackButtonEnabled(Boolean.TRUE); else model.setBackButtonEnabled(Boolean.FALSE); if (descriptor != null && descriptor.getNextPanelDescriptor() != null) model.setNextButtonEnabled(Boolean.TRUE); else model.setNextButtonEnabled(Boolean.FALSE); if (descriptor != null && descriptor.getNextPanelDescriptor() != null && descriptor.getNextPanelDescriptor() instanceof Wizard.FinishIdentifier) { model.setNextButtonText("Finish"); model.setNextButtonIcon(null); } else { model.setNextButtonText("Next>"); model.setNextButtonIcon(null); } } }
private void backButtonPressed() { WizardModel model = this.wizard.getModel(); if (model != null && model.getCurrentPanel() != null) { WizardPanelDescriptor descriptor = model.getCurrentPanel(); Object backPanelDescriptor = descriptor.getBackPanelDescriptor(); this.wizard.setCurrentPanelDescriptor(backPanelDescriptor); } }
/** go to the previous panel */ private void backButtonPressed() { WizardModel model = wizard.getModel(); WizardPanelDescriptor descriptor = model.getCurrentPanelDescriptor(); // Get the descriptor that the current panel identifies as the previous // panel, and display it. String backPanelDescriptor = descriptor.getBackPanelDescriptor(); try { wizard.setCurrentPanel(backPanelDescriptor); } catch (Exception e) { e.printStackTrace(); } }