org.das2.components
Class DasProgressPanel

java.lang.Object
  extended by org.das2.components.DasProgressPanel
All Implemented Interfaces:
ProgressMonitor

public class DasProgressPanel
extends java.lang.Object
implements ProgressMonitor


Field Summary
 
Fields inherited from interface org.das2.util.monitor.ProgressMonitor
NULL, SIZE_INDETERMINATE
 
Constructor Summary
DasProgressPanel(java.lang.String label)
           
 
Method Summary
 void cancel()
          Notifies the ProgressMonitor that the task being monitored should be canceled.
static DasProgressPanel createComponentPanel(DasCanvasComponent component, java.lang.String initialMessage)
           
static DasProgressPanel createComponentPanel(DasCanvas canvas, java.lang.String initialMessage)
           
static DasProgressPanel createFramed(java.lang.String label)
           
 void finished()
          Notifies the ProgressMonitor that the task being monitored has finished.
 java.awt.Component getComponent()
          returns the JPanel component.
 java.lang.Exception getConsumer()
           
 java.lang.String getLabel()
          Return the label string displayed.
 java.lang.Exception getSource()
           
 long getTaskProgress()
          Returns the current progress of the monitored task.
 long getTaskSize()
           
 boolean isCancelled()
          Returns true if the operation being tracked should be cancelled.
 boolean isFinished()
          true if the process has indicated that it is finished
 boolean isStarted()
          true if the process has indicated that it has started.
 boolean isValidateRoot()
          Returning true here keeps the progress bar from forcing the whole canvas to repaint when the label of the progress bar changes.
 boolean isVisible()
           
 void setAdditionalInfo(java.lang.String s)
          Deprecated. 
 void setLabel(java.lang.String label)
          Set a consise string that describes the task being performed.
 void setProgressMessage(java.lang.String message)
          Provides additional feedback as to what's going on in the process.
 void setShowProgressRate(boolean showProgressRate)
          Setter for property showProgressRate.
 void setTaskProgress(long position)
          Notifies the ProgressMonitor of a change in the progress of the task.
 void setTaskSize(long taskSize)
          Sets the maximum value for the task progress of this ProgressMonitor.
 void setVisible(boolean visible)
           
 void started()
          Notifies the ProgressMonitor that the task being monitored has started.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DasProgressPanel

public DasProgressPanel(java.lang.String label)
Method Detail

getComponent

public java.awt.Component getComponent()
returns the JPanel component.


createComponentPanel

public static DasProgressPanel createComponentPanel(DasCanvasComponent component,
                                                    java.lang.String initialMessage)

createComponentPanel

public static DasProgressPanel createComponentPanel(DasCanvas canvas,
                                                    java.lang.String initialMessage)

isValidateRoot

public boolean isValidateRoot()
Returning true here keeps the progress bar from forcing the whole canvas to repaint when the label of the progress bar changes.


createFramed

public static DasProgressPanel createFramed(java.lang.String label)

setLabel

public void setLabel(java.lang.String label)
Description copied from interface: ProgressMonitor
Set a consise string that describes the task being performed. Monitors don't necessarily need to display this label, and this request may be ignored. It is only provided so a process can describe the task that is going on. This is usually set by the client of the process to indicate what service we are waiting for. e.g. "Loading Data"

Specified by:
setLabel in interface ProgressMonitor

getLabel

public java.lang.String getLabel()
Description copied from interface: ProgressMonitor
Return the label string displayed. This is primarily to aid in debugging, and this method need not return the string set by setLabel.

Specified by:
getLabel in interface ProgressMonitor

finished

public void finished()
Description copied from interface: ProgressMonitor
Notifies the ProgressMonitor that the task being monitored has finished.

Specified by:
finished in interface ProgressMonitor

setTaskProgress

public void setTaskProgress(long position)
                     throws java.lang.IllegalStateException
Description copied from interface: ProgressMonitor
Notifies the ProgressMonitor of a change in the progress of the task.

Specified by:
setTaskProgress in interface ProgressMonitor
Parameters:
position - the current task position
Throws:
java.lang.IllegalStateException

setAdditionalInfo

@Deprecated
public void setAdditionalInfo(java.lang.String s)
Deprecated. 

Description copied from interface: ProgressMonitor
additional information to be displayed alongside the progress. That might be of interest. "85 of 100 (50KB/s)"

Specified by:
setAdditionalInfo in interface ProgressMonitor

getTaskProgress

public long getTaskProgress()
Description copied from interface: ProgressMonitor
Returns the current progress of the monitored task.

Specified by:
getTaskProgress in interface ProgressMonitor
Returns:
the current progress of the monitored task.

getTaskSize

public long getTaskSize()
Specified by:
getTaskSize in interface ProgressMonitor

setTaskSize

public void setTaskSize(long taskSize)
Description copied from interface: ProgressMonitor
Sets the maximum value for the task progress of this ProgressMonitor.

Specified by:
setTaskSize in interface ProgressMonitor
Parameters:
taskSize - maximum value for the task progress. A taskSize of -1 indicates the taskSize is indeterminate.

setVisible

public void setVisible(boolean visible)

isVisible

public boolean isVisible()

started

public void started()
Description copied from interface: ProgressMonitor
Notifies the ProgressMonitor that the task being monitored has started. If the ProgressMonitor is in a cancelled state when this method is called, that ProgressMonitor should be 'uncancelled'.

Specified by:
started in interface ProgressMonitor

cancel

public void cancel()
Description copied from interface: ProgressMonitor
Notifies the ProgressMonitor that the task being monitored should be canceled. After this method is called, implementations should return true on any subsequent calls to ProgressMonitor.isCancelled() and should throw an IllegalStateException on any subsequent calls to ProgressMonitor.setTaskProgress(long).

Specified by:
cancel in interface ProgressMonitor

isCancelled

public boolean isCancelled()
Description copied from interface: ProgressMonitor
Returns true if the operation being tracked should be cancelled.

Specified by:
isCancelled in interface ProgressMonitor
Returns:
true if the operation being tracked should be cancelled.

getSource

public java.lang.Exception getSource()

getConsumer

public java.lang.Exception getConsumer()

setShowProgressRate

public void setShowProgressRate(boolean showProgressRate)
Setter for property showProgressRate.

Parameters:
showProgressRate - New value of property showProgressRate.

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

setProgressMessage

public void setProgressMessage(java.lang.String message)
Description copied from interface: ProgressMonitor
Provides additional feedback as to what's going on in the process. This message should be set by the service provider, not the client, and refer to the implementation of the task. e.g. "Reading file myData.dat"

Specified by:
setProgressMessage in interface ProgressMonitor
Parameters:
message - the message describing the state of progress.

isStarted

public boolean isStarted()
Description copied from interface: ProgressMonitor
true if the process has indicated that it has started.

Specified by:
isStarted in interface ProgressMonitor

isFinished

public boolean isFinished()
Description copied from interface: ProgressMonitor
true if the process has indicated that it is finished

Specified by:
isFinished in interface ProgressMonitor