org.geotools.swing
Class ProgressWindow

java.lang.Object
  extended by org.geotools.swing.ProgressWindow
All Implemented Interfaces:
org.opengis.util.ProgressListener

public class ProgressWindow
extends java.lang.Object
implements org.opengis.util.ProgressListener

Reports progress of a lengthly operation in a window. This implementation can also format warnings. Its method can be invoked from any thread (it doesn't need to be the Swing thread), which make it easier to use it from some background thread. Such background thread should have a low priority in order to avoid delaying Swing repaint events.

Since:
2.0
Version:
$Id: ProgressWindow.java 34138 2009-10-13 06:35:19Z mbedward $
Author:
Martin Desruisseaux

Constructor Summary
ProgressWindow(java.awt.Component parent)
          Creates a window for reporting progress.
 
Method Summary
 void complete()
          Notifies that the operation has finished.
 void dispose()
          Releases any resource holds by this window.
 void exceptionOccurred(java.lang.Throwable exception)
          Display an exception stack trace.
 java.lang.String getDescription()
          Deprecated.  
 float getProgress()
           
 org.opengis.util.InternationalString getTask()
           
 java.lang.String getTitle()
          Returns the window title.
 boolean isCanceled()
          
 void progress(float percent)
          
 void setCanceled(boolean stop)
          
 void setDescription(java.lang.String description)
          Deprecated.  
 void setTask(org.opengis.util.InternationalString task)
           
 void setTitle(java.lang.String title)
          Set the window title.
 void started()
          Notifies that the operation begins.
 void warningOccurred(java.lang.String source, java.lang.String margin, java.lang.String warning)
          Display a warning message under the progress bar.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressWindow

public ProgressWindow(java.awt.Component parent)
Creates a window for reporting progress. The window will not appears immediately. It will appears only when the started() method will be invoked.

Parameters:
parent - The parent component, or null if none.
Method Detail

getTitle

public java.lang.String getTitle()
Returns the window title. The default title is "Progress" localized in current locale.

Returns:
the window title

setTitle

public void setTitle(java.lang.String title)
Set the window title. A null value reset the default title.

Parameters:
title - the window title

getDescription

public java.lang.String getDescription()
Deprecated. 

Specified by:
getDescription in interface org.opengis.util.ProgressListener

setDescription

public void setDescription(java.lang.String description)
Deprecated. 

Specified by:
setDescription in interface org.opengis.util.ProgressListener

started

public void started()
Notifies that the operation begins. This method display the windows if it was not already visible.

Specified by:
started in interface org.opengis.util.ProgressListener

progress

public void progress(float percent)

Specified by:
progress in interface org.opengis.util.ProgressListener

getProgress

public float getProgress()
Specified by:
getProgress in interface org.opengis.util.ProgressListener

complete

public void complete()
Notifies that the operation has finished. The window will disaspears, except if it contains warning or exception stack traces.

Specified by:
complete in interface org.opengis.util.ProgressListener

dispose

public void dispose()
Releases any resource holds by this window. Invoking this method destroy the window.

Specified by:
dispose in interface org.opengis.util.ProgressListener

isCanceled

public boolean isCanceled()

Specified by:
isCanceled in interface org.opengis.util.ProgressListener

setCanceled

public void setCanceled(boolean stop)

Specified by:
setCanceled in interface org.opengis.util.ProgressListener
Parameters:
stop - true to stop; false otherwise

warningOccurred

public void warningOccurred(java.lang.String source,
                            java.lang.String margin,
                            java.lang.String warning)
Display a warning message under the progress bar. The text area for warning messages appears only the first time this method is invoked.

Specified by:
warningOccurred in interface org.opengis.util.ProgressListener
Parameters:
source - DOCUMENT ME
margin - DOCUMENT ME
warning - DOCUMENT ME

exceptionOccurred

public void exceptionOccurred(java.lang.Throwable exception)
Display an exception stack trace.

Specified by:
exceptionOccurred in interface org.opengis.util.ProgressListener
Parameters:
exception - the exception to display

setTask

public void setTask(org.opengis.util.InternationalString task)
Specified by:
setTask in interface org.opengis.util.ProgressListener

getTask

public org.opengis.util.InternationalString getTask()
Specified by:
getTask in interface org.opengis.util.ProgressListener


Copyright © 1996-2010 Geotools. All Rights Reserved.