com.guiseframework.model
Class MutualExclusionPolicyModelGroup

java.lang.Object
  extended by com.guiseframework.model.AbstractModelGroup<ValueModel<V>>
      extended by com.guiseframework.model.ValuePolicyModelGroup<java.lang.Boolean>
          extended by com.guiseframework.model.MutualExclusionPolicyModelGroup
All Implemented Interfaces:
com.globalmentor.beans.GenericPropertyChangeListener<java.lang.Boolean>, ModelGroup<ValueModel<java.lang.Boolean>>, java.beans.PropertyChangeListener, java.util.EventListener

public final class MutualExclusionPolicyModelGroup
extends ValuePolicyModelGroup<java.lang.Boolean>

A group that ensures that only one boolean model in the group is set to true at the same time. This class is declared final because it represents a particular defined semantics, no more and no less. This allows controllers to make assumptions about models with only this listener, and offload mutual exclusion to client that have this capability built in. The current implementation will only update the selected model for models that are already a part of the group.

Author:
Garret Wilson.

Constructor Summary
MutualExclusionPolicyModelGroup(ValueModel<java.lang.Boolean>... models)
          Model constructor.
 
Method Summary
 ValueModel<java.lang.Boolean> getSelectedModel()
           
 void propertyChange(com.globalmentor.beans.GenericPropertyChangeEvent<java.lang.Boolean> propertyChangeEvent)
          Called when the boolean model value is changed.
 
Methods inherited from class com.guiseframework.model.ValuePolicyModelGroup
addImpl, propertyChange, removeImpl
 
Methods inherited from class com.guiseframework.model.AbstractModelGroup
add, contains, getModelSet, remove
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MutualExclusionPolicyModelGroup

public MutualExclusionPolicyModelGroup(ValueModel<java.lang.Boolean>... models)
Model constructor.

Parameters:
models - Zero or more models with which to initially place in the group.
Throws:
java.lang.NullPointerException - if one of the models is null.
Method Detail

getSelectedModel

public ValueModel<java.lang.Boolean> getSelectedModel()
Returns:
The currently selected model.

propertyChange

public void propertyChange(com.globalmentor.beans.GenericPropertyChangeEvent<java.lang.Boolean> propertyChangeEvent)
Called when the boolean model value is changed.

Parameters:
propertyChangeEvent - An event object describing the event source, the property that has changed, and its old and new values.


Copyright © 2005-2010 GlobalMentor, Inc. All Rights Reserved.