Package sc.bind
Class SelectorBinding
- java.lang.Object
-
- sc.bind.AbstractListener
-
- sc.bind.DestinationListener
-
- sc.bind.SelectorBinding
-
public class SelectorBinding extends DestinationListener
This is a lot like the VariableBinding but works without an initial source object. Instead, the first binding expression is used to produce the source. This means that the first expression can only be an independent binding, i.e. not a property mapping but a VariableBinding, MethodBinding etc.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface sc.bind.IListener
IListener.SyncType
-
-
Field Summary
-
Fields inherited from interface sc.bind.IListener
ARRAY_ELEMENT_CHANGED, ARRAY_ELEMENT_INVALIDATED, ARRAY_ELEMENT_VALIDATED, LISTENER_ADDED, PENDING_VALUE_SENTINEL, UNSET_VALUE_SENTINEL, VALUE_CHANGED, VALUE_CHANGED_MASK, VALUE_INVALIDATED, VALUE_REQUESTED, VALUE_VALIDATED
-
-
Constructor Summary
Constructors Constructor Description SelectorBinding(java.lang.Object[] boundProperties)
Use this form for chaining together this binding with another bindingSelectorBinding(java.lang.Object dstObject, java.lang.Object dstProperty, java.lang.Object[] boundProperties, BindingDirection bindingDirection, int flags, BindOptions opts)
Use this form for a top level binding
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
accessBinding()
void
activate(boolean state, java.lang.Object obj, boolean chained)
Called to deactive/re-activate a child binding for a condition or ternary expressionvoid
addBindingListener(java.lang.Object eventObject, IListener listener, int event)
boolean
applyBinding(java.lang.Object obj, java.lang.Object value, IBinding src, boolean refresh, boolean pendingChild)
One of our downstream values changed.void
applyReverseBinding(java.lang.Object obj, java.lang.Object value, java.lang.Object src)
protected java.lang.Object
getBoundProperty(java.lang.Object bindingParent, int i)
protected java.lang.Object
getBoundValue(boolean pendingChild)
protected java.lang.Object
getBoundValueForChild(IBinding child)
java.lang.Object
getPropertyValue(java.lang.Object obj, boolean getField, boolean pendingChild)
Retrieves the current value of the binding given the current object.ISet<java.lang.Object>
getReads()
ISet<java.lang.Object>
getWrites()
protected void
initBinding()
protected void
initFlagsOnChildren(int flags)
java.lang.Object
initializeBinding()
Called to initialize and retrieve the value of a top-level bindingvoid
invalidateBinding(java.lang.Object obj, boolean sendEvent, int event, boolean includeParams)
boolean
isConstant()
boolean
isReversible()
boolean
isValid()
int
refreshBinding()
void
removeBindingListener(java.lang.Object eventObject, IListener listener, int event)
void
removeListener()
void
setBindingParent(IBinding parent, BindingDirection dir)
Called by the parent when this is a hierarchical binding - i.e.java.lang.String
toString(java.lang.String operation, boolean displayValue)
boolean
valueInvalidated(java.lang.Object srcObject, java.lang.Object srcProp, java.lang.Object eventDetail, boolean apply)
void
valueRequested(java.lang.Object obj, IBeanMapper prop)
boolean
valueValidated(java.lang.Object srcObject, java.lang.Object srcProp, java.lang.Object eventDetail, boolean apply)
-
Methods inherited from class sc.bind.DestinationListener
accessObj, addCurrentScopeContext, applyPendingChildValue, getCurrentScopeContexts, getTrace, getUnsetOrPending, getVerbose, initFlags, isCrossScope, isDefinedObject, isValidObject, toString, toString
-
Methods inherited from class sc.bind.AbstractListener
arrayElementChanged, arrayElementInvalidated, arrayElementValidated, getPriority, getSync, listenerAdded, parentBindingChanged, performCast, valueChanged, valueRequested
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface sc.bind.IBinding
parentBindingChanged, performCast
-
-
-
-
Constructor Detail
-
SelectorBinding
public SelectorBinding(java.lang.Object[] boundProperties)
Use this form for chaining together this binding with another binding
-
SelectorBinding
public SelectorBinding(java.lang.Object dstObject, java.lang.Object dstProperty, java.lang.Object[] boundProperties, BindingDirection bindingDirection, int flags, BindOptions opts)
Use this form for a top level binding
-
-
Method Detail
-
isValid
public boolean isValid()
- Specified by:
isValid
in classDestinationListener
-
setBindingParent
public void setBindingParent(IBinding parent, BindingDirection dir)
Called by the parent when this is a hierarchical binding - i.e. one expression in another
-
initializeBinding
public java.lang.Object initializeBinding()
Called to initialize and retrieve the value of a top-level binding
-
initBinding
protected void initBinding()
-
getBoundValue
protected java.lang.Object getBoundValue(boolean pendingChild)
-
removeListener
public void removeListener()
-
valueRequested
public void valueRequested(java.lang.Object obj, IBeanMapper prop)
-
valueInvalidated
public boolean valueInvalidated(java.lang.Object srcObject, java.lang.Object srcProp, java.lang.Object eventDetail, boolean apply)
- Specified by:
valueInvalidated
in interfaceIListener
- Overrides:
valueInvalidated
in classAbstractListener
-
valueValidated
public boolean valueValidated(java.lang.Object srcObject, java.lang.Object srcProp, java.lang.Object eventDetail, boolean apply)
- Specified by:
valueValidated
in interfaceIListener
- Overrides:
valueValidated
in classAbstractListener
-
getReads
public ISet<java.lang.Object> getReads()
-
getWrites
public ISet<java.lang.Object> getWrites()
-
invalidateBinding
public void invalidateBinding(java.lang.Object obj, boolean sendEvent, int event, boolean includeParams)
-
applyBinding
public boolean applyBinding(java.lang.Object obj, java.lang.Object value, IBinding src, boolean refresh, boolean pendingChild)
One of our downstream values changed. We need to figure out which one it was. If the value changed, we need to re-evaluate all subsequent binding expressions after the one that changed.
-
applyReverseBinding
public void applyReverseBinding(java.lang.Object obj, java.lang.Object value, java.lang.Object src)
-
getPropertyValue
public java.lang.Object getPropertyValue(java.lang.Object obj, boolean getField, boolean pendingChild)
Description copied from interface:IBinding
Retrieves the current value of the binding given the current object. Use getField = true to force use of the field, rather than the getX method if one exists. Use pendingChild = true for a special case where we are getting the property value of a binding that is part of a reverse binding but where the cached value is up-to-update because we are updating a child remote property.
-
addBindingListener
public void addBindingListener(java.lang.Object eventObject, IListener listener, int event)
-
removeBindingListener
public void removeBindingListener(java.lang.Object eventObject, IListener listener, int event)
-
isConstant
public boolean isConstant()
-
toString
public java.lang.String toString(java.lang.String operation, boolean displayValue)
- Overrides:
toString
in classDestinationListener
-
getBoundProperty
protected java.lang.Object getBoundProperty(java.lang.Object bindingParent, int i)
-
activate
public void activate(boolean state, java.lang.Object obj, boolean chained)
Description copied from interface:IBinding
Called to deactive/re-activate a child binding for a condition or ternary expression- Specified by:
activate
in interfaceIBinding
- Overrides:
activate
in classAbstractListener
-
refreshBinding
public int refreshBinding()
- Specified by:
refreshBinding
in classDestinationListener
-
accessBinding
public void accessBinding()
- Overrides:
accessBinding
in classDestinationListener
-
isReversible
public boolean isReversible()
-
getBoundValueForChild
protected java.lang.Object getBoundValueForChild(IBinding child)
- Specified by:
getBoundValueForChild
in classDestinationListener
-
initFlagsOnChildren
protected void initFlagsOnChildren(int flags)
- Overrides:
initFlagsOnChildren
in classDestinationListener
-
-