net.sourceforge.java.feednread.frontend.dialog
Class AutoCloseConfirmationDialog

java.lang.Object
  extended byorg.eclipse.jface.window.Window
      extended byorg.eclipse.jface.dialogs.Dialog
          extended byorg.eclipse.jface.dialogs.TrayDialog
              extended byorg.eclipse.jface.dialogs.TitleAreaDialog
                  extended bynet.sourceforge.java.feednread.frontend.dialog.AutoCloseConfirmationDialog
All Implemented Interfaces:
IShellProvider

public class AutoCloseConfirmationDialog
extends TitleAreaDialog

Dialog capable of displaying an information message along with a confirmation Button (OK) which closes itself after a predefined time span if the end-user does not close the dialog before this time span elapses. The Time begins to run once the open() method is called.

Author:
Sebastian Machhausen

Nested Class Summary
 
Nested classes inherited from class org.eclipse.jface.window.Window
Window.IExceptionHandler
 
Field Summary
private  Image dialogImage
           The Image to display in this AutoCloseConfirmationDialog Shell title.
private  String dialogTitle
           The title of this AutoCloseConfirmationDialog
private  String message
           The message to display
private  int secondsToClose
           The number of seconds after which this AutoCloseConfirmationDialog closes automatically.
 
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.TrayDialog
 
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
AutoCloseConfirmationDialog(Shell parentShell, String dialogTitle, String headerText, String headerSubText, String message, Image dialogImage, Image headerImage, int secondsToClose)
           Creates a new AutoCloseConfirmationDialog instance.
 
Method Summary
protected  void configureShell(Shell newShell)
           Configures the given Shell in preparation for opening this window in it.
private  void createAutoCloseThread()
           Creates a Thread that closes this AutoCloseConfirmationDialog automatically after the time span as specified by the secondsToClose parameter in the constructor call.
protected  void createButtonsForButtonBar(Composite parent)
           Adds ok Button to this AutoCloseConfirmationDialog's button bar using the createButton framework method.
protected  Control createDialogArea(Composite parent)
           Creates the dialog area of this AutoCloseConfirmationDialog.
 int open()
           Opens this AutoCloseConfirmationDialog, creating it first if it has not yet been created.
 
Methods inherited from class org.eclipse.jface.dialogs.TitleAreaDialog
createContents, getInitialSize, getTitleArea, getTitleImageLabel, setErrorMessage, setMessage, setMessage, setTitle, setTitleAreaColor, setTitleImage
 
Methods inherited from class org.eclipse.jface.dialogs.TrayDialog
close, closeTray, createButtonBar, 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, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, okPressed, 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, setBlockOnOpen, 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

dialogTitle

private String dialogTitle

The title of this AutoCloseConfirmationDialog


message

private String message

The message to display


secondsToClose

private int secondsToClose

The number of seconds after which this AutoCloseConfirmationDialog closes automatically.


dialogImage

private Image dialogImage

The Image to display in this AutoCloseConfirmationDialog Shell title.

Constructor Detail

AutoCloseConfirmationDialog

public AutoCloseConfirmationDialog(Shell parentShell,
                                   String dialogTitle,
                                   String headerText,
                                   String headerSubText,
                                   String message,
                                   Image dialogImage,
                                   Image headerImage,
                                   int secondsToClose)

Creates a new AutoCloseConfirmationDialog instance.

Parameters:
parentShell - the parent Shell or null if this AutoCloseConfirmationDialog should be created as top level Shell
dialogTitle - the dialog title
headerText - the header text
headerSubText - the accompanying text of the header
message - the message
dialogImage - the Image for the dialog
headerImage - the Image to display in the header
secondsToClose - the time in seconds after which this AutoCloseConfirmationDialog closes automatically
Method Detail

configureShell

protected void configureShell(Shell newShell)

Configures the given Shell in preparation for opening this window in it.

Parameters:
newShell - the Shell to configure

createDialogArea

protected Control createDialogArea(Composite parent)

Creates the dialog area of this AutoCloseConfirmationDialog.

Parameters:
parent - the parent Composite to contain the dialog area
Returns:
the dialog area Control

createButtonsForButtonBar

protected void createButtonsForButtonBar(Composite parent)

Adds ok Button to this AutoCloseConfirmationDialog's button bar using the createButton framework method. This standard Buttonn will be accessible from getButton(IDialogConstants.OK_ID).

Parameters:
parent - the button bar Composite

open

public int open()

Opens this AutoCloseConfirmationDialog, creating it first if it has not yet been created. If this AutoCloseConfirmationDialog has been configured to block on open ( setBlockOnOpen), this method waits until this AutoCloseConfirmationDialog is closed by the end user, and then it returns this AutoCloseConfirmationDialog return code; otherwise, this method returns immediately.

Returns:
the return code
See Also:
Dialog.create(), IDialogConstants

createAutoCloseThread

private void createAutoCloseThread()

Creates a Thread that closes this AutoCloseConfirmationDialog automatically after the time span as specified by the secondsToClose parameter in the constructor call. The remaining seconds before close are displayed in the label of the OK Button.