Package org.geotools.data.util
Class NullProgressListener
- Object
-
- NullProgressListener
-
- All Implemented Interfaces:
ProgressListener
- Direct Known Subclasses:
DefaultProgressListener
public class NullProgressListener extends Object implements ProgressListener
A default progress listener implementation suitable for subclassing.This implementation supports cancelation and getting/setting the description. The default implementations of the other methods do nothing.
- Since:
- 2.2
-
-
Constructor Summary
Constructors Constructor Description NullProgressListener()Creates a null progress listener with no description.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcomplete()Notifies this listener that the operation has finished.voiddispose()Releases any resources used by this listener.voidexceptionOccurred(Throwable exception)Reports an exception.StringgetDescription()floatgetProgress()Returns the current progress as a percent completed.InternationalStringgetTask()Returns the description of the current task being performed, ornullif none.booleanisCanceled()Returnstrueif this job is cancelled.voidprogress(float percent)Notifies this listener of progress in the lengthly operation.voidsetCanceled(boolean cancel)Indicates that task should be cancelled.voidsetDescription(String description)voidsetTask(InternationalString task)Sets the description of the current task being performed.voidstarted()Notifies this listener that the operation begins.voidwarningOccurred(String source, String location, String warning)Reports a warning.
-
-
-
Method Detail
-
getDescription
public String getDescription()
-
setDescription
public void setDescription(String description)
-
started
public void started()
Description copied from interface:ProgressListenerNotifies this listener that the operation begins.- Specified by:
startedin interfaceProgressListener
-
progress
public void progress(float percent)
Description copied from interface:ProgressListenerNotifies 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:
progressin interfaceProgressListener- Parameters:
percent- The progress as a value between 0 and 100 inclusive.
-
getProgress
public float getProgress()
Description copied from interface:ProgressListenerReturns the current progress as a percent completed.- Specified by:
getProgressin interfaceProgressListener- Returns:
- Percent completed between 0 and 100 inclusive.
-
complete
public void complete()
Description copied from interface:ProgressListenerNotifies 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:
completein interfaceProgressListener
-
dispose
public void dispose()
Description copied from interface:ProgressListenerReleases any resources used by this listener. If the progress were reported in a window, this window may be disposed.- Specified by:
disposein interfaceProgressListener
-
setCanceled
public void setCanceled(boolean cancel)
Description copied from interface:ProgressListenerIndicates that task should be cancelled.- Specified by:
setCanceledin interfaceProgressListener- Parameters:
cancel-truefor cancelling the task.
-
isCanceled
public boolean isCanceled()
Description copied from interface:ProgressListenerReturnstrueif this job is cancelled.- Specified by:
isCanceledin interfaceProgressListener- Returns:
trueif this job is cancelled.
-
warningOccurred
public void warningOccurred(String source, String location, String warning)
Description copied from interface:ProgressListenerReports 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:
warningOccurredin interfaceProgressListener- Parameters:
source- Name of the warning source, ornullif none. This is typically the filename in process of being parsed or the URL of the data being processedlocation- Text to write on the left side of the warning message, ornullif none. This is typically the line number where the error occured in thesourcefile or the feature ID of the feature that produced the messagewarning- The warning message.
-
exceptionOccurred
public void exceptionOccurred(Throwable exception)
Description copied from interface:ProgressListenerReports 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:
exceptionOccurredin interfaceProgressListener- Parameters:
exception- The exception to report.
-
getTask
public InternationalString getTask()
Description copied from interface:ProgressListenerReturns the description of the current task being performed, ornullif none. It is assumed that if the task isnullapplications may simply report that the process is "in progress" or "working" as represented in the current locale.- Specified by:
getTaskin interfaceProgressListener- Returns:
- Description of the task being performed, or
nullif none.
-
setTask
public void setTask(InternationalString task)
Description copied from interface:ProgressListenerSets 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:
setTaskin interfaceProgressListener- Parameters:
task- Description of the task being performed, ornullif none.
-
-