com.ibm.commons.swt.data.dialog
Class LWPDCommonDialog

java.lang.Object
  extended by org.eclipse.jface.window.Window
      extended by org.eclipse.jface.dialogs.Dialog
          extended by org.eclipse.jface.dialogs.TrayDialog
              extended by org.eclipse.jface.dialogs.TitleAreaDialog
                  extended by com.ibm.commons.swt.data.dialog.LWPDCommonDialog
All Implemented Interfaces:
org.eclipse.jface.window.IShellProvider
Direct Known Subclasses:
LWPDNoTitleAreaDialog, LWPDOnePageDialog, MultilineTextEditor.InputDialog, SimpleDialog

public abstract class LWPDCommonDialog
extends org.eclipse.jface.dialogs.TitleAreaDialog

A common base dialog used for most Domino Designer dialogs. This dialog contains a title area for info/warning/error messages. The dialog may optionally have a progress bar embedded.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.jface.window.Window
org.eclipse.jface.window.Window.IExceptionHandler
 
Field Summary
protected  boolean _bDialogWidgetInitialized
           
protected  boolean _bSetFocusControl
           
protected  boolean useEclipseDialog
           
 
Fields inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
DLG_IMG_TITLE_BANNER, DLG_IMG_TITLE_ERROR, INFO_MESSAGE, WARNING_MESSAGE
 
Fields inherited from class org.eclipse.jface.dialogs.Dialog
blockedHandler, buttonBar, DIALOG_DEFAULT_BOUNDS, DIALOG_PERSISTLOCATION, DIALOG_PERSISTSIZE, dialogArea, DLG_IMG_ERROR, DLG_IMG_HELP, DLG_IMG_INFO, DLG_IMG_MESSAGE_ERROR, DLG_IMG_MESSAGE_INFO, DLG_IMG_MESSAGE_WARNING, DLG_IMG_QUESTION, DLG_IMG_WARNING, ELLIPSIS
 
Fields inherited from class org.eclipse.jface.window.Window
CANCEL, OK
 
Constructor Summary
LWPDCommonDialog(org.eclipse.swt.widgets.Shell parentShell)
          Constructs a new instance of this class.
 
Method Summary
protected  org.eclipse.core.runtime.IProgressMonitor attachProgressMonitor()
          Attaches the progress monitor to the dialog.
 boolean close()
           
protected  void configureShell(org.eclipse.swt.widgets.Shell newShell)
          Configures the Shell in which the dialog will reside.
protected  org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Layout createContainerLayout()
          Creates a GridLayout with two columns.
protected  org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
           
protected  org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
           
protected  TitleAreaComposite createTitleAreaComposite(org.eclipse.swt.widgets.Composite parent)
          Subclass may override if a title area control is not desirable.
protected  void detachProgressMonitor()
          Removes the progress monitor widget from the dialog.
protected  boolean doPerformDialog()
          Calls the abstract method performDialogOperation(IProgressMonitor).
protected abstract  void fillClientArea(org.eclipse.swt.widgets.Composite parent)
          Consummers implement this function to provide their content
protected  org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings()
          Subclasses should override this method to return the dialog settings associated with the current plugin
protected  int getDialogBoundsStrategy()
          Dialogs should override to set whether they want the size/location of the dialog to be persisted.
protected  java.lang.String getDialogTitle()
          Returns the title of the dialog.
protected  org.eclipse.swt.graphics.Image getTitleImage()
          Returns an image to be displayed in the title area of the dialog.
protected  org.eclipse.jface.resource.ImageDescriptor getTitleImageDescriptor()
          Returns an image descriptor which will be displayed in the title area of the dialog.
 UIUpdater getUpdater()
          Returns a UIUpdater that is called periodically (frequently) to update various parts of the dialog.
protected  org.eclipse.ui.IWorkbench getWorkbench()
          Returns the active workbench
protected  void initMainPanel()
          Subclass may override, does nothing by default.
protected  void invalidateDialog(java.lang.String message)
          Helper method that invalidates the dialog.
 boolean isDirty()
          Returns whether or not any of the controls within the dialog have been modified.
protected  boolean isModal()
           
protected  boolean needsProgressMonitor()
          Indicates to the dialog creation code that a progress monitor should be added to the UI and be made visible.
protected  void okPressed()
           
 int open()
           
protected abstract  boolean performDialogOperation(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          An abstract method that gets called when the OK button is pressed on the dialog.
 void refreshTitleArea()
          Refreshes the layout of the title area
 void setBlockOnOpen(boolean shouldBlock)
          no-op..
protected  void setClassDef(IClassDef classDef)
          If this dialog is bound to data (i.e.
protected  void setDataChangeNotifier(DataChangeNotifier dataChangeNotifier)
          Adds a listener to the data model that gets notified of changes to the model.
protected  void setDataProvider(IObjectCollection objectCollection)
          If this dialog is bound to data then this method must be called to set up the data provider.
 void setDirty(boolean bSet)
          Sets whether or not any of the controls in the dialog have been modified.
 void setErrorMessage(java.lang.String errorMessage)
          Sets an error message in the title area of the dialog
 void setMessage(java.lang.String newMessage, int newType)
           
 void setUpdater(UIUpdater updater)
          Sets the UIUpdater that is responsible for updating various parts of the dialog.
protected  boolean useScrollableContents()
          By default all dialogs subclassing this base class will use a scrollable composite for the main dialog contents.
protected  void validateDialog()
          Provide dialog validation for the contents of the dialog.
 
Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
getInitialSize, getTitleArea, getTitleImageLabel, setMessage, setTitle, setTitleAreaColor, setTitleImage
 
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
closeTray, createHelpControl, getLayout, getTray, isDialogHelpAvailable, isHelpAvailable, openTray, setDialogHelpAvailable, setHelpAvailable
 
Methods inherited from class org.eclipse.jface.dialogs.Dialog
applyDialogFont, buttonPressed, cancelPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, createButtonsForButtonBar, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class org.eclipse.jface.window.Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

useEclipseDialog

protected boolean useEclipseDialog

_bDialogWidgetInitialized

protected boolean _bDialogWidgetInitialized

_bSetFocusControl

protected boolean _bSetFocusControl
Constructor Detail

LWPDCommonDialog

public LWPDCommonDialog(org.eclipse.swt.widgets.Shell parentShell)
Constructs a new instance of this class.

Parameters:
parentShell - the parent shell to be used to construct this dialog
Method Detail

getUpdater

public UIUpdater getUpdater()
Returns a UIUpdater that is called periodically (frequently) to update various parts of the dialog.

Returns:

setUpdater

public void setUpdater(UIUpdater updater)
Sets the UIUpdater that is responsible for updating various parts of the dialog.

Parameters:
updater -

isModal

protected boolean isModal()
Returns:

getTitleImage

protected org.eclipse.swt.graphics.Image getTitleImage()
Returns an image to be displayed in the title area of the dialog.

Returns:

getTitleImageDescriptor

protected org.eclipse.jface.resource.ImageDescriptor getTitleImageDescriptor()
Returns an image descriptor which will be displayed in the title area of the dialog.

Returns:
the image descriptor for the this dialog

close

public boolean close()
Overrides:
close in class org.eclipse.jface.dialogs.TrayDialog

configureShell

protected void configureShell(org.eclipse.swt.widgets.Shell newShell)
Configures the Shell in which the dialog will reside. It is in this method that attributes such as the shell image is set.

Overrides:
configureShell in class org.eclipse.jface.window.Window

getDialogTitle

protected java.lang.String getDialogTitle()
Returns the title of the dialog. Subclasses should override this method.

Returns:
the title of the dialog

createContainerLayout

protected org.eclipse.swt.widgets.Layout createContainerLayout()
Creates a GridLayout with two columns. Subclasses may override this method to obtain a different dialog layout. Please note the layout returned is used as the initial layout for the composite supplied by fillClientArea(Composite).

Returns:
by default returns a GridLayout object.

fillClientArea

protected abstract void fillClientArea(org.eclipse.swt.widgets.Composite parent)
Consummers implement this function to provide their content

Parameters:
parent - the parent composite

needsProgressMonitor

protected boolean needsProgressMonitor()
Indicates to the dialog creation code that a progress monitor should be added to the UI and be made visible. The progress monitor may then be used to provide feedback to the user. Clients wishing to make use of the progress monitor must override needsProgressMonitor().

Returns:
true by default. Clients should override if custom behavior is desired

validateDialog

protected void validateDialog()
Provide dialog validation for the contents of the dialog. Subclasses can override, but should call super when there is no error. If an error is found invalidateDialog(String) should be called.


invalidateDialog

protected void invalidateDialog(java.lang.String message)
Helper method that invalidates the dialog. The dialog will be put in an 'error state' whereby the OK button is disabled and the message supplied via message will be displayed as the error message for the dialog.

Parameters:
message - the error message to be displayed

setErrorMessage

public void setErrorMessage(java.lang.String errorMessage)
Sets an error message in the title area of the dialog

Overrides:
setErrorMessage in class org.eclipse.jface.dialogs.TitleAreaDialog
Parameters:
errorMessage - an error message

isDirty

public boolean isDirty()
Returns whether or not any of the controls within the dialog have been modified. Validation will (should) only occur after the user starts editing controls.

Returns:
true if a control has been modified

setDirty

public void setDirty(boolean bSet)
Sets whether or not any of the controls in the dialog have been modified.

Parameters:
bSet - true if a control has been modified

setMessage

public void setMessage(java.lang.String newMessage,
                       int newType)
Overrides:
setMessage in class org.eclipse.jface.dialogs.TitleAreaDialog

useScrollableContents

protected boolean useScrollableContents()
By default all dialogs subclassing this base class will use a scrollable composite for the main dialog contents. If a subclass wishes not utilize a top level scrollable, they should override this method.

Returns:
true by default

createContents

protected org.eclipse.swt.widgets.Control createContents(org.eclipse.swt.widgets.Composite parent)
Overrides:
createContents in class org.eclipse.jface.dialogs.TitleAreaDialog

createTitleAreaComposite

protected TitleAreaComposite createTitleAreaComposite(org.eclipse.swt.widgets.Composite parent)
Subclass may override if a title area control is not desirable.

Parameters:
parent - the parent Composite

createDialogArea

protected final org.eclipse.swt.widgets.Control createDialogArea(org.eclipse.swt.widgets.Composite parent)
Overrides:
createDialogArea in class org.eclipse.jface.dialogs.TitleAreaDialog

createButtonBar

protected org.eclipse.swt.widgets.Control createButtonBar(org.eclipse.swt.widgets.Composite parent)
Overrides:
createButtonBar in class org.eclipse.jface.dialogs.TrayDialog

initMainPanel

protected void initMainPanel()
Subclass may override, does nothing by default. Called by the createDialogArea(Composite) method. Allows for variable initialization to occur before the contents of the dialog are created.


setBlockOnOpen

public void setBlockOnOpen(boolean shouldBlock)
no-op.. The default implementation of this dialog has overwritten this method such that setBlockOnOpen is always set to false.

Overrides:
setBlockOnOpen in class org.eclipse.jface.window.Window

open

public int open()
Overrides:
open in class org.eclipse.jface.window.Window

okPressed

protected void okPressed()
Overrides:
okPressed in class org.eclipse.jface.dialogs.Dialog

doPerformDialog

protected boolean doPerformDialog()
Calls the abstract method performDialogOperation(IProgressMonitor). Must return true in order for the dialog to be dismissed.

Returns:
false if the dialog should not be dismissed

detachProgressMonitor

protected void detachProgressMonitor()
Removes the progress monitor widget from the dialog.


attachProgressMonitor

protected org.eclipse.core.runtime.IProgressMonitor attachProgressMonitor()
Attaches the progress monitor to the dialog.

Returns:

performDialogOperation

protected abstract boolean performDialogOperation(org.eclipse.core.runtime.IProgressMonitor progressMonitor)
An abstract method that gets called when the OK button is pressed on the dialog. If the client wishes to provide progress feedback to the user the supplied progress monitor may be used.
needsProgressMonitor() must return true in order for the progress monitor is visible.

Parameters:
progressMonitor - the progress monitor that is to be used to provide progress feedback to the user
Returns:
true if operation succeeds and the dialog is to be dismissed. Returning false will cause the dialog to remain open.

getWorkbench

protected org.eclipse.ui.IWorkbench getWorkbench()
Returns the active workbench

Returns:
a utility method for calling PlatformUI.getWorkbench().

setClassDef

protected void setClassDef(IClassDef classDef)
If this dialog is bound to data (i.e. has a DataNode), then the corresponding IClassDef may be set via this method.

Parameters:
classDef -
See Also:
IClassDef

setDataProvider

protected void setDataProvider(IObjectCollection objectCollection)
If this dialog is bound to data then this method must be called to set up the data provider.

Parameters:
objectCollection - an object collection to be used in conjunction with the DC* controls in the dialog.
See Also:
IObjectCollection, IDataFieldControl

setDataChangeNotifier

protected void setDataChangeNotifier(DataChangeNotifier dataChangeNotifier)
Adds a listener to the data model that gets notified of changes to the model.

Parameters:
dataChangeNotifier - a notifier that listens for data events
See Also:
DataNode, DataNode.setDataChangeNotifier(DataChangeNotifier), DataChangeNotifier

getDialogBoundsSettings

protected org.eclipse.jface.dialogs.IDialogSettings getDialogBoundsSettings()
Subclasses should override this method to return the dialog settings associated with the current plugin

Overrides:
getDialogBoundsSettings in class org.eclipse.jface.dialogs.Dialog
Returns:
the dialog settings of the current plugin

getDialogBoundsStrategy

protected int getDialogBoundsStrategy()
Dialogs should override to set whether they want the size/location of the dialog to be persisted.

Overrides:
getDialogBoundsStrategy in class org.eclipse.jface.dialogs.Dialog
Returns:
returns 0 by default

refreshTitleArea

public void refreshTitleArea()
Refreshes the layout of the title area