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

Nested Class Summary
protected static class ModificationWatcher.Entry
          Container class for holding modifiable entries to watch.
 
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.
protected  void checkModified()
          Checks which IModifiables were modified and notifies their listeners
 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

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

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

checkModified

protected void checkModified()
Checks which IModifiables were modified and notifies their listeners


destroy

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

Specified by:
destroy in interface IModificationWatcher

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


Copyright © 2006-2012 Apache Software Foundation. All Rights Reserved.