org.xnap.commons.io
Class SubTaskProgressMonitor

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

public class SubTaskProgressMonitor
extends Object
implements ProgressMonitor

Create a top ProgressMonitor with totalSteps set to number of SubTaskProgressMonitor * SubTaskProgressMonitor amounts.

  ProgressMonitor topMonitor = new ProgressDialog();
  topMonitor.setTotalSteps(7 * 100);
  for (int i = 0; i < 7; i++) {
        new SubTaskProgressMonitor(topMonitor, 100, totalStepsOfSubTask);
  }
  


Constructor Summary
SubTaskProgressMonitor(ProgressMonitor monitor, int amount, long totalSteps)
           
 
Method Summary
 void done()
           
 Component getComponent()
          Returns the component that displays the progress.
 long getValue()
           
 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 totalSteps)
          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
 

Constructor Detail

SubTaskProgressMonitor

public SubTaskProgressMonitor(ProgressMonitor monitor,
                              int amount,
                              long totalSteps)
Method Detail

getValue

public long getValue()

setTotalSteps

public void setTotalSteps(long totalSteps)
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

work

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

Specified by:
work in interface ProgressMonitor

done

public void done()

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

setText

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

Specified by:
setText 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.