Class AbstractWizardModel

  • All Implemented Interfaces:
    WizardModel
    Direct Known Subclasses:
    DefaultWizardModel

    public abstract class AbstractWizardModel
    extends java.lang.Object
    implements WizardModel
    An abstract base class for wizard models. This base class provides all the functionality required by a wizard model except for WizardModel.getPageOrder(). Because the implementations of the other methods must call getPageOrder(), subclasses that do not represent the page order internally as an array should consider caching the getPageOrder() for performance reasons.
    Since:
    3.0
    Author:
    Chris Jennings
    • Field Detail

      • blocked

        protected boolean blocked
      • curPage

        protected int curPage
    • Constructor Detail

      • AbstractWizardModel

        public AbstractWizardModel()
    • Method Detail

      • canFinish

        public boolean canFinish()
        Description copied from interface: WizardModel
        Returns true if the wizard can be finished in its current state. This method must always return false when progress is blocked.
        Specified by:
        canFinish in interface WizardModel
        Returns:
        whether the finish button should be enabled
        See Also:
        WizardModel.isProgressBlocked()
      • canGoBackward

        public boolean canGoBackward()
        Description copied from interface: WizardModel
        Returns true if there is a page before the current page.
        Specified by:
        canGoBackward in interface WizardModel
        Returns:
        whether the previous button should be enabled
      • canGoForward

        public boolean canGoForward()
        Description copied from interface: WizardModel
        Returns true if there is a page after the current page. This method must always return false when progress is blocked.
        Specified by:
        canGoForward in interface WizardModel
        Returns:
        whether the next button should be enabled
        See Also:
        WizardModel.isProgressBlocked()
      • checkPages

        protected void checkPages()
      • finish

        public java.lang.Object finish()
        Description copied from interface: WizardModel
        Completes the wizard, causing any relevant actions to take place. It may optionally return an arbitrary object to represent this result.
        Specified by:
        finish in interface WizardModel
        Returns:
        an optional result, or null
        See Also:
        WizardModel.canFinish()
      • fireBlockStateChanged

        protected void fireBlockStateChanged()
      • fireFinished

        protected void fireFinished()
      • fireHidingPage

        protected void fireHidingPage​(int oldPage,
                                      javax.swing.JComponent page)
      • firePageChanged

        protected void firePageChanged​(int newPage,
                                       javax.swing.JComponent page)
      • firePageOrderChanged

        protected void firePageOrderChanged()
      • fireReset

        protected void fireReset()
      • fireShowingPage

        protected void fireShowingPage​(int newPage,
                                       javax.swing.JComponent page)
      • getPageCount

        public int getPageCount()
        Description copied from interface: WizardModel
        Returns the number of pages in the current set of pages.
        Specified by:
        getPageCount in interface WizardModel
        Returns:
        the number of pages in the wizard
      • isProgressBlocked

        public boolean isProgressBlocked()
        Description copied from interface: WizardModel
        Returns true if progress is currently blocked.
        Specified by:
        isProgressBlocked in interface WizardModel
        Returns:
        true if the user is blocked from continuing
      • removeWizardListener

        public void removeWizardListener​(WizardListener li)
        Description copied from interface: WizardModel
        Removes a listener from the list of listeners so that it no longer receives WizardEvents from the model.
        Specified by:
        removeWizardListener in interface WizardModel
        Parameters:
        li - the listener to removes
      • reset

        public void reset()
        Description copied from interface: WizardModel
        Resets the model. This is called when the model is installed in a dialog. It allows the model to be reused in multiple dialogs. This will reset the current page to its initial value and will typically reset the interface components that represent the wizard pages to an initial state. (Alternatively, any existing page components may be thrown out and a new set created.)
        Specified by:
        reset in interface WizardModel
      • setCurrentPage

        public void setCurrentPage​(int index)
        Description copied from interface: WizardModel
        Sets the current page of the internal model.
        Specified by:
        setCurrentPage in interface WizardModel
        Parameters:
        index - the new page index
      • getCurrentPageComponent

        public javax.swing.JComponent getCurrentPageComponent()
      • setProgressBlocked

        public void setProgressBlocked​(boolean block)
        Description copied from interface: WizardModel
        Sets whether or not progress is blocked. When progress is blocked, WizardModel.canGoForward() and WizardModel.canFinish() must always return false. The progress blocking state can be cleared by calling this method with false, and is cleared automatically if the page changes. Blocking provides a mechanism for individual pages to prevent progress if they are missing required information.
        Specified by:
        setProgressBlocked in interface WizardModel
        Parameters:
        block - if true, prevents the user from going to the next page or finishing the dialog.