Exemple #1
0
 public void setBinding(AbstractBinding value) {
   AbstractBinding oldValue = this.binding;
   if (oldValue == null) {
     if (value == null) {
       return; // No change
     } else {
       this.binding = value;
       unparsedBinding = value != null ? value.getStringRepresentation() : null;
       updateDependancies();
       if (bindingAttribute != null) {
         owner.notify(
             new FIBAttributeNotification<AbstractBinding>(bindingAttribute, oldValue, value));
       }
       owner.notifyBindingChanged(this);
       return;
     }
   } else {
     if (oldValue.equals(value)) {
       return; // No change
     } else {
       this.binding = value;
       unparsedBinding = value != null ? value.getStringRepresentation() : null;
       if (logger.isLoggable(Level.FINE)) {
         logger.fine("Binding takes now value " + value);
       }
       updateDependancies();
       if (bindingAttribute != null) {
         owner.notify(
             new FIBAttributeNotification<AbstractBinding>(bindingAttribute, oldValue, value));
       }
       owner.notifyBindingChanged(this);
       return;
     }
   }
 }
Exemple #2
0
  protected void finalizeDeserialization(boolean silentMode) {
    if (getUnparsedBinding() == null) {
      return;
    }

    /*if (getUnparsedBinding().equals("data.isAcceptableAsSubProcess(SubProcess.component.candidateValue)")) {
    	System.out.println("finalizeDeserialization for "+getUnparsedBinding());
    	System.out.println("Owner: "+getOwner()+" of "+getOwner().getClass());
    	System.out.println("BindingModel: "+getOwner().getBindingModel());
    }*/

    // System.out.println("BindingModel: "+getOwner().getBindingModel());
    if (getBindable() != null) {
      BindingFactory factory = getBindingFactory();
      factory.setBindable(getBindable());
      binding = factory.convertFromString(getUnparsedBinding());
      binding.setBindingDefinition(getBindingDefinition());
      // System.out.println(">>>>>>>>>>>>>> Binding: "+binding.getStringRepresentation()+"
      // owner="+binding.getOwner());
      // System.out.println("binding.isBindingValid()="+binding.isBindingValid());
    }

    if (binding == null) {
      logger.warning("Unexpected null binding for [" + getUnparsedBinding() + "]");
    }

    if (binding != null && !binding.isBindingValid()) {
      if (!silentMode) {
        logger.warning(
            "Binding not valid: "
                + binding
                + " for owner "
                + getOwner()
                + " context="
                + (getOwner() != null ? getOwner().getRootComponent() : null));
        // Dev note: Uncomment following to get more informations
        // logger.warning("Binding not valid: " + binding + " for owner " + getOwner() + " context="
        // + (getOwner() != null ? (getOwner()).getRootComponent() : null));
        // logger.info("BindingModel=" + getOwner().getBindingModel());
        // logger.info("BindingFactory=" + getOwner().getBindingFactory());
        // binding.debugIsBindingValid();
        // BindingExpression.logger.setLevel(Level.FINE);
        // binding =
        // AbstractBinding.abstractBindingConverter.convertFromString(getUnparsedBinding());
        // binding.setBindingDefinition(getBindingDefinition());
        // binding.isBindingValid();
        // (new Exception("prout")).printStackTrace();
        // System.exit(-1);
      }
    }

    updateDependancies();
  }