|
Search this API | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object y.option.ConstraintManager
public class ConstraintManager
Provides convenience methods for creating editor constraints.
Nested Class Summary | |
---|---|
static class |
ConstraintManager.Condition
A Condition that can be used to trigger or control different behavior. |
static interface |
ConstraintManager.ConditionCheck
Implementations of this interface are queried by the ConstraintManager as soon as properties of an editor change. |
static interface |
ConstraintManager.EditorAction
An action-callback that is invoked in response to either performActionOnPropertyChange(y.option.ConstraintManager.EditorAction, OptionItem)
or
performActionOnCondition(y.option.ConstraintManager.EditorAction, y.option.ConstraintManager.Condition) . |
Constructor Summary | |
---|---|
ConstraintManager(OptionHandler handler)
Creates a new instance of ConstraintManager for the specified option handler. |
Method Summary | |
---|---|
ConstraintManager.Condition |
createCondition(OptionItem item,
ConstraintManager.ConditionCheck check)
Creates a Condition whose value is calculated by the given checker when a property of the indicated item changes. |
ConstraintManager.Condition |
createConditionValueEquals(OptionItem source,
java.lang.Object value)
Creates a Condition object that yields true if the source item
changes its value to the given value. |
ConstraintManager.Condition |
createConditionValueEquals(OptionItem source,
java.lang.Object value,
boolean reverse)
Creates a Condition object that yields true if the source item
changes its value to the given value. |
ConstraintManager.Condition |
createConditionValueEquals(java.lang.String source,
java.lang.Object value)
Creates a Condition object that yields true if the item
which is identified by the source parameter changes its value to the given value. |
ConstraintManager.Condition |
createConditionValueIs(OptionItem source,
java.util.Collection values)
Creates a Condition object that yields true if the source item
changes its value to one of the values from the provided collection. |
ConstraintManager.Condition |
createConditionValueIs(OptionItem source,
java.util.Collection values,
boolean reverse)
Creates a Condition object that yields true if the source item
changes its value to one of the values from the provided collection of values. |
ConstraintManager.Condition |
createConditionValueIs(OptionItem source,
java.lang.Object[] values)
Creates a Condition object that yields true if the source item
changes its value to one of the values from the provided array of values. |
ConstraintManager.Condition |
createConditionValueIs(java.lang.String source,
java.util.Collection values)
Creates a Condition object that yields true if the source item
changes its value to one of the values from the provided collection. |
ConstraintManager.Condition |
createConditionValueIs(java.lang.String source,
java.lang.Object[] values)
Creates a Condition object that yields true if the source item
changes its value to one of the values from the provided array of values. |
OptionHandler |
getHandler()
Returns the option handler for which this manager was created. |
protected void |
installConstraints(Editor editor)
Tries to install all previously created constraints for the specified editor. |
void |
performActionOnCondition(ConstraintManager.EditorAction editorAction,
ConstraintManager.Condition condition)
Registers an action that will be triggered as soon as the condition changes to true |
void |
performActionOnPropertyChange(ConstraintManager.EditorAction editorAction,
OptionItem onItem)
Registers an action that will be triggered as soon as there is a property change on the editor of the given item. |
void |
setEnabledOnCondition(ConstraintManager.Condition c,
OptionGroup target)
Creates a constraint that is triggered when the value of the condition changes. |
void |
setEnabledOnCondition(ConstraintManager.Condition c,
OptionItem target)
Creates a constraint that is triggered when the value of the condition changes. |
void |
setEnabledOnValueEquals(OptionItem source,
java.lang.Object value,
OptionGroup target)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(OptionItem source,
java.lang.Object value,
OptionGroup target,
boolean invert)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(OptionItem source,
java.lang.Object value,
OptionItem target)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(OptionItem source,
java.lang.Object value,
OptionItem target,
boolean invert)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(java.lang.String source,
java.lang.Object value,
OptionGroup target)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(java.lang.String source,
java.lang.Object value,
OptionGroup target,
boolean invert)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(java.lang.String source,
java.lang.Object value,
java.lang.String target)
Creates a constraint that is triggered when the value of the source item is changed. |
void |
setEnabledOnValueEquals(java.lang.String source,
java.lang.Object value,
java.lang.String target,
boolean invert)
Creates a constraint that is triggered when the value of the source item is changed. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ConstraintManager(OptionHandler handler)
handler
- the handler this ConstraintManager instance is associated withMethod Detail |
---|
public OptionHandler getHandler()
public void setEnabledOnValueEquals(java.lang.String source, java.lang.Object value, java.lang.String target)
source
- the name of the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the name of the OptionItem to set the enabled statepublic void setEnabledOnValueEquals(java.lang.String source, java.lang.Object value, java.lang.String target, boolean invert)
source
- the name of the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the name of the OptionItem to receive the constraint actioninvert
- if true
, setEnabled( false )
will
be invoked on target;
else setEnabled( true )
will be invoked onpublic void setEnabledOnCondition(ConstraintManager.Condition c, OptionItem target)
c
- the condition to querytarget
- the target item to enable depending on the state of the conditionpublic void setEnabledOnCondition(ConstraintManager.Condition c, OptionGroup target)
c
- the condition to querytarget
- the target group to enable depending on the state of the conditionpublic ConstraintManager.Condition createConditionValueEquals(java.lang.String source, java.lang.Object value)
true
if the item
which is identified by the source parameter changes its value to the given value.
source
- the name of the itemvalue
- the value used for comparison
public ConstraintManager.Condition createConditionValueEquals(OptionItem source, java.lang.Object value)
true
if the source item
changes its value to the given value.
source
- the item to inspectvalue
- the value used for comparison
public ConstraintManager.Condition createConditionValueEquals(OptionItem source, java.lang.Object value, boolean reverse)
true
if the source item
changes its value to the given value. If the reverse
parameter
is true
the behavior is reversed.
source
- the item to inspectvalue
- the value used for comparison
public ConstraintManager.Condition createConditionValueIs(java.lang.String source, java.util.Collection values)
true
if the source item
changes its value to one of the values from the provided collection.
source
- the item to inspectvalues
- the value used for comparison
public ConstraintManager.Condition createConditionValueIs(OptionItem source, java.util.Collection values)
true
if the source item
changes its value to one of the values from the provided collection.
source
- the item to inspectvalues
- the value used for comparison
public ConstraintManager.Condition createConditionValueIs(java.lang.String source, java.lang.Object[] values)
true
if the source item
changes its value to one of the values from the provided array of values.
source
- the item to inspectvalues
- the value used for comparison
public ConstraintManager.Condition createConditionValueIs(OptionItem source, java.lang.Object[] values)
true
if the source item
changes its value to one of the values from the provided array of values.
source
- the item to inspectvalues
- the value used for comparison
public ConstraintManager.Condition createConditionValueIs(OptionItem source, java.util.Collection values, boolean reverse)
true
if the source item
changes its value to one of the values from the provided collection of values.
If the reverse
parameter
is true
the behavior is reversed.
source
- the item to inspectvalues
- the value used for comparisonreverse
- true
iff the condition's state should be reversed
public ConstraintManager.Condition createCondition(OptionItem item, ConstraintManager.ConditionCheck check)
item
- the item whose property changes will be observedcheck
- an object that yields the current state of the condition
public void setEnabledOnValueEquals(OptionItem source, java.lang.Object value, OptionItem target)
source
- the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionItem to set the enabled statepublic void setEnabledOnValueEquals(OptionItem source, java.lang.Object value, OptionItem target, boolean invert)
source
- the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionItem to receive the constraint actioninvert
- if true
, setEnabled( false )
will
be invoked on target;
else setEnabled( true )
will be invoked onpublic void setEnabledOnValueEquals(java.lang.String source, java.lang.Object value, OptionGroup target)
source
- the name of the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionGroup to set the enabled statepublic void setEnabledOnValueEquals(java.lang.String source, java.lang.Object value, OptionGroup target, boolean invert)
source
- the name of the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionGroup to receive the constraint actioninvert
- if true
, setEnabled( false )
will
be invoked on target;
else setEnabled( true )
will be invoked onpublic void setEnabledOnValueEquals(OptionItem source, java.lang.Object value, OptionGroup target)
source
- the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionGroup to set the enabled statepublic void setEnabledOnValueEquals(OptionItem source, java.lang.Object value, OptionGroup target, boolean invert)
source
- the OptionItem used as constraint conditionvalue
- the value that triggers the constraint actiontarget
- the OptionGroup to receive the constraint actioninvert
- if true
, setEnabled( false )
will
be invoked on target;
else setEnabled( true )
will be invoked onpublic void performActionOnPropertyChange(ConstraintManager.EditorAction editorAction, OptionItem onItem)
editorAction
- the action to perform if the corresponding item fires a property change eventonItem
- the item whose editor instances will be observedpublic void performActionOnCondition(ConstraintManager.EditorAction editorAction, ConstraintManager.Condition condition)
true
editorAction
- the action to perform if the corresponding item fires a property change eventcondition
- the condition that will be observedprotected void installConstraints(Editor editor)
editorAdded
notifications.
|
© Copyright 2000-2022, yWorks GmbH. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |