Class PWizard

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible
Direct Known Subclasses:
PValidatingWizard

public class PWizard extends JPanel
An Portal-aware wizard framework hosted in a dialog. An optional navigator is provided as a means of randomly moving between pages of the wizard.
See Also:
  • Field Details

  • Constructor Details

    • PWizard

      public PWizard()
      Create an instance of the wizard with no owner that is modeless and which contains a navigator
    • PWizard

      public PWizard(JFrame owner, boolean modal, boolean useNavigator)
      Creates an instance of the wizard with the specified owner that is optionally modeless and which optionally contains a navigator
      Parameters:
      owner - the Frame that owns the wizard
      modal - true for a modal wizard; false for one that allows others windows to be active at the same time
      useNavigator - true for the wizard to contain a navigator allowing for random page selection; false otherwise
  • Method Details

    • showWizard

      public int showWizard()
      Shows the dialog containing the wizard panel.
      Returns:
      FINISH_OPTION if exiting after the Finish button was pressed or CANCEL_OPTION if exiting after the Cancel button was pressed.
    • addNotify

      public void addNotify()
      Overrides:
      addNotify in class JComponent
    • removeNotify

      public void removeNotify()
      Overrides:
      removeNotify in class JComponent
    • getWizardDialog

      public JDialog getWizardDialog()
      Returns the wizard dialog
      Returns:
      The dialog hosting the wizard panel
    • setFinishButtonEnabled

      public void setFinishButtonEnabled(boolean b)
      Gives the user control over the finish button
      Parameters:
      b - Sets the enabled state of the finish button
    • setVisible

      public void setVisible(boolean b)
      Shows or hides the wizard dialog.
      Overrides:
      setVisible in class JComponent
      Parameters:
      b - If true, shows the dialog; otherwise, hides it.
    • removeHelpCommand

      protected void removeHelpCommand()
      Removes the visual help command (button) from the wizard
    • removeCancelCommand

      protected void removeCancelCommand()
      Removes the visual cancel command (button) from the wizard
    • removeFinishCommand

      protected void removeFinishCommand()
      Removes the visual cancel command (button) from the wizard
    • addButtonPanelElement

      public void addButtonPanelElement(Component comp, int gap)
      Inserts an element into the wizard button panel just to the left of the "Back" button.
      Parameters:
      comp - Element to add to the left of the "Back" button.
      gap - Padding to separate the new element from the "Back" button.
    • addPage

      public void addPage(Component page)
      Adds a page to the wizard
      Parameters:
      page - Page to add to the wizard
    • setVisiblePage

      public void setVisiblePage(int index)
      Switches to the page at the specified index. If the index is out of bounds, nothing happens.
      Parameters:
      index - The index of the page to display.
    • processNext

      public void processNext()
      Moves to the next visible page in the wizard. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used is PAGE_SWITCH.
      See Also:
    • processBack

      public void processBack()
      Moves to the previous page in the wizard. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used is PAGE_SWITCH.
      See Also:
    • showWizardPage

      public void showWizardPage(String page, boolean force)
      Switches the wizard to the passed-in page. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used is PAGE_SWITCH.
      Parameters:
      page - Name of page to switch to
      force - true to force a redisplay even if the page hasn't changed; false otherwise.
      See Also:
    • showWizardPage

      public void showWizardPage(int index, boolean force)
      Switches the wizard to the page having the passed-in index. Fires a vetoable change event before attempting the page change. If it's not vetoed, a property change event is fired. Local vetoable change and property change support is used. The property used is PAGE_SWITCH.
      Parameters:
      index - Index of page to switch to
      force - true to force a redisplay even if the page hasn't changed; false otherwise
      See Also:
    • setPageEnabled

      public void setPageEnabled(Component p, boolean b)
      Enables or disables the passed-in page and its navigator button if the navigator is present. Does nothing if p is the currently selected page.
      Parameters:
      p - The page whose button is to be enabled or disabled.
      b - true to attempt to enable the page and button; false to attempt to disable them.
    • processFinish

      public void processFinish()
      Finishes wizard processing. Fires a vetoable change event and if it's not vetoed, a property change event is then fired. Local vetoable change and property change support is used. The property used is FINISH.
      See Also:
    • processCancel

      public void processCancel()
      Cancels wizard processing. Fires a vetoable change event and if it's not vetoed, a property change event is then fired. Local vetoable change and property change support is used. The property used is CANCEL.
      See Also:
    • processHelp

      public void processHelp(ActionEvent e)
      Displays wizard help.
    • getPageCount

      public int getPageCount()
      Returns the total number of pages in the wizard
    • getPageAt

      public Component getPageAt(int i)
      For the given index, retrieves the associated page
      Parameters:
      i - The index to look up
      Returns:
      The component found or null if not found
    • pageToIndex

      public int pageToIndex(Component c)
      For the given page, retrieves the associated index.
      Parameters:
      c - The page to look up
      Returns:
      The index of the page found or -1 if not found
    • getVisiblePage

      public Component getVisiblePage()
      Retrieves the currently visible page
      Returns:
      The component found or null if not found
    • getVisiblePageIndex

      public int getVisiblePageIndex()
      Retrieves the index of the currently visible page
      Returns:
      The index of the currently visible page
    • updateWizardControls

      public void updateWizardControls()
      Updates the wizard controls
    • addPageSwitchListener

      protected void addPageSwitchListener(PropertyChangeListener p)
      Registers the given listener so that it receives a PAGE_SWITCH PropertyChangeEvent event when a page switch has occurred.
      Parameters:
      p - The listener
    • removePageSwitchListener

      protected void removePageSwitchListener(PropertyChangeListener p)
      Removes the PropertyChangeListener for the PAGE_SWITCH property.
      Parameters:
      p - The listener
    • addPageSwitchVetoableListener

      protected void addPageSwitchVetoableListener(VetoableChangeListener v)
      Registers the given listener so that it receives a PAGE_SWITCH VetoableChangeEvent before a page switch occurs.
      Parameters:
      v - The VetoableChangeListener
    • removePageSwitchVetoableListener

      protected void removePageSwitchVetoableListener(VetoableChangeListener v)
      Removes the VetoableChangeListener for the PAGE_SWITCH property
      Parameters:
      v - The listener
    • addCancelListener

      protected void addCancelListener(PropertyChangeListener p)
      Registers the given listener so that it receives a CANCEL PropertyChangeEvent event when a cancel has occurred
      Parameters:
      p - The listener
    • removeCancelListener

      protected void removeCancelListener(PropertyChangeListener p)
      Removes the PropertyChangeListener for the CANCEL property
      Parameters:
      p - The listener
    • addCancelVetoableListener

      protected void addCancelVetoableListener(VetoableChangeListener v)
      Registers the given listener so that it receives a CANCEL VetoableChangeEvent before a cancel occurs
      Parameters:
      v - The VetoableChangeListener
    • removeCancelVetoableListener

      protected void removeCancelVetoableListener(VetoableChangeListener v)
      Removes the VetoableChangeListener for the CANCEL property
      Parameters:
      v - The listener
    • addFinishListener

      protected void addFinishListener(PropertyChangeListener p)
      Registers the given listener so that it receives a FINISH PropertyChangeEvent event when a finish has occurred
      Parameters:
      p - The listener
    • removeFinishListener

      protected void removeFinishListener(PropertyChangeListener p)
      Removes the PropertyChangeListener for the FINISH property
      Parameters:
      p - The listener
    • addFinishVetoableListener

      protected void addFinishVetoableListener(VetoableChangeListener v)
      Registers the given listener so that it receives a FINISH VetoableChangeEvent before a finish occurs
      Parameters:
      v - The VetoableChangeListener
    • removeFinishVetoableListener

      protected void removeFinishVetoableListener(VetoableChangeListener v)
      Removes the VetoableChangeListener for the FINISH property
      Parameters:
      v - The listener
    • addHelpListener

      protected void addHelpListener(PropertyChangeListener p)
      Registers the given listener so that it receives a HELP PropertyChangeEvent event when a cancel has occurred
      Parameters:
      p - The listener
    • removeHelpListener

      protected void removeHelpListener(PropertyChangeListener p)
      Removes the PropertyChangeListener for the HELP property
      Parameters:
      p - The listener