/** * Unbinds the property with the given name. * * @param binding * the name of the model property to unbind, must not be null. */ public void unbind(final Binding binding) { final String property = binding.getProperty(); validatePropertyExpr(property); final int dotPos = property.indexOf("."); if (dotPos > 0) { final String bindableProperty = property.substring(0, dotPos); final DataBinder binder = binders.get(bindableProperty); if (binder != null) { final BindableProxyAgent<T> nestedAgent = ((BindableProxy<T>) binder.getModel()).getBindableProxyAgent(); final Collection<Binding> nestedBindings = nestedAgent.bindings.get(property.substring(dotPos + 1)); for (final Binding nestedBinding : nestedBindings.toArray(new Binding[nestedBindings.size()])) { if (binding.getComponent() == nestedBinding.getComponent()) { nestedAgent.unbind(nestedBinding); } } } } binding.removeHandlers(); bindings.remove(property, binding); if (bindings.isEmpty()) { BindableProxyFactory.removeCachedProxyForModel(target); } }
/** * Unbinds the property with the given name. * * @param binding * the name of the model property to unbind, must not be null. */ public void unbind(final Binding binding) { final String property = binding.getProperty(); validatePropertyExpr(property); final int dotPos = property.indexOf("."); if (dotPos > 0) { final String bindableProperty = property.substring(0, dotPos); final DataBinder binder = binders.get(bindableProperty); if (binder != null) { final BindableProxyAgent<T> nestedAgent = ((BindableProxy<T>) binder.getModel()).getBindableProxyAgent(); final Collection<Binding> nestedBindings = nestedAgent.bindings.get(property.substring(dotPos + 1)); for (final Binding nestedBinding : nestedBindings.toArray(new Binding[nestedBindings.size()])) { if (binding.getComponent() == nestedBinding.getComponent()) { nestedAgent.unbind(nestedBinding); } } } } binding.removeHandlers(); bindings.remove(property, binding); if (bindings.isEmpty()) { BindableProxyFactory.removeCachedProxyForModel(target); } }