public Object call(Object... params) { if (sourceBinding instanceof ClosureSourceBinding) { ((ClosureSourceBinding)sourceBinding).setClosureArguments(params); } update(); return null; } };
public void update() { for (BindingUpdatable binding : bindings) { binding.update(); } }
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); }
MutualPropertyBinding(TriggerBinding forwardTrigger, PropertyBinding source, PropertyBinding target, Closure triggerFactory) { // order matters here! this.triggerFactory = triggerFactory; sourceBinding = source; forwardTriggerBinding = forwardTrigger; setTargetBinding(target); rebuildBindings(); }
public void unbind() { synchronized (generatedBindings) { if (bound) { bound = false; for (FullBinding generatedBinding : generatedBindings) { (generatedBinding).unbind(); // should we trap exceptions and do an each? } } } }
public void bind() { if (!bound) { resetTimer(); bound = true; } }
public void rebind() { synchronized (generatedBindings) { if (bound) { for (FullBinding generatedBinding : generatedBindings) { (generatedBinding).rebind(); // should we trap exceptions and do an each? } } } }
public void bind() { synchronized (generatedBindings) { if (!bound) { bound = true; for (FullBinding generatedBinding : generatedBindings) { (generatedBinding).bind(); // should we trap exceptions and do an each? } } } }
public void update() { synchronized (generatedBindings) { for (FullBinding generatedBinding : generatedBindings) { (generatedBinding).update(); // should we trap exceptions and do an each? } } }
public void reverseUpdate() { synchronized (generatedBindings) { for (FullBinding generatedBinding : generatedBindings) { (generatedBinding).reverseUpdate(); // should we trap exceptions and do an each? } } }
public void reverseUpdate() { for (BindingUpdatable binding : bindings) { binding.reverseUpdate(); } } }
public void setValidator(Closure validator) { this.validator = validator; rebuildBindings(); }
public Object getProperty(String property) { throw new DeadEndException("Cannot bind to a property on the return value of a method call"); } public Object invokeMethod(String name, Object args) {
public void bind() { if (!bound) { bound = true; for (BindingUpdatable binding : bindings) { binding.bind(); } } }
public void unbind() { if (bound) { for (BindingUpdatable binding : bindings) { binding.unbind(); } bound = false; } }
public void rebind() { if (bound) { resetTimer(); } }