Пример #1
0
 private void fireReverseBinding() {
   if (!(sourceBinding instanceof TargetBinding) || !(targetBinding instanceof SourceBinding)) {
     throw new RuntimeException("Binding Instance is not reversable");
   }
   Object result = ((SourceBinding) targetBinding).getSourceValue();
   if (getReverseConverter() != null) {
     result = getReverseConverter().call(result);
   }
   ((TargetBinding) sourceBinding).updateTargetValue(result);
 }
Пример #2
0
 private void fireBinding() {
   if ((sourceBinding == null) || (targetBinding == null)) {
     // should we throw invalid binding exception?  or fail quietly?
     return;
   }
   Object result = sourceBinding.getSourceValue();
   if (getValidator() != null) {
     Object validation = getValidator().call(result);
     if ((validation == null) || ((validation instanceof Boolean) && !(Boolean) validation)) {
       // should we throw a validation failed exception?  or fail quietly?
       return;
     }
   }
   if (getConverter() != null) {
     result = getConverter().call(result);
   }
   targetBinding.updateTargetValue(result);
 }