org.openoffice.ide.eclipse.core.wizards.utils
Class WizardPageSet

java.lang.Object
  extended by org.openoffice.ide.eclipse.core.wizards.utils.WizardPageSet
Direct Known Subclasses:
ServiceWizardSet

public abstract class WizardPageSet
extends java.lang.Object

A wizard page set is a subset of a wizard which should be reused by several wizards.

Author:
cedricbosdo

Field Summary
protected  boolean mChangingPages
           
protected  IPageListener mPageListener
          Listener to use to listen for any page change which impacts the wizard set contained pages.
protected  org.eclipse.jface.wizard.IWizard mWizard
          Reference to the wizard containing the pages.
 
Constructor Summary
WizardPageSet(org.eclipse.jface.wizard.IWizard pWizard)
          Constructor.
 
Method Summary
 void addPage(org.eclipse.jface.wizard.IWizardPage pPage)
          Add the pages into a list in order to store them.
protected abstract  void dataChanged(UnoFactoryData pDelta)
          This method has to be called to ask the pages contained in the set to be updated with new external data.
abstract  void doFinish(org.eclipse.core.runtime.IProgressMonitor pMonitor, org.eclipse.ui.IWorkbenchPage pActivePage)
          Performs the actions to run at the end of the wizard for the wizard set.
 org.eclipse.jface.wizard.IWizardPage getNextPage(org.eclipse.jface.wizard.IWizardPage pCurrentPage)
          Get the visible page to show after a page.
 org.eclipse.jface.wizard.IWizardPage getPage(java.lang.String pName)
          Returns the page with the given name.
 org.eclipse.jface.wizard.IWizardPage[] getPages()
          Get an array of the contained pages.
 org.eclipse.jface.wizard.IWizardPage getPreviousPage(org.eclipse.jface.wizard.IWizardPage pCurrentPage)
          Get the visible page to show before a page.
abstract  void initialize(UnoFactoryData pData)
          Initializes the wizard pages with default data.
 void setHidden(org.eclipse.jface.wizard.IWizardPage pPage, boolean pHidden)
          Set a page as hidden in the wizard.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mChangingPages

protected boolean mChangingPages

mPageListener

protected IPageListener mPageListener
Listener to use to listen for any page change which impacts the wizard set contained pages.


mWizard

protected org.eclipse.jface.wizard.IWizard mWizard
Reference to the wizard containing the pages. This reference has to be set before adding pages

Constructor Detail

WizardPageSet

public WizardPageSet(org.eclipse.jface.wizard.IWizard pWizard)
Constructor.

Parameters:
pWizard - the wizard containing the wizard set.
Method Detail

getPage

public org.eclipse.jface.wizard.IWizardPage getPage(java.lang.String pName)
Returns the page with the given name.

Parameters:
pName - the name of the page to look for
Returns:
the page found or null if none has been found.

addPage

public void addPage(org.eclipse.jface.wizard.IWizardPage pPage)
Add the pages into a list in order to store them.

The order in which they had been added will be the order in which they will be show in the wizard. By default all the added pages are visible.

Note that the pages are not added into the wizard. This one has to add all the set pages using the getNextPage(IWizardPage) method.

Parameters:
pPage - the page to add.

getPages

public org.eclipse.jface.wizard.IWizardPage[] getPages()
Get an array of the contained pages.

This method doesn't care whether the pages are visible or not.

Returns:
the contained pages

setHidden

public void setHidden(org.eclipse.jface.wizard.IWizardPage pPage,
                      boolean pHidden)
Set a page as hidden in the wizard.

This method defines whether a page of the wizard set should be shown or not. Be aware that the page are created even if they aren't shown.

This method has no effect if the page is not contained in the wizard set. Otherwise the page will simply not be taken into consideration in the wizard.

Parameters:
pPage - the page to hide
pHidden - true to hide the page, false otherwise

getNextPage

public org.eclipse.jface.wizard.IWizardPage getNextPage(org.eclipse.jface.wizard.IWizardPage pCurrentPage)
                                                 throws NoSuchPageException
Get the visible page to show after a page.

The next page is determined by the order in which it has been added in the wizard set. The first non-hidden page added after the current page will be returned.

The wizard should use this method to find the next page instead of the normal one.

Here is a sample replacement of the normal method in the wizard:

 public IWizardPage getNextPage(IWizardPage page) {
     IWizardPage next = null;
    try {
        next = wizardSet.getNextPage(page);
    } catch (NoSuchPageException e) {
        // Return the default next page if the page is not in the wizard set. 
        next = super.getNextPage(page);
    }
    
    return next;
 }

Parameters:
pCurrentPage - the page after which is the next page
Returns:
the next page or null if the current page is the last one.
Throws:
NoSuchPageException - is thrown if the page isn't contained in the wizard set.
See Also:
for more informations on hidden pages in the wizard set.

getPreviousPage

public org.eclipse.jface.wizard.IWizardPage getPreviousPage(org.eclipse.jface.wizard.IWizardPage pCurrentPage)
                                                     throws NoSuchPageException
Get the visible page to show before a page.

The previous page is determined by the order in which it has been added in the wizard set. The last non-hidden page added before the current page will be returned.

The wizard should use this method to find the previous page instead of the normal one.

Here is a sample replacement of the normal method in the wizard:

 public IWizardPage getPreviousPage(IWizardPage page) {
    IWizardPage previous = null;
    try {
        previous = wizardSet.getPreviousPage(page);
    } catch (NoSuchPageException e) {
        // Return the default previous page if the page is not in the
        // wizard set. 
        previous = super.getPreviousPage(page);
    }
    
    return previous;
 }
 

Parameters:
pCurrentPage - the page before which is the previous page
Returns:
the previous page or null if the current page is the first one.
Throws:
NoSuchPageException - is thrown if the page isn't contained in the wizard set.
See Also:
for more informations on hidden pages in the wizard set.

initialize

public abstract void initialize(UnoFactoryData pData)
Initializes the wizard pages with default data.

This method should set all the correct data in the pages supposing nothing has already been entered.

This method should be overridden by the subclasses. The default method doesn't perform any action.

Parameters:
pData - the data describing the default/initial values of the pages

doFinish

public abstract void doFinish(org.eclipse.core.runtime.IProgressMonitor pMonitor,
                              org.eclipse.ui.IWorkbenchPage pActivePage)
Performs the actions to run at the end of the wizard for the wizard set.

Performs the changes needed by the wizard set. This method has to be called in the IWizard.performFinish() method. For cleaner actions the actions performed by the wizard set finish should concern only the data defined by the wizard set pages.

The active page is often needed by the UnoFactory to open a newly created file in the workbench.

This method should be overridden by the subclasses. The default method doesn't perform any action.

Parameters:
pMonitor - the monitor used to follow the finish process.
pActivePage - the page that was active before opening the wizard.
See Also:
for more informations on actions performed when finishing a wizard.

dataChanged

protected abstract void dataChanged(UnoFactoryData pDelta)
This method has to be called to ask the pages contained in the set to be updated with new external data.

This method should be overridden by the subclasses. The default method doesn't perform any action.

Parameters:
pDelta - the data delta of the changed page.