Project Wonder 5.0

er.ajax
Class AjaxProgress

java.lang.Object
  extended by er.ajax.AjaxProgress
Direct Known Subclasses:
AjaxUploadProgress

public class AjaxProgress
extends java.lang.Object

AjaxProgress is the model for an AjaxProgressBar. By holding onto this, you can keep track of and control the progress of whatever operation is bound to this progress object.

Author:
mschrag

Constructor Summary
AjaxProgress(int maximum)
          Construct an AjaxProgress
AjaxProgress(java.lang.String id, int maximum)
          Construct an AjaxProgress
 
Method Summary
 void cancel()
          Cancels this procedure.
 boolean completionEventsFired()
          Returns whether or not this procedure has notified listeners of its completion.
 void copyAndTrack(java.io.InputStream inputStream, java.io.OutputStream outputStream, long maxSize)
          Convenience method for copying a stream and tracking it with this progress model.
 void dispose()
          Disposes any resources associated with this procedure.
 java.lang.Throwable failure()
          Returns the exception that caused this procedure to fail.
 java.lang.String id()
          Returns the id of this progress model.
 void incrementValue(long count)
          Increment value by the given amount.
 boolean isCanceled()
          Returns true if this procedure was canceled.
 boolean isDone()
          Returns whether or not this procedure is done.
 boolean isFailed()
          Returns true if this procedure failed (and was not canceled).
 boolean isStarted()
          Returns whether or not this procedure has started.
 boolean isSucceeded()
          Returns true if this procedure is done, not canceled, and not failed.
 long maximum()
          Returns the maximum value for this progress model.
 double percentage()
          Returns the percentage completion of this progress model (0.0 - 1.0).
static AjaxProgress progress(com.webobjects.appserver.WOSession session, java.lang.String id)
          Returns the progress object with the given id (or null if one does not exist).
static void registerProgress(com.webobjects.appserver.WOSession session, AjaxProgress progress)
          Register a progress object in the registry.
 void reset()
          Flags the attached procedure to reset the next time it is processed.
 void setCompletionEventsFired(boolean completionEventsFired)
          Sets whether or not this procedure has notified listeners of its completion.
 void setDone(boolean done)
          Sets whether or not this procedure is done.
 void setFailure(java.lang.Throwable failure)
          Sets the exception that caused this procedure to fail.
 void setMaximum(long maximum)
          Sets the maximum value for this progress model.
 void setStatus(java.lang.String status)
          Sets the current status message for this process.
 void setValue(long value)
          Sets the current value of this progress model.
 boolean shouldReset()
          Returns whether or not the attached procedure should reset the next time it is processed.
 java.lang.String status()
          Returns the current status message for this process.
static void unregisterProgress(com.webobjects.appserver.WOSession session, AjaxProgress progress)
          Unregister a progress object from the registry.
 long value()
          Returns the current value of this progress model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AjaxProgress

public AjaxProgress(int maximum)
Construct an AjaxProgress

Parameters:
maximum - the maximum value of this progress

AjaxProgress

public AjaxProgress(java.lang.String id,
                    int maximum)
Construct an AjaxProgress

Parameters:
id - the id of this AjaxProgress (only useful if you're registering it with AjaxProgressBar's registry)
maximum - the maximum value of this progress
Method Detail

id

public java.lang.String id()
Returns the id of this progress model.

Returns:
the id of this progress model

setValue

public void setValue(long value)
Sets the current value of this progress model. In the context of an upload, value would represent the number of bytes uploaded so far.

Parameters:
value - the new value

value

public long value()
Returns the current value of this progress model. If this model isSucceeded, then this will return maximum().

Returns:
the current value of this progress model

incrementValue

public void incrementValue(long count)
Increment value by the given amount.

Parameters:
count - the mount to increment value by

setMaximum

public void setMaximum(long maximum)
Sets the maximum value for this progress model.

Parameters:
maximum - the maximum value for this progress model

maximum

public long maximum()
Returns the maximum value for this progress model.

Returns:
the maximum value for this progress model

percentage

public double percentage()
Returns the percentage completion of this progress model (0.0 - 1.0).

Returns:
the percentage completion of this progress model (0.0 - 1.0)

isStarted

public boolean isStarted()
Returns whether or not this procedure has started.

Returns:
whether or not this procedure has started

setDone

public void setDone(boolean done)
Sets whether or not this procedure is done.

Parameters:
done - whether or not this procedure is done

isDone

public boolean isDone()
Returns whether or not this procedure is done.

Returns:
whether or not this procedure is done

setFailure

public void setFailure(java.lang.Throwable failure)
Sets the exception that caused this procedure to fail.

Parameters:
failure - the exception that caused this procedure to fail

failure

public java.lang.Throwable failure()
Returns the exception that caused this procedure to fail.

Returns:
the exception that caused this procedure to fail

cancel

public void cancel()
Cancels this procedure.


isCanceled

public boolean isCanceled()
Returns true if this procedure was canceled.

Returns:
true if this procedure was canceled

isFailed

public boolean isFailed()
Returns true if this procedure failed (and was not canceled).

Returns:
true if this procedure failed (and was not canceled)

isSucceeded

public boolean isSucceeded()
Returns true if this procedure is done, not canceled, and not failed.

Returns:
true if this procedure is done, not canceled, and not failed

dispose

public void dispose()
Disposes any resources associated with this procedure.


setCompletionEventsFired

public void setCompletionEventsFired(boolean completionEventsFired)
Sets whether or not this procedure has notified listeners of its completion.

Parameters:
completionEventsFired - whether or not this procedure has notified listeners of its completion

completionEventsFired

public boolean completionEventsFired()
Returns whether or not this procedure has notified listeners of its completion.

Returns:
whether or not this procedure has notified listeners of its completion

reset

public void reset()
Flags the attached procedure to reset the next time it is processed.


shouldReset

public boolean shouldReset()
Returns whether or not the attached procedure should reset the next time it is processed.

Returns:
whether or not the attached procedure should reset the next time it is processed

setStatus

public void setStatus(java.lang.String status)
Sets the current status message for this process.

Parameters:
status - the current status message for this process

status

public java.lang.String status()
Returns the current status message for this process.

Returns:
the current status message for this process

copyAndTrack

public void copyAndTrack(java.io.InputStream inputStream,
                         java.io.OutputStream outputStream,
                         long maxSize)
                  throws java.io.IOException
Convenience method for copying a stream and tracking it with this progress model.

Parameters:
inputStream - the inputstream to copy from
outputStream - the outputstream to copy to
maxSize - the maximum size to read
Throws:
java.io.IOException - if there is a failure

registerProgress

public static void registerProgress(com.webobjects.appserver.WOSession session,
                                    AjaxProgress progress)
Register a progress object in the registry.

Parameters:
session - the session
progress - the progress object to register

unregisterProgress

public static void unregisterProgress(com.webobjects.appserver.WOSession session,
                                      AjaxProgress progress)
Unregister a progress object from the registry.

Parameters:
session - the session
progress - the progress object to unregister

progress

public static AjaxProgress progress(com.webobjects.appserver.WOSession session,
                                    java.lang.String id)
Returns the progress object with the given id (or null if one does not exist).

Parameters:
session - the session
id - the id of the progress to retrieve
Returns:
the matching progess object (or null)

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.