org.apache.wicket.util.watch
Class ModificationWatcher

java.lang.Object
  extended by org.apache.wicket.util.watch.ModificationWatcher
All Implemented Interfaces:
IModificationWatcher

public class ModificationWatcher
extends Object
implements IModificationWatcher

Monitors one or more IModifiable objects, calling a IChangeListener when a given object's modification time changes.

Since:
1.2.6
Author:
Jonathan Locke

Constructor Summary
ModificationWatcher()
          Default constructor for two-phase construction.
ModificationWatcher(Duration pollFrequency)
          Constructor that accepts a Duration argument representing the poll frequency.
 
Method Summary
 boolean add(IModifiable modifiable, IChangeListener listener)
          Adds an IModifiable object and an IChangeListener object to call when the modifiable object is modified.
 void destroy()
          Stops this ModificationWatcher.
 Set<IModifiable> getEntries()
          Retrieves a key set of all IModifiable objects currently being monitored.
 IModifiable remove(IModifiable modifiable)
          Removes all entries associated with an IModifiable object.
 void start(Duration pollFrequency)
          Starts watching at a given Duration polling rate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ModificationWatcher

public ModificationWatcher()
Default constructor for two-phase construction.


ModificationWatcher

public ModificationWatcher(Duration pollFrequency)
Constructor that accepts a Duration argument representing the poll frequency.

Parameters:
pollFrequency - how often to check on IModifiables
Method Detail

add

public final boolean add(IModifiable modifiable,
                         IChangeListener listener)
Description copied from interface: IModificationWatcher
Adds an IModifiable object and an IChangeListener object to call when the modifiable object is modified.

Specified by:
add in interface IModificationWatcher
Parameters:
modifiable - an IModifiable object to monitor
listener - an IChangeListener to call if the IModifiable object is modified
Returns:
true if the set did not already contain the specified element
See Also:
IModificationWatcher.add(org.apache.wicket.util.watch.IModifiable, org.apache.wicket.util.listener.IChangeListener)

remove

public IModifiable remove(IModifiable modifiable)
Description copied from interface: IModificationWatcher
Removes all entries associated with an IModifiable object.

Specified by:
remove in interface IModificationWatcher
Parameters:
modifiable - an IModifiable object
Returns:
the IModifiable object that was removed, else null
See Also:
IModificationWatcher.remove(org.apache.wicket.util.watch.IModifiable)

start

public void start(Duration pollFrequency)
Description copied from interface: IModificationWatcher
Starts watching at a given Duration polling rate.

Specified by:
start in interface IModificationWatcher
Parameters:
pollFrequency - the polling rate Duration
See Also:
IModificationWatcher.start(org.apache.wicket.util.time.Duration)

destroy

public void destroy()
Description copied from interface: IModificationWatcher
Stops this ModificationWatcher.

Specified by:
destroy in interface IModificationWatcher
See Also:
IModificationWatcher.destroy()

getEntries

public final Set<IModifiable> getEntries()
Description copied from interface: IModificationWatcher
Retrieves a key set of all IModifiable objects currently being monitored.

Specified by:
getEntries in interface IModificationWatcher
Returns:
a Set of all IModifiable entries currently maintained
See Also:
IModificationWatcher.getEntries()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.