Package io.guise.framework.model
Class MutualExclusionPolicyModelGroup
- java.lang.Object
-
- io.guise.framework.model.AbstractModelGroup<ValueModel<V>>
-
- io.guise.framework.model.ValuePolicyModelGroup<java.lang.Boolean>
-
- io.guise.framework.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 totrue
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
Constructors Constructor Description MutualExclusionPolicyModelGroup()
Default constructor.MutualExclusionPolicyModelGroup(ValueModel<java.lang.Boolean>... models)
Model constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ValueModel<java.lang.Boolean>
getSelectedModel()
void
propertyChange(com.globalmentor.beans.GenericPropertyChangeEvent<java.lang.Boolean> propertyChangeEvent)
-
Methods inherited from class io.guise.framework.model.ValuePolicyModelGroup
addImpl, propertyChange, removeImpl
-
Methods inherited from class io.guise.framework.model.AbstractModelGroup
add, contains, getModelSet, remove
-
-
-
-
Constructor Detail
-
MutualExclusionPolicyModelGroup
public MutualExclusionPolicyModelGroup()
Default constructor. Provided to prevent array of generic types warning.
-
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 isnull
.
-
-
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)
-
-