de.vxart.zipupdate
Class ProgressListenerManager

java.lang.Object
  extended by de.vxart.zipupdate.ProgressListenerManager
All Implemented Interfaces:
ProgressListener, java.lang.Iterable

public class ProgressListenerManager
extends java.lang.Object
implements ProgressListener, java.lang.Iterable

Provides a convenient way to handle multiple ProgressListeners at once.

Author:
Philipp Reichart, philipp.reichart@vxart.de

Constructor Summary
ProgressListenerManager()
           
 
Method Summary
 void add(ProgressListener listener)
           
 void finish()
          Finishes the display of progress by a progress listener, e.g.
 int getProgress()
          Returns the progress from the first registered listeners.
 void init(java.lang.String message)
          Sets or resets this listener to indeterminate mode and labels it with the given message.
 void init(java.lang.String message, int min, int max)
          Sets or resets this listener to determinate mode using the specified message, minimum and maximum values.
 java.util.Iterator<ProgressListener> iterator()
          Returns and Iterator over all ProgressListeners registered with this manager.
 void label(java.lang.String label)
          Labels the current task with the specified string.
 void remove(ProgressListener listener)
           
 int size()
          Returns the number of ProgressListener registered with this manager.
 void update(int progress)
          Updates the progress to the specified value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProgressListenerManager

public ProgressListenerManager()
Method Detail

add

public void add(ProgressListener listener)

remove

public void remove(ProgressListener listener)

init

public void init(java.lang.String message)
Description copied from interface: ProgressListener
Sets or resets this listener to indeterminate mode and labels it with the given message. Indeterminate mode is used for tasks of unknown length.

Specified by:
init in interface ProgressListener

init

public void init(java.lang.String message,
                 int min,
                 int max)
Description copied from interface: ProgressListener
Sets or resets this listener to determinate mode using the specified message, minimum and maximum values.

Specified by:
init in interface ProgressListener

update

public void update(int progress)
Description copied from interface: ProgressListener
Updates the progress to the specified value. Implementations may rely on this happening in order to provide advanced progress information, therefore the caller should update continously and not "jump"around.

Specified by:
update in interface ProgressListener
Parameters:
progress - the new progress value

label

public void label(java.lang.String label)
Description copied from interface: ProgressListener
Labels the current task with the specified string.

Specified by:
label in interface ProgressListener
Parameters:
label - a label describing the current task

finish

public void finish()
Description copied from interface: ProgressListener
Finishes the display of progress by a progress listener, e.g. by closing a progress dialog.

Specified by:
finish in interface ProgressListener

iterator

public java.util.Iterator<ProgressListener> iterator()
Returns and Iterator over all ProgressListeners registered with this manager.

Specified by:
iterator in interface java.lang.Iterable

getProgress

public int getProgress()
Returns the progress from the first registered listeners.

Specified by:
getProgress in interface ProgressListener
Returns:
the current progress value

size

public int size()
Returns the number of ProgressListener registered with this manager.

Returns:
the number of ProgressListener in this manager.