net.sf.colossus.common
Class IOptions.Listener

java.lang.Object
  extended by net.sf.colossus.common.IOptions.Listener
Enclosing interface:
IOptions

public abstract static class IOptions.Listener
extends java.lang.Object

A callback interface for changes to the options. This is a bit like PropertyChangeListener, only that we currently still use a lot of booleans and ints. Replacing them with Boolean and Integer instances would allow us to just make a proper Java Bean. This class is meant to be extended as anonymous inner class with exactly one method overridden matching the type of the option specified, i.e. if the option "showSomething" is a boolean value, then the a listener for that option should look like this: options.addListener("showSomething", new Listener() { public void booleanOptionChanged(String optname, boolean oldValue, boolean newValue) { .... do something ... } } It is also always possible to subscribe to options by their String value. Of course that is one-way, if there is a need to remove the listener individually a reference has to be kept. TODO get rid of this, ideally use something that has an Option or similar to make things typesafe all the way through. Note that setting a boolean or int value as string will potentially avoid listeners.


Constructor Summary
IOptions.Listener()
           
 
Method Summary
 void booleanOptionChanged(java.lang.String optname, boolean oldValue, boolean newValue)
           
 void intOptionChanged(java.lang.String optname, int oldValue, int newValue)
           
 void stringOptionChanged(java.lang.String optname, java.lang.String oldValue, java.lang.String newValue)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IOptions.Listener

public IOptions.Listener()
Method Detail

booleanOptionChanged

public void booleanOptionChanged(java.lang.String optname,
                                 boolean oldValue,
                                 boolean newValue)

intOptionChanged

public void intOptionChanged(java.lang.String optname,
                             int oldValue,
                             int newValue)

stringOptionChanged

public void stringOptionChanged(java.lang.String optname,
                                java.lang.String oldValue,
                                java.lang.String newValue)