java.lang.Object
org.apache.wicket.util.watch.ModificationWatcher
- All Implemented Interfaces:
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
Nested ClassesModifier and TypeClassDescriptionprotected static final classContainer class for holding modifiable entries to watch. -
Constructor Summary
ConstructorsConstructorDescriptionDefault constructor for two-phase construction.ModificationWatcher(Duration pollFrequency) Constructor that accepts aDurationargument representing the poll frequency. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanadd(IModifiable modifiable, IChangeListener<IModifiable> listener) Adds anIModifiableobject and anIChangeListenerobject to call when the modifiable object is modified.protected voidChecks which IModifiables were modified and notifies their listenersvoiddestroy()Stops thisModificationWatcher.final Set<IModifiable>Retrieves a key set of allIModifiableobjects currently being monitored.remove(IModifiable modifiable) Removes all entries associated with anIModifiableobject.voidStarts watching at a givenDurationpolling rate.
-
Constructor Details
-
ModificationWatcher
public ModificationWatcher()Default constructor for two-phase construction. -
ModificationWatcher
Constructor that accepts aDurationargument representing the poll frequency.- Parameters:
pollFrequency- how often to check onIModifiables
-
-
Method Details
-
add
Description copied from interface:IModificationWatcherAdds anIModifiableobject and anIChangeListenerobject to call when the modifiable object is modified.- Specified by:
addin interfaceIModificationWatcher- Parameters:
modifiable- anIModifiableobject to monitorlistener- anIChangeListenerto call if theIModifiableobject is modified- Returns:
trueif the set did not already contain the specified element
-
remove
Description copied from interface:IModificationWatcherRemoves all entries associated with anIModifiableobject.- Specified by:
removein interfaceIModificationWatcher- Parameters:
modifiable- anIModifiableobject- Returns:
- the
IModifiableobject that was removed, elsenull
-
start
Description copied from interface:IModificationWatcherStarts watching at a givenDurationpolling rate.- Specified by:
startin interfaceIModificationWatcher- Parameters:
pollFrequency- the polling rateDuration
-
checkModified
Checks which IModifiables were modified and notifies their listeners -
destroy
Description copied from interface:IModificationWatcherStops thisModificationWatcher.- Specified by:
destroyin interfaceIModificationWatcher
-
getEntries
Description copied from interface:IModificationWatcherRetrieves a key set of allIModifiableobjects currently being monitored.- Specified by:
getEntriesin interfaceIModificationWatcher- Returns:
- a
Setof allIModifiableentries currently maintained
-