@Test public void testRemoveBindingsForComponent() { BindingContext context = new BindingContext(); TestPmo testPmo = new TestPmo(); ElementBinding binding1 = createBinding(context, testPmo, field1); ElementBinding binding2 = createBinding(context, testPmo, field2); context.add(binding1, TestComponentWrapper.with(binding1)); context.add(binding2, TestComponentWrapper.with(binding2)); assertThat(context.getBindings(), hasSize(2)); TestUiLayoutComponent layout = new TestUiLayoutComponent(field1, field2); context.removeBindingsForComponent(layout); assertThat(context.getBindings(), is(empty())); }
public void removeBindingsForComponent(Object uiComponent) { bindings.remove(uiComponent); UiFramework.getChildComponents(uiComponent) .iterator() .forEachRemaining(this::removeBindingsForComponent); getBindingStream() .filter(BindingContext.class::isInstance) .map(BindingContext.class::cast) .forEach(bc -> bc.removeBindingsForComponent(uiComponent)); }
BindingContext implements UiUpdateObserver { public void removeBindingsForComponent(Object uiComponent) { bindings.remove(uiComponent); UiFramework.getChildComponents(uiComponent) .iterator() .forEachRemaining(this::removeBindingsForComponent); getBindingStream() .filter(BindingContext.class::isInstance) .map(BindingContext.class::cast) .forEach(bc -> bc.removeBindingsForComponent(uiComponent)); } }
BindingContext implements UiUpdateObserver { public void removeBindingsForComponent(Object uiComponent) { bindings.remove(uiComponent); UiFramework.getChildComponents(uiComponent) .iterator() .forEachRemaining(this::removeBindingsForComponent); getBindingStream() .filter(BindingContext.class::isInstance) .map(BindingContext.class::cast) .forEach(bc -> bc.removeBindingsForComponent(uiComponent)); } BindingContext();  BindingContext(String contextName);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            Handler afterUpdateHandler);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            PropertyDispatcherFactory dispatcherFactory, Handler afterUpdateHandler); }
BindingContext implements UiUpdateObserver { public void removeBindingsForComponent(Object uiComponent) { bindings.remove(uiComponent); UiFramework.getChildComponents(uiComponent) .iterator() .forEachRemaining(this::removeBindingsForComponent); getBindingStream() .filter(BindingContext.class::isInstance) .map(BindingContext.class::cast) .forEach(bc -> bc.removeBindingsForComponent(uiComponent)); } BindingContext();  BindingContext(String contextName);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            Handler afterUpdateHandler);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            PropertyDispatcherFactory dispatcherFactory, Handler afterUpdateHandler); String getName(); @Deprecated BindingContext add(Binding binding); BindingContext add(Binding binding, ComponentWrapper componentWrapper); Collection<Binding> getBindings(); void removeBindingsForComponent(Object uiComponent); void removeBindingsForPmo(Object pmo); @Deprecated void updateUI(); void modelChanged(); @Override void uiUpdated(); @Deprecated final void updateMessages(MessageList messages); MessageList displayMessages(MessageList messages); PropertyBehaviorProvider getBehaviorProvider(); @Override String toString(); Binding bind(Object pmo,
            BindingDescriptor bindingDescriptor,
            ComponentWrapper componentWrapper); Binding bind(Object pmo,
            BoundProperty boundProperty,
            List<LinkkiAspectDefinition> aspectDefs,
            ComponentWrapper componentWrapper); ContainerBinding bindContainer(Object pmo,
            BoundProperty boundProperty,
            List<LinkkiAspectDefinition> aspectDefs,
            ComponentWrapper componentWrapper); @Deprecated final PropertyDispatcher createDispatcherChain(Object pmo,
            BindingDescriptor bindingDescriptor); }
BindingContext implements UiUpdateObserver { public void removeBindingsForComponent(Object uiComponent) { bindings.remove(uiComponent); UiFramework.getChildComponents(uiComponent) .iterator() .forEachRemaining(this::removeBindingsForComponent); getBindingStream() .filter(BindingContext.class::isInstance) .map(BindingContext.class::cast) .forEach(bc -> bc.removeBindingsForComponent(uiComponent)); } BindingContext();  BindingContext(String contextName);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            Handler afterUpdateHandler);  BindingContext(String contextName, PropertyBehaviorProvider behaviorProvider,
            PropertyDispatcherFactory dispatcherFactory, Handler afterUpdateHandler); String getName(); @Deprecated BindingContext add(Binding binding); BindingContext add(Binding binding, ComponentWrapper componentWrapper); Collection<Binding> getBindings(); void removeBindingsForComponent(Object uiComponent); void removeBindingsForPmo(Object pmo); @Deprecated void updateUI(); void modelChanged(); @Override void uiUpdated(); @Deprecated final void updateMessages(MessageList messages); MessageList displayMessages(MessageList messages); PropertyBehaviorProvider getBehaviorProvider(); @Override String toString(); Binding bind(Object pmo,
            BindingDescriptor bindingDescriptor,
            ComponentWrapper componentWrapper); Binding bind(Object pmo,
            BoundProperty boundProperty,
            List<LinkkiAspectDefinition> aspectDefs,
            ComponentWrapper componentWrapper); ContainerBinding bindContainer(Object pmo,
            BoundProperty boundProperty,
            List<LinkkiAspectDefinition> aspectDefs,
            ComponentWrapper componentWrapper); @Deprecated final PropertyDispatcher createDispatcherChain(Object pmo,
            BindingDescriptor bindingDescriptor);  }