|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectuk.org.retep.util.concurrent.ReadWriteConcurrencySupport
uk.org.retep.util.concurrent.ConcurrencySupport
uk.org.retep.util.monitor.ProgressListenerSet
@ThreadSafe public class ProgressListenerSet
A set of ProgressListener's that will receive the same events as received by this class. This enables more than one ProgressListener to be attached to a monitored process.
| Constructor Summary | |
|---|---|
ProgressListenerSet()
|
|
ProgressListenerSet(ProgressListener... listeners)
|
|
| Method Summary | |
|---|---|
boolean |
add(ProgressListener l)
Add a ProgressListener to the set |
static ProgressListener |
add(ProgressListener current,
ProgressListener listener)
Utility method that allows a ProgressListener to be added to an existing ProgressListener using the following schematics: If the current listener is null then this returns the new listener. |
ProgressListener[] |
getListeners()
Returns a snapshot of the ProgressListener's currently in the set |
boolean |
isEmpty()
Is the set empty. |
boolean |
remove(ProgressListener l)
Remove a ProgressListener from the set |
static ProgressListener |
remove(ProgressListener current,
ProgressListener listener)
Utility method that removes a ProgressListener from the current ProgressListener if that instance is a ProgressListenerSet. |
void |
setMaximum(long maximum)
Notify the listeners that the maximum value has changed |
void |
setMaximum(long inputMaximum,
long outputMaximum)
Notify the listeners that the maximum value has changed |
void |
showProgress(int progress)
Notify listeners of the current progress. |
void |
showProgress(long inputSize,
long outputSize)
Notify listners of the current progress. |
int |
size()
The number of ProgressListener's in this set. |
| Methods inherited from class uk.org.retep.util.concurrent.ConcurrencySupport |
|---|
getLog |
| Methods inherited from class uk.org.retep.util.concurrent.ReadWriteConcurrencySupport |
|---|
readLock, writeLock |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ProgressListenerSet()
public ProgressListenerSet(ProgressListener... listeners)
| Method Detail |
|---|
public static ProgressListener add(ProgressListener current,
ProgressListener listener)
For example, a monotored process has an addProgressListener() method:
private ProgressListener listener;
public void addProgressListener( final ProgressListener newListener )
{
listener = ProgressListenerSet.add( listener, newListener );
}
current - The current ProgressListenerlistener - The ProgressListener to add
java.lang.IllegalArgumentException - if newListener is null
public static ProgressListener remove(ProgressListener current,
ProgressListener listener)
For example, a monotored process has an removeProgressListener() method:
private ProgressListener listener;
public void removeProgressListener( final ProgressListener newListener )
{
listener = ProgressListenerSet.remove( listener, newListener );
}
current - listener -
@WriteLock public boolean add(ProgressListener l)
l - ProgressListener to add
@WriteLock public boolean remove(ProgressListener l)
l - ProgressListener to remove
@ReadLock public boolean isEmpty()
@ReadLock public int size()
@ReadLock public ProgressListener[] getListeners()
public void showProgress(int progress)
ProgressListener
showProgress in interface ProgressListenerprogress - The current value of the process
public void showProgress(long inputSize,
long outputSize)
ProgressListener
showProgress in interface ProgressListenerinputSize - The current size of the input, possibly the amount read so faroutputSize - The current size of the output, probably the total size
of the compressed outputpublic void setMaximum(long maximum)
ProgressListener
setMaximum in interface ProgressListenermaximum - The new maximum
public void setMaximum(long inputMaximum,
long outputMaximum)
ProgressListener
setMaximum in interface ProgressListenerinputMaximum - The new maximum for the inputoutputMaximum - The new maximum for the output.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||