net.refractions.udig.ui.dialogs
Class WizardDataTransferPage

java.lang.Object
  extended by WizardPage
      extended by net.refractions.udig.ui.dialogs.WizardDataTransferPage

public abstract class WizardDataTransferPage
extends WizardPage

The common superclass for wizard import and export pages.

This class is taken from org.eclipse.ide - WizardDataTransferPage.


Field Summary
protected static int COMBO_HISTORY_LENGTH
           
protected static int SIZING_TEXT_FIELD_WIDTH
           
 
Constructor Summary
protected WizardDataTransferPage(java.lang.String pageName)
          Creates a new wizard page.
 
Method Summary
protected  void addToHistory(java.util.List history, java.lang.String newEntry)
          Adds an entry to a history, while taking care of duplicate history items and excessively long histories.
protected  java.lang.String[] addToHistory(java.lang.String[] history, java.lang.String newEntry)
          Adds an entry to a history, while taking care of duplicate history items and excessively long histories.
protected  Label createBoldLabel(Composite parent, java.lang.String text)
          Creates a new label with a bold font.
protected  void createOptionsGroup(Composite parent)
          Create the options specification widgets.
protected  void createOptionsGroupButtons(Group optionsGroup)
          Creates the import/export options group controls.
protected  Label createPlainLabel(Composite parent, java.lang.String text)
          Creates a new label with a bold font.
protected  void createSpacer(Composite parent)
          Creates a horizontal spacer line that fills the width of its container.
protected  boolean determinePageCompletion()
          Returns whether this page is complete.
protected  void displayErrorDialog(java.lang.String message)
          Display an error dialog with the specified message.
protected  void displayErrorDialog(java.lang.Throwable exception)
          Display an error dislog with the information from the supplied exception.
protected  java.lang.String getErrorDialogTitle()
          Get the title for an error dialog.
protected  IPath getPathFromText(Text textField)
          Get a path from the supplied text widget.
protected  IMap queryForMap(IMap initialSelection, java.lang.String msg)
          Queries the user to supply a Map.
protected  IMap queryForMap(IMap initialSelection, java.lang.String msg, java.lang.String title)
          Queries the user to supply a container resource.
protected  boolean queryYesNoQuestion(java.lang.String message)
          Displays a Yes/No question to the user with the specified message and returns the user's response.
protected  void restoreWidgetValues()
          Restores control settings that were saved in the previous instance of this page.
protected  void saveWidgetValues()
          Saves control settings that are to be restored in the next instance of this page.
protected  void updatePageCompletion()
          Determine if the page is complete and update the page appropriately.
protected  void updateWidgetEnablements()
          Updates the enable state of this page's controls.
protected  boolean validateDestinationGroup()
          Returns whether this page's destination specification controls currently all contain valid values.
protected  boolean validateOptionsGroup()
          Returns whether this page's options group's controls currently all contain valid values.
protected  boolean validateSourceGroup()
          Returns whether this page's source specification controls currently all contain valid values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SIZING_TEXT_FIELD_WIDTH

protected static final int SIZING_TEXT_FIELD_WIDTH
See Also:
Constant Field Values

COMBO_HISTORY_LENGTH

protected static final int COMBO_HISTORY_LENGTH
See Also:
Constant Field Values
Constructor Detail

WizardDataTransferPage

protected WizardDataTransferPage(java.lang.String pageName)
Creates a new wizard page.

Parameters:
pageName - the name of the page
Method Detail

addToHistory

protected java.lang.String[] addToHistory(java.lang.String[] history,
                                          java.lang.String newEntry)
Adds an entry to a history, while taking care of duplicate history items and excessively long histories. The assumption is made that all histories should be of length WizardDataTransferPage.COMBO_HISTORY_LENGTH.

Parameters:
history - the current history
newEntry - the entry to add to the history

addToHistory

protected void addToHistory(java.util.List history,
                            java.lang.String newEntry)
Adds an entry to a history, while taking care of duplicate history items and excessively long histories. The assumption is made that all histories should be of length WizardDataTransferPage.COMBO_HISTORY_LENGTH.

Parameters:
history - the current history
newEntry - the entry to add to the history

createBoldLabel

protected Label createBoldLabel(Composite parent,
                                java.lang.String text)
Creates a new label with a bold font.

Parameters:
parent - the parent control
text - the label text
Returns:
the new label control

createOptionsGroupButtons

protected void createOptionsGroupButtons(Group optionsGroup)
Creates the import/export options group controls.

The WizardDataTransferPage implementation of this method does nothing. Subclasses wishing to define such components should reimplement this hook method.

Parameters:
optionsGroup - the parent control

createPlainLabel

protected Label createPlainLabel(Composite parent,
                                 java.lang.String text)
Creates a new label with a bold font.

Parameters:
parent - the parent control
text - the label text
Returns:
the new label control

createSpacer

protected void createSpacer(Composite parent)
Creates a horizontal spacer line that fills the width of its container.

Parameters:
parent - the parent control

determinePageCompletion

protected boolean determinePageCompletion()
Returns whether this page is complete. This determination is made based upon the current contents of this page's controls. Subclasses wishing to include their controls in this determination should override the hook methods validateSourceGroup and/or validateOptionsGroup.

Returns:
true if this page is complete, and false if incomplete
See Also:
validateSourceGroup(), validateOptionsGroup()

getPathFromText

protected IPath getPathFromText(Text textField)
Get a path from the supplied text widget.

Returns:
org.eclipse.core.runtime.IPath

queryForMap

protected IMap queryForMap(IMap initialSelection,
                           java.lang.String msg)
Queries the user to supply a Map.

Returns:
the path to an existing or new container, or null if the user cancelled the dialog

queryForMap

protected IMap queryForMap(IMap initialSelection,
                           java.lang.String msg,
                           java.lang.String title)
Queries the user to supply a container resource.

Returns:
the path to an existing or new container, or null if the user cancelled the dialog

queryYesNoQuestion

protected boolean queryYesNoQuestion(java.lang.String message)
Displays a Yes/No question to the user with the specified message and returns the user's response.

Parameters:
message - the question to ask
Returns:
true for Yes, and false for No

restoreWidgetValues

protected void restoreWidgetValues()
Restores control settings that were saved in the previous instance of this page.

The WizardDataTransferPage implementation of this method does nothing. Subclasses may override this hook method.


saveWidgetValues

protected void saveWidgetValues()
Saves control settings that are to be restored in the next instance of this page.

The WizardDataTransferPage implementation of this method does nothing. Subclasses may override this hook method.


updatePageCompletion

protected void updatePageCompletion()
Determine if the page is complete and update the page appropriately.


updateWidgetEnablements

protected void updateWidgetEnablements()
Updates the enable state of this page's controls.

The WizardDataTransferPage implementation of this method does nothing. Subclasses may extend this hook method.


validateDestinationGroup

protected boolean validateDestinationGroup()
Returns whether this page's destination specification controls currently all contain valid values.

The WizardDataTransferPage implementation of this method returns true. Subclasses may reimplement this hook method.

Returns:
true indicating validity of all controls in the destination specification group

validateOptionsGroup

protected boolean validateOptionsGroup()
Returns whether this page's options group's controls currently all contain valid values.

The WizardDataTransferPage implementation of this method returns true. Subclasses may reimplement this hook method.

Returns:
true indicating validity of all controls in the options group

validateSourceGroup

protected boolean validateSourceGroup()
Returns whether this page's source specification controls currently all contain valid values.

The WizardDataTransferPage implementation of this method returns true. Subclasses may reimplement this hook method.

Returns:
true indicating validity of all controls in the source specification group

createOptionsGroup

protected void createOptionsGroup(Composite parent)
Create the options specification widgets.

Parameters:
parent - org.eclipse.swt.widgets.Composite

displayErrorDialog

protected void displayErrorDialog(java.lang.String message)
Display an error dialog with the specified message.

Parameters:
message - the error message

displayErrorDialog

protected void displayErrorDialog(java.lang.Throwable exception)
Display an error dislog with the information from the supplied exception.

Parameters:
exception - Throwable

getErrorDialogTitle

protected java.lang.String getErrorDialogTitle()
Get the title for an error dialog. Subclasses should override.