Class IOptions.Listener

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

public abstract static class IOptions.Listener extends 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 Details

    • Listener

      public Listener()
  • Method Details

    • booleanOptionChanged

      public void booleanOptionChanged(String optname, boolean oldValue, boolean newValue)
    • intOptionChanged

      public void intOptionChanged(String optname, int oldValue, int newValue)
    • stringOptionChanged

      public void stringOptionChanged(String optname, String oldValue, String newValue)