coreRuntime/src/sc/bind/AbstractMethodBinding.java
public Object initializeBinding() {
      assert dstObj != dstProp; // This should only be called for a top-level binding
      initParams();

      Object result = null;
      if (direction.doForward()) {
         if (!activated)
            result = null;
         else {
            result = invokeMethod(methObj, false);
            if (isDefinedObject(result))
               valid = true;
         }
         boundValue = result;
      }
      if (direction.doReverse()) {
         // TODO: need flag for "read-only" bindings - throw if it is a read-only
         if (dstProp instanceof IBinding)
            ((IBinding)dstProp).addBindingListener(dstObj, this, VALUE_CHANGED_MASK);
         else
            PBindUtil.addBindingListener(dstObj, dstProp, this, VALUE_CHANGED_MASK);

         // This is a bit of a hack.  For reverse only bindings, we should not be changing the value of the dst property
         // at all.  When the binding replaces the assignment expression, it's awkward to rewrite the code so the
         // property assignment never happens (TODO: is this still true? reverse bindings do not set the destination property)
         // In some cases we do also need to register the IChangeable hook and keep it up to date in the value change part
         if (!direction.doForward()) {
            if (dstProp == null)
               System.out.println("*** Null property in binding");
            boundValue = PBindUtil.getPropertyValue(dstObj, dstProp, false, false);

            if (useReverseListener()) {
               if (boundValue instanceof IChangeable)
                  Bind.addListener(boundValue, null, this, VALUE_CHANGED_MASK);
            }
            result = boundValue;
         }
      }
      //if (trace)
      //   System.out.println("Init: " + toString());
      if (!isDefinedObject(result))
         result = null;
      return result;
   }
/** Called only for top level bindings */
Called only for top level bindings
Called only for top level bindings
public Object initializeBinding() {
      assert dstObj != dstProp; 
      initParams();
      Object result = null;
      if (direction.doForward()) {
         if (!activated)
            result = null;
         else {
            result = invokeMethod(methObj, false);
            if (isDefinedObject(result))
               valid = true;
         }
         boundValue = result;
      }
      if (direction.doReverse()) {
         if (dstProp instanceof IBinding)
            ((IBinding)dstProp).addBindingListener(dstObj, this, VALUE_CHANGED_MASK);
         else
            PBindUtil.addBindingListener(dstObj, dstProp, this, VALUE_CHANGED_MASK);
         if (!direction.doForward()) {
            if (dstProp == null)
               System.out.println("*** Null property in binding");
            boundValue = PBindUtil.getPropertyValue(dstObj, dstProp, false, false);
            if (useReverseListener()) {
               if (boundValue instanceof IChangeable)
                  Bind.addListener(boundValue, null, this, VALUE_CHANGED_MASK);
            }
            result = boundValue;
         }
      }
      if (!isDefinedObject(result))
         result = null;
      return result;
   }
public Object initializeBinding ( ) { assert dstObj != dstProp ; initParams ( ) ; Object result = null ; if ( direction . doForward ( ) ) { if ( ! activated ) result = null ; else { result = invokeMethod ( methObj , false ) ; if ( isDefinedObject ( result ) ) valid = true ; } boundValue = result ; } if ( direction . doReverse ( ) ) { if ( dstProp instanceof IBinding ) ( ( IBinding ) dstProp ) . addBindingListener ( dstObj , this , VALUE_CHANGED_MASK ) ; else PBindUtil . addBindingListener ( dstObj , dstProp , this , VALUE_CHANGED_MASK ) ; if ( ! direction . doForward ( ) ) { if ( dstProp == null ) System . out . println ( "*** Null property in binding" ) ; boundValue = PBindUtil . getPropertyValue ( dstObj , dstProp , false , false ) ; if ( useReverseListener ( ) ) { if ( boundValue instanceof IChangeable ) Bind . addListener ( boundValue , null , this , VALUE_CHANGED_MASK ) ; } result = boundValue ; } } if ( ! isDefinedObject ( result ) ) result = null ; return result ; }
Called only for top level bindings
Called only for top level bindings
// This should only be called for a top-level binding // TODO: need flag for "read-only" bindings - throw if it is a read-only // This is a bit of a hack.  For reverse only bindings, we should not be changing the value of the dst property // at all.  When the binding replaces the assignment expression, it's awkward to rewrite the code so the // property assignment never happens (TODO: is this still true? reverse bindings do not set the destination property) // In some cases we do also need to register the IChangeable hook and keep it up to date in the value change part //if (trace) //   System.out.println("Init: " + toString());