private void addHandlersForBindableListWrapper(final String property, final BindableListWrapper newList) { modelChangeHandlers.add(newList.addChangeHandler(new UnspecificListChangeHandler() { @Override void onListChanged(final List oldList) { updateWidgetsAndFireEvent(false, property, oldList, newList); } })); for (final Binding binding : bindings.get(property)) { if (binding.getComponent() instanceof BindableListChangeHandler) { modelChangeHandlers.add(newList.addChangeHandler((BindableListChangeHandler) binding.getComponent())); } } }
private void addHandlersForBindableListWrapper(final String property, final BindableListWrapper newList) { modelChangeHandlers.add(newList.addChangeHandler(new UnspecificListChangeHandler() { @Override void onListChanged(final List oldList) { updateWidgetsAndFireEvent(false, property, oldList, newList); } })); for (final Binding binding : bindings.get(property)) { if (binding.getComponent() instanceof BindableListChangeHandler) { modelChangeHandlers.add(newList.addChangeHandler((BindableListChangeHandler) binding.getComponent())); } } }
/** * Returns the widgets currently bound to the provided model property (see * {@link #bind(Widget, String)}). * * @param property * The name of the property (or a property chain). Must not be null. * @return the list of widgets currently bound to the provided property or an * empty list if no widget was bound to the property. */ public List<Object> getComponents(final String property) { Assert.notNull(property); final List<Object> widgets = new ArrayList<>(); for (final Binding binding : bindings.get(property)) { widgets.add(binding.getComponent()); } return widgets; }
/** * Returns the widgets currently bound to the provided model property (see * {@link #bind(Widget, String)}). * * @param property * The name of the property (or a property chain). Must not be null. * @return the list of widgets currently bound to the provided property or an * empty list if no widget was bound to the property. */ public List<Object> getComponents(final String property) { Assert.notNull(property); final List<Object> widgets = new ArrayList<>(); for (final Binding binding : bindings.get(property)) { widgets.add(binding.getComponent()); } return widgets; }
/** * Returns the widgets currently bound to the provided model property (see * {@link #bind(Widget, String)}). * * @param property * The name of the property (or a property chain). Must not be null. * @return the list of widgets currently bound to the provided property or an * empty list if no widget was bound to the property. */ public List<Object> getComponents(final String property) { Assert.notNull(property); final List<Object> widgets = new ArrayList<>(); for (final Binding binding : bindings.get(property)) { widgets.add(binding.getComponent()); } return widgets; }
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); } }
.bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));
.bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));
.bind(b.getComponent(), b.getProperty(), b.getConverter(), bindOnKeyUp, newInitState));
final Object component = binding.getComponent(); final Converter converter = binding.getConverter();
final Object component = binding.getComponent(); final Converter converter = binding.getConverter();