org.apache.wicket.util.watch
Class ModificationWatcher

java.lang.Object
  extended by org.apache.wicket.util.watch.ModificationWatcher

public final class ModificationWatcher
extends java.lang.Object

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.
 java.util.Set 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)
Adds an IModifiable object and an IChangeListener object to call when the modifiable object is modified.

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)
Removes all entries associated with an IModifiable object.

Parameters:
modifiable - an IModifiable object
Returns:
the IModifiable object that was removed, else null

start

public void start(Duration pollFrequency)
Starts watching at a given Duration polling rate.

Parameters:
pollFrequency - the polling rate Duration

destroy

public void destroy()
Stops this ModificationWatcher.


getEntries

public final java.util.Set getEntries()
Retrieves a key set of all IModifiable objects currently being monitored.

Returns:
a Set of all IModifiable entries currently maintained


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