Examples of IValueConverter


Examples of org.eclipse.e4.xwt.IValueConverter

    }
    return convertedValue(dataContext);
  }

  private Object convertedValue(Object value) {
    IValueConverter converter = getConverter();
    if (converter != null) {
      value = converter.convert(value);
    }
    return value;
  }
View Full Code Here

Examples of org.eclipse.e4.xwt.IValueConverter

        && target instanceof IObservableValue) {
      return bindValue((IObservableValue) source,
          (IObservableValue) target, dataBinding);
    } else if (source instanceof IObservableSet
        && target instanceof IObservableSet) {
      IValueConverter converter = null;
      int sourceToTargetPolicy = UpdateSetStrategy.POLICY_UPDATE;
      int targetToSourcePolicy = UpdateSetStrategy.POLICY_UPDATE;
      // Set policy to UpdateValueStrategy.
      if (dataBinding != null) {
        switch (dataBinding.getMode()) {
        case OneWay:
          targetToSourcePolicy = UpdateSetStrategy.POLICY_NEVER;
          break;
        case OneTime:
          sourceToTargetPolicy = UpdateSetStrategy.POLICY_NEVER;
          targetToSourcePolicy = UpdateSetStrategy.POLICY_NEVER;
          break;
        default:
          break;
        }
        converter = dataBinding.getConverter();
      }
      UpdateSetStrategy sourceToTarget = new UpdateSetStrategy(
          sourceToTargetPolicy);
      UpdateSetStrategy targetToSource = new UpdateSetStrategy(
          targetToSourcePolicy);
      return bindSet((IObservableSet) target, (IObservableSet) source,
          targetToSource, sourceToTarget, converter);
    } else if (source instanceof IObservableList
        && target instanceof IObservableList) {
      IValueConverter converter = null;
      int sourceToTargetPolicy = UpdateListStrategy.POLICY_UPDATE;
      int targetToSourcePolicy = UpdateListStrategy.POLICY_UPDATE;
      // Set policy to UpdateValueStrategy.
      if (dataBinding != null) {
        switch (dataBinding.getMode()) {
View Full Code Here

Examples of org.eclipse.e4.xwt.IValueConverter

   * databinding.observable.value.IObservableValue,
   * org.eclipse.core.databinding.observable.value.IObservableValue)
   */
  private Binding bindValue(IObservableValue source, IObservableValue target,
      IDataBindingInfo dataBinding) {
    IValueConverter converter = null;
    IValidationRule[] validators = null;
    int sourceToTargetPolicy = UpdateValueStrategy.POLICY_UPDATE;
    int targetToSourcePolicy = UpdateValueStrategy.POLICY_UPDATE;
    // Set policy to UpdateValueStrategy.
    if (dataBinding != null) {
View Full Code Here

Examples of org.eclipse.e4.xwt.IValueConverter

        }
        Object value = sourceWidget.getValue();
        while(value instanceof IObservableValue) {
          value = ((IObservableValue)value).getValue();
        }
        IValueConverter converter = getConverter();
        if (converter != null) {
          value = converter.convert(value);
        }
        return value;
      }
      return source;
    }

    IBindingContext dataBindingContext = getDataBindingContext();
    BindingGate bindingGate = new BindingGate(dataBindingContext);
    bindingGate.bind(sourceWidget, targetWidget, this);
    if (sourceWidget != null) {
      if (targetType != null && !targetType.isInstance(sourceWidget)) {
        return sourceWidget;     
      }
      // convert to final value
      Object value = sourceWidget.getValue();
      while(value instanceof IObservableValue) {
        value = ((IObservableValue)value).getValue();
      }
      IValueConverter converter = getConverter();
      if (converter != null) {
        value = converter.convert(value);
      }
      return value;
    }
    return source;
  }
View Full Code Here

Examples of org.eclipse.e4.xwt.IValueConverter

    return this.bindingGate;
  }

  private Object convertedValue(Object value) {
    IValueConverter converter = getConverter();
    if (converter != null) {
      value = converter.convert(value);
    }
    return value;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.