org.geotools.swt.control
Class ProgressWindow

Object
  extended by Window
      extended by Dialog
          extended by IconAndMessageDialog
              extended by ProgressMonitorDialog
                  extended by ProgressWindow
All Implemented Interfaces:
IRunnableContext, IShellProvider, ProgressListener

public class ProgressWindow
extends ProgressMonitorDialog
implements ProgressListener

Wrapper for geotools' ProgressListener.

Author:
Andrea Antonello (www.hydrologis.com)

Nested Class Summary
 
Nested classes/interfaces inherited from class Window
Window.IExceptionHandler
 
Field Summary
 
Fields inherited from class ProgressMonitorDialog
arrowCursor, cancel, enableCancelButton, operationCancelableState, progressIndicator, subTaskLabel, taskLabel
 
Fields inherited from class IconAndMessageDialog
imageLabel, message, messageLabel
 
Fields inherited from class 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 Window
CANCEL, OK
 
Constructor Summary
ProgressWindow(Shell parent, int taskSize)
           
 
Method Summary
 void complete()
          Notifies this listener that the operation has finished.
 void dispose()
          Releases any resources used by this listener.
 void exceptionOccurred(Throwable exception)
          Reports an exception.
 String getDescription()
          Description for the lengthly operation to be reported, or null if none.
 float getProgress()
          Returns the current progress as a percent completed.
 InternationalString getTask()
          Returns the description of the current task being performed, or null if none.
 boolean isCanceled()
          Returns true if this job is cancelled.
 void progress(float percent)
          Notifies this listener of progress in the lengthly operation.
 void setCanceled(boolean value)
          Indicates that task should be cancelled.
 void setDescription(String description)
          Sets the description for the lenghtly operation to be reported.
 void setTask(InternationalString task)
          Sets the description of the current task being performed.
 void started()
          Notifies this listener that the operation begins.
 void warningOccurred(String source, String location, String warning)
          Reports a warning.
 
Methods inherited from class ProgressMonitorDialog
aboutToRun, cancelPressed, clearCursors, close, configureShell, createButtonsForButtonBar, createCancelButton, createDialogArea, decrementNestingDepth, finishedRun, getImage, getInitialSize, getNestingDepth, getOpenOnRun, getProgressMonitor, incrementNestingDepth, open, run, setCancelable, setOpenOnRun, setOperationCancelButtonEnabled, updateForClearBlocked, updateForSetBlocked
 
Methods inherited from class IconAndMessageDialog
createButtonBar, createContents, createDialogAndButtonArea, createMessageArea, getErrorImage, getInfoImage, getMessageLabelStyle, getQuestionImage, getWarningImage
 
Methods inherited from class Dialog
applyDialogFont, buttonPressed, convertHeightInCharsToPixels, convertHeightInCharsToPixels, convertHorizontalDLUsToPixels, convertHorizontalDLUsToPixels, convertVerticalDLUsToPixels, convertVerticalDLUsToPixels, convertWidthInCharsToPixels, convertWidthInCharsToPixels, create, createButton, dialogFontIsDefault, getBlockedHandler, getButton, getButtonBar, getCancelButton, getDialogArea, getDialogBoundsSettings, getDialogBoundsStrategy, getImage, getInitialLocation, getOKButton, initializeBounds, initializeDialogUnits, isResizable, okPressed, setBlockedHandler, setButtonLayoutData, setButtonLayoutFormData, shortenText
 
Methods inherited from class Window
canHandleShellCloseEvent, constrainShellSize, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getLayout, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressWindow

public ProgressWindow(Shell parent,
                      int taskSize)
Method Detail

isCanceled

public boolean isCanceled()
Description copied from interface: ProgressListener
Returns true if this job is cancelled.

Specified by:
isCanceled in interface ProgressListener
Returns:
true if this job is cancelled.

setCanceled

public void setCanceled(boolean value)
Description copied from interface: ProgressListener
Indicates that task should be cancelled.

Specified by:
setCanceled in interface ProgressListener
Parameters:
value - true for cancelling the task.

setTask

public void setTask(InternationalString task)
Description copied from interface: ProgressListener
Sets the description of the current task being performed. This method is usually invoked before any progress begins. However, it is legal to invoke this method at any time during the operation, in which case the description display is updated without any change to the percentage accomplished.

Specified by:
setTask in interface ProgressListener
Parameters:
task - Description of the task being performed, or null if none.

getTask

public InternationalString getTask()
Description copied from interface: ProgressListener
Returns the description of the current task being performed, or null if none. It is assumed that if the task is null applications may simply report that the process is "in progress" or "working" as represented in the current locale.

Specified by:
getTask in interface ProgressListener
Returns:
Description of the task being performed, or null if none.

getDescription

public String getDescription()
Description copied from interface: ProgressListener
Description for the lengthly operation to be reported, or null if none.

Specified by:
getDescription in interface ProgressListener
Returns:
The task description.

setDescription

public void setDescription(String description)
Description copied from interface: ProgressListener
Sets the description for the lenghtly operation to be reported. This method is usually invoked before any progress begins. However, it is legal to invoke this method at any time during the operation, in which case the description display is updated without any change to the percentage accomplished.

Specified by:
setDescription in interface ProgressListener
Parameters:
description - The new description, or null if none.

started

public void started()
Description copied from interface: ProgressListener
Notifies this listener that the operation begins.

Specified by:
started in interface ProgressListener

progress

public void progress(float percent)
Description copied from interface: ProgressListener
Notifies this listener of progress in the lengthly operation. Progress are reported as a value between 0 and 100 inclusive. Values out of bounds will be clamped.

Specified by:
progress in interface ProgressListener
Parameters:
percent - The progress as a value between 0 and 100 inclusive.

getProgress

public float getProgress()
Description copied from interface: ProgressListener
Returns the current progress as a percent completed.

Specified by:
getProgress in interface ProgressListener
Returns:
Percent completed between 0 and 100 inclusive.

complete

public void complete()
Description copied from interface: ProgressListener
Notifies this listener that the operation has finished. The progress indicator will shows 100% or disappears, at implementor choice. If warning messages were pending, they will be displayed now.

Specified by:
complete in interface ProgressListener

dispose

public void dispose()
Description copied from interface: ProgressListener
Releases any resources used by this listener. If the progress were reported in a window, this window may be disposed.

Specified by:
dispose in interface ProgressListener

warningOccurred

public void warningOccurred(String source,
                            String location,
                            String warning)
Description copied from interface: ProgressListener
Reports a warning. This warning may be logged, printed to the standard error stream, appears in a windows or be ignored, at implementor choice.

Specified by:
warningOccurred in interface ProgressListener
Parameters:
source - Name of the warning source, or null if none. This is typically the filename in process of being parsed or the URL of the data being processed
location - Text to write on the left side of the warning message, or null if none. This is typically the line number where the error occured in the source file or the feature ID of the feature that produced the message
warning - The warning message.

exceptionOccurred

public void exceptionOccurred(Throwable exception)
Description copied from interface: ProgressListener
Reports an exception. This method may prints the stack trace to the standard error stream or display it in a dialog box, at implementor choice.

Specified by:
exceptionOccurred in interface ProgressListener
Parameters:
exception - The exception to report.


Copyright © 1996-2014 Geotools. All Rights Reserved.