private void checkComponentNotAlreadyBound(final Object component, final String property) { for (final Binding binding : bindings.values()) { if (binding.getComponent().equals(component) && !property.equals(binding.getProperty())) { throw new ComponentAlreadyBoundException("Widget already bound to property: " + binding.getProperty()); } } }
private void checkComponentNotAlreadyBound(final Object component, final String property) { for (final Binding binding : bindings.values()) { if (binding.getComponent().equals(component) && !property.equals(binding.getProperty())) { throw new ComponentAlreadyBoundException("Widget already bound to property: " + binding.getProperty()); } } }
/** * 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); } }
bindings.put(b.getProperty(), newProxy.getBindableProxyAgent() .bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));
bindings.put(b.getProperty(), newProxy.getBindableProxyAgent() .bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));
bindings.put(b.getProperty(), newProxy.getBindableProxyAgent() .bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));