org.xnap.commons.io
Class UserAbortProgressMonitor

java.lang.Object
  extended by org.xnap.commons.io.UserAbortProgressMonitor
All Implemented Interfaces:
ProgressMonitor

public class UserAbortProgressMonitor
extends Object
implements ProgressMonitor

A progress monitor that acts as a proxy and throws UserAbortException the proxied monitor has been cancelled.

Author:
Steffen Pingel

Field Summary
protected  ProgressMonitor monitor
           
 
Constructor Summary
UserAbortProgressMonitor(ProgressMonitor monitor)
           
 
Method Summary
 Component getComponent()
          Returns the component that displays the progress.
 boolean isCancelled()
          Returns true, if the operation has been cancelled by the user.
 void setCancelEnabled(boolean enabled)
          Enables the cancel button.
 void setText(String text)
          Sets the message text.
 void setTotalSteps(long max)
          Sets the maximum value.
 void setValue(long value)
          Sets the current value.
 void work(long amount)
          Increase the value by amount.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

monitor

protected ProgressMonitor monitor
Constructor Detail

UserAbortProgressMonitor

public UserAbortProgressMonitor(ProgressMonitor monitor)
Method Detail

isCancelled

public boolean isCancelled()
Description copied from interface: ProgressMonitor
Returns true, if the operation has been cancelled by the user.

Specified by:
isCancelled in interface ProgressMonitor

setCancelEnabled

public void setCancelEnabled(boolean enabled)
Description copied from interface: ProgressMonitor
Enables the cancel button.

Per default we assume cancelling is enabled.

Specified by:
setCancelEnabled in interface ProgressMonitor

setTotalSteps

public void setTotalSteps(long max)
Description copied from interface: ProgressMonitor
Sets the maximum value.

Specified by:
setTotalSteps in interface ProgressMonitor

setValue

public void setValue(long value)
Description copied from interface: ProgressMonitor
Sets the current value.

Specified by:
setValue in interface ProgressMonitor
Parameters:
value - min <= value <= max

setText

public void setText(String text)
Description copied from interface: ProgressMonitor
Sets the message text.

Specified by:
setText in interface ProgressMonitor

work

public void work(long amount)
Description copied from interface: ProgressMonitor
Increase the value by amount.

Specified by:
work in interface ProgressMonitor

getComponent

public Component getComponent()
Description copied from interface: ProgressMonitor
Returns the component that displays the progress. This could be a dialog, a progress bar or null.

Specified by:
getComponent in interface ProgressMonitor
Returns:
null, if this monitor is not displayed by a component; the component, otherwise


Copyright © 2004-2007 XNap Commons Team. All Rights Reserved.