de.matthiasmann.twl.model
Class HasCallback

java.lang.Object
  extended by de.matthiasmann.twl.model.HasCallback
All Implemented Interfaces:
WithRunnableCallback
Direct Known Subclasses:
AbstractEnumModel, AbstractFloatModel, AbstractIntegerModel, BitfieldBooleanModel, HTMLTextAreaModel, PersistentBooleanModel, PersistentColorModel, PersistentStringModel, SimpleBooleanModel, SimpleDateModel, SimpleIntegerModel, SimpleListSelectionModel, SimpleStringModel, SimpleTextAreaModel, TabbedPane.Tab

public class HasCallback
extends java.lang.Object
implements WithRunnableCallback

A class to manage callbacks.


Constructor Summary
HasCallback()
           
 
Method Summary
 void addCallback(java.lang.Runnable callback)
          Adds a callback to the list.
protected  void doCallback()
          Calls all registered callbacks.
 boolean hasCallbacks()
          Returns true when the callback list is not empty
 void removeCallback(java.lang.Runnable callback)
          Removes a callback from the list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HasCallback

public HasCallback()
Method Detail

addCallback

public void addCallback(java.lang.Runnable callback)
Adds a callback to the list.

Specified by:
addCallback in interface WithRunnableCallback
Parameters:
callback - the callback

removeCallback

public void removeCallback(java.lang.Runnable callback)
Removes a callback from the list.

Specified by:
removeCallback in interface WithRunnableCallback
Parameters:
callback - the callback that should be removed

hasCallbacks

public boolean hasCallbacks()
Returns true when the callback list is not empty

Returns:
true when the callback list is not empty

doCallback

protected void doCallback()
Calls all registered callbacks. Callbacks can call addCallback or removeCallback. Modification to the callback list will only be visible to the next doCallback call.

See Also:
addCallback(java.lang.Runnable), removeCallback(java.lang.Runnable)