@Override public Subscription addValueChangeListener(String componentName, Consumer<HasValue.ValueChangeEvent> listener) { Component component = frame.getComponent(componentName); if (component == null) throw new RuntimeException("Component not found: " + componentName); if (component instanceof HasValue) { return ((HasValue) component).addValueChangeListener(listener); } else if (component instanceof ListComponent) { throw new UnsupportedOperationException("List component is not supported yet"); } else { throw new RuntimeException("Unable to add listener to the component " + component); } }
public <E extends Entity> void bind() { if (source instanceof EntityOptions && component instanceof HasValue) { this.componentValueChangeSubscription = ((HasValue<?>) component).addValueChangeListener(this::componentValueChanged); this.sourceValueChangeSupscription = ((EntityOptions<E>) source).addValueChangeListener(this::optionsSourceValueChanged); } this.sourceStateChangeSupscription = source.addStateChangeListener(this::optionsSourceStateChanged); this.sourceOptionsChangeSupscription = source.addOptionsChangeListener(this::optionsSourceOptionsChanged); }
public void bind() { this.componentValueChangeSubscription = component.addValueChangeListener(this::componentValueChanged); this.sourceValueChangeSubscription = source.addValueChangeListener(this::sourceValueChanged); this.sourceStateChangeSubscription = source.addStateChangeListener(this::valueSourceStateChanged); if (source instanceof EntityValueSource) { this.sourceInstanceChangeSubscription = ((EntityValueSource<Entity, V>) source).addInstanceChangeListener(this::sourceInstanceChanged); } }