Package io.guise.framework.model
Class MutualExclusionPolicyModelGroup
java.lang.Object
io.guise.framework.model.AbstractModelGroup<ValueModel<V>>
io.guise.framework.model.ValuePolicyModelGroup<Boolean>
io.guise.framework.model.MutualExclusionPolicyModelGroup
- All Implemented Interfaces:
com.globalmentor.beans.GenericPropertyChangeListener<Boolean>
,ModelGroup<ValueModel<Boolean>>
,PropertyChangeListener
,EventListener
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
ConstructorDescriptionDefault constructor.MutualExclusionPolicyModelGroup
(ValueModel<Boolean>... models) Model constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
propertyChange
(com.globalmentor.beans.GenericPropertyChangeEvent<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 Details
-
MutualExclusionPolicyModelGroup
public MutualExclusionPolicyModelGroup()Default constructor. Provided to prevent array of generic types warning. -
MutualExclusionPolicyModelGroup
Model constructor.- Parameters:
models
- Zero or more models with which to initially place in the group.- Throws:
NullPointerException
- if one of the models isnull
.
-
-
Method Details
-
getSelectedModel
- Returns:
- The currently selected model.
-
propertyChange
public void propertyChange(com.globalmentor.beans.GenericPropertyChangeEvent<Boolean> propertyChangeEvent)
-