CubeTwister 2.0alpha142 2012-02-11

ch.randelshofer.gui
Class ProgressPrinter

java.lang.Object
  extended by ch.randelshofer.gui.ProgressPrinter
All Implemented Interfaces:
ProgressObserver

public class ProgressPrinter
extends java.lang.Object
implements ProgressObserver

ProgressPrinter.

Version:
2.3 2011-05-01 Added methods setPrint/isPrint.
2.1 2010-01-03 Added method printf.
2.0 2007-12-04 Updated to new ProgressObserver interface.
1.0 September 18, 2006 Created.
Author:
Werner Randelshofer

Constructor Summary
ProgressPrinter()
           
 
Method Summary
 void cancel()
          Cancels the operation.
 void close()
          Closes the progress observer.
 void complete()
          Indicate that the operation is complete.
 java.lang.String getError()
          Specifies the error message that is displayed along with the progress message.
 int getMaximum()
          Returns the maximum value -- the higher end of the progress value.
 int getMinimum()
          Returns the minimum value -- the lower end of the progress value.
 javax.swing.BoundedRangeModel getModel()
           
 java.lang.String getNote()
          Specifies the additional note that is displayed along with the progress message.
 int getProgress()
          Returns the progress of the operation being monitored.
 java.lang.String getWarning()
          Specifies the warning message that is displayed along with the progress message.
 boolean isCanceled()
          Returns true if the user has hit the Cancel button in the progress dialog.
 boolean isClosed()
          Returns true if the progress observer is closed.
 boolean isCompleted()
          Returns true if the operation is completed.
 boolean isIndeterminate()
          Returns true if the progress observer is set to indeterminate.
 boolean isPrint()
          Whether to print messages on System.out.
 void printf(java.lang.String format, java.lang.Object... args)
          Sets a formatted note.
 void setCancelable(boolean b)
          Set cancelable to false if the operation can not be canceled.
 void setDoCancel(java.lang.Runnable doCancel)
          The specified Runnable is executed when the user presses the cancel button.
 void setError(java.lang.String message)
          Specifies the additional error message that is displayed along with the progress message.
 void setIndeterminate(boolean newValue)
          Sets the progress observer to indeterminate.
 void setMaximum(int m)
          Specifies the maximum value.
 void setMinimum(int m)
          Specifies the minimum value.
 void setModel(javax.swing.BoundedRangeModel brm)
           
 void setNote(java.lang.String note)
          Specifies the additional note that is displayed along with the progress message.
 void setPrint(boolean newValue)
          Whether to print messages on System.out.
 void setProgress(int nv)
          Indicate the progress of the operation being monitored.
 void setWarning(java.lang.String message)
          Specifies the additional warning message that is displayed along with the progress message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressPrinter

public ProgressPrinter()
Method Detail

setNote

public void setNote(java.lang.String note)
Description copied from interface: ProgressObserver
Specifies the additional note that is displayed along with the progress message. Used, for example, to show which file is currently being copied during a multiple-file copy.

Specified by:
setNote in interface ProgressObserver
Parameters:
note - a String specifying the note to display
See Also:
ProgressObserver.getNote()

printf

public void printf(java.lang.String format,
                   java.lang.Object... args)
Description copied from interface: ProgressObserver
Sets a formatted note.

Specified by:
printf in interface ProgressObserver

setDoCancel

public void setDoCancel(java.lang.Runnable doCancel)
Description copied from interface: ProgressObserver
The specified Runnable is executed when the user presses the cancel button.

Specified by:
setDoCancel in interface ProgressObserver

setProgress

public void setProgress(int nv)
Description copied from interface: ProgressObserver
Indicate the progress of the operation being monitored. If the specified value is >= the maximum, the progress monitor is closed.

Specified by:
setProgress in interface ProgressObserver
Parameters:
nv - an int specifying the current value, between the maximum and minimum specified for this component
See Also:
ProgressObserver.setMinimum(int), ProgressObserver.setMaximum(int), ProgressObserver.close()

setMaximum

public void setMaximum(int m)
Description copied from interface: ProgressObserver
Specifies the maximum value.

Specified by:
setMaximum in interface ProgressObserver
Parameters:
m - an int specifying the maximum value
See Also:
ProgressObserver.getMaximum()

setMinimum

public void setMinimum(int m)
Description copied from interface: ProgressObserver
Specifies the minimum value.

Specified by:
setMinimum in interface ProgressObserver
Parameters:
m - an int specifying the minimum value
See Also:
ProgressObserver.getMinimum()

setCancelable

public void setCancelable(boolean b)
Description copied from interface: ProgressObserver
Set cancelable to false if the operation can not be canceled.

Specified by:
setCancelable in interface ProgressObserver

setModel

public void setModel(javax.swing.BoundedRangeModel brm)
Specified by:
setModel in interface ProgressObserver

cancel

public void cancel()
Description copied from interface: ProgressObserver
Cancels the operation. This method must be invoked from the user event dispatch thread.

Specified by:
cancel in interface ProgressObserver

complete

public void complete()
Description copied from interface: ProgressObserver
Indicate that the operation is complete. This happens automatically when the value set by setProgress is >= max, but it may be called earlier if the operation ends early.

Specified by:
complete in interface ProgressObserver

getMaximum

public int getMaximum()
Description copied from interface: ProgressObserver
Returns the maximum value -- the higher end of the progress value.

Specified by:
getMaximum in interface ProgressObserver
Returns:
an int representing the maximum value
See Also:
ProgressObserver.setMaximum(int)

getMinimum

public int getMinimum()
Description copied from interface: ProgressObserver
Returns the minimum value -- the lower end of the progress value.

Specified by:
getMinimum in interface ProgressObserver
Returns:
an int representing the minimum value
See Also:
ProgressObserver.setMinimum(int)

getModel

public javax.swing.BoundedRangeModel getModel()
Specified by:
getModel in interface ProgressObserver

getNote

public java.lang.String getNote()
Description copied from interface: ProgressObserver
Specifies the additional note that is displayed along with the progress message.

Specified by:
getNote in interface ProgressObserver
Returns:
a String specifying the note to display
See Also:
ProgressObserver.setNote(java.lang.String)

getProgress

public int getProgress()
Description copied from interface: ProgressObserver
Returns the progress of the operation being monitored.

Specified by:
getProgress in interface ProgressObserver

isCanceled

public boolean isCanceled()
Description copied from interface: ProgressObserver
Returns true if the user has hit the Cancel button in the progress dialog.

Specified by:
isCanceled in interface ProgressObserver

isCompleted

public boolean isCompleted()
Description copied from interface: ProgressObserver
Returns true if the operation is completed.

Specified by:
isCompleted in interface ProgressObserver

setIndeterminate

public void setIndeterminate(boolean newValue)
Description copied from interface: ProgressObserver
Sets the progress observer to indeterminate.

Specified by:
setIndeterminate in interface ProgressObserver

isIndeterminate

public boolean isIndeterminate()
Description copied from interface: ProgressObserver
Returns true if the progress observer is set to indeterminate.

Specified by:
isIndeterminate in interface ProgressObserver

close

public void close()
Description copied from interface: ProgressObserver
Closes the progress observer.

Specified by:
close in interface ProgressObserver

isClosed

public boolean isClosed()
Description copied from interface: ProgressObserver
Returns true if the progress observer is closed.

Specified by:
isClosed in interface ProgressObserver

setWarning

public void setWarning(java.lang.String message)
Description copied from interface: ProgressObserver
Specifies the additional warning message that is displayed along with the progress message. Used, for example, to show which files couldn't be copied during a multiple-file copy..

Specified by:
setWarning in interface ProgressObserver
Parameters:
message - a String specifying the message to display, or null if there is no warning.
See Also:
ProgressObserver.getWarning()

getWarning

public java.lang.String getWarning()
Description copied from interface: ProgressObserver
Specifies the warning message that is displayed along with the progress message.

Specified by:
getWarning in interface ProgressObserver
Returns:
a String specifying the message to display, or null if there is no warning.

setError

public void setError(java.lang.String message)
Description copied from interface: ProgressObserver
Specifies the additional error message that is displayed along with the progress message. Used, for example, to show which files couldn't be copied during a multiple-file copy..

Specified by:
setError in interface ProgressObserver
Parameters:
message - a String specifying the message to display, or null if there is no error.
See Also:
ProgressObserver.getWarning()

getError

public java.lang.String getError()
Description copied from interface: ProgressObserver
Specifies the error message that is displayed along with the progress message.

Specified by:
getError in interface ProgressObserver
Returns:
a String specifying the message to display, or null if there is no error.

setPrint

public void setPrint(boolean newValue)
Description copied from interface: ProgressObserver
Whether to print messages on System.out.

Specified by:
setPrint in interface ProgressObserver

isPrint

public boolean isPrint()
Description copied from interface: ProgressObserver
Whether to print messages on System.out.

Specified by:
isPrint in interface ProgressObserver

(c) Werner Randelshofer.
All rights reserved.