Package org.jfree.ui

Class WizardDialog

All Implemented Interfaces:
ActionListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants

public class WizardDialog extends JDialog implements ActionListener
A dialog that presents the user with a sequence of steps for completing a task. The dialog contains "Next" and "Previous" buttons, allowing the user to navigate through the task.

When the user backs up by one or more steps, the dialog keeps the completed steps so that they can be reused if the user doesn't change anything - this handles the cases where the user backs up a few steps just to review what has been completed.

But if the user changes some options in an earlier step, then the dialog may have to discard the later steps and have them repeated.

THIS CLASS IS NOT WORKING CORRECTLY YET.

See Also:
  • Field Details

    • result

      private Object result
      The end result of the wizard sequence.
    • step

      private int step
      The current step in the wizard process (starting at step zero).
    • currentPanel

      private WizardPanel currentPanel
      A reference to the current panel.
    • panels

      private List panels
      A list of references to the panels the user has already seen - used for navigating through the steps that have already been completed.
    • previousButton

      private JButton previousButton
      A handy reference to the "previous" button.
    • nextButton

      private JButton nextButton
      A handy reference to the "next" button.
    • finishButton

      private JButton finishButton
      A handy reference to the "finish" button.
    • helpButton

      private JButton helpButton
      A handy reference to the "help" button.
  • Constructor Details

    • WizardDialog

      public WizardDialog(JDialog owner, boolean modal, String title, WizardPanel firstPanel)
      Standard constructor - builds and returns a new WizardDialog.
      Parameters:
      owner - the owner.
      modal - modal?
      title - the title.
      firstPanel - the first panel.
    • WizardDialog

      public WizardDialog(JFrame owner, boolean modal, String title, WizardPanel firstPanel)
      Standard constructor - builds a new WizardDialog owned by the specified JFrame.
      Parameters:
      owner - the owner.
      modal - modal?
      title - the title.
      firstPanel - the first panel.
  • Method Details

    • getResult

      public Object getResult()
      Returns the result of the wizard sequence.
      Returns:
      the result.
    • getStepCount

      public int getStepCount()
      Returns the total number of steps in the wizard sequence, if this number is known. Otherwise this method returns zero. Subclasses should override this method unless the number of steps is not known.
      Returns:
      the number of steps.
    • canDoPreviousPanel

      public boolean canDoPreviousPanel()
      Returns true if it is possible to back up to the previous panel, and false otherwise.
      Returns:
      boolean.
    • canDoNextPanel

      public boolean canDoNextPanel()
      Returns true if there is a 'next' panel, and false otherwise.
      Returns:
      boolean.
    • canFinish

      public boolean canFinish()
      Returns true if it is possible to finish the sequence at this point (possibly with defaults for the remaining entries).
      Returns:
      boolean.
    • getWizardPanel

      public WizardPanel getWizardPanel(int step)
      Returns the panel for the specified step (steps are numbered from zero).
      Parameters:
      step - the current step.
      Returns:
      the panel.
    • actionPerformed

      public void actionPerformed(ActionEvent event)
      Handles events.
      Specified by:
      actionPerformed in interface ActionListener
      Parameters:
      event - the event.
    • previous

      public void previous()
      Handles a click on the "previous" button, by displaying the previous panel in the sequence.
    • next

      public void next()
      Displays the next step in the wizard sequence.
    • finish

      public void finish()
      Finishes the wizard.
    • enableButtons

      private void enableButtons()
      Enables/disables the buttons according to the current step. A good idea would be to ask the panels to return the status...
    • isCancelled

      public boolean isCancelled()
      Checks, whether the user cancelled the dialog.
      Returns:
      false.
    • createContent

      public JPanel createContent()
      Creates a panel containing the user interface for the dialog.
      Returns:
      the panel.