@Override public PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final PropertyChangeHandler handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } });
/** * Notify registered {@link PropertyChangeHandlers} of a * {@link PropertyChangeEvent}. Will only dispatch events that represent a * change. If oldValue and newValue are equal, the event will be ignored. * * @param event * {@link the PropertyChangeEvent} to provide to handlers. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public void notifyHandlers(PropertyChangeEvent<?> event) { if (!acceptEvent(event)) { return; } final Collection<PropertyChangeHandler<?>> specHandlers = specificPropertyHandlers.get(event.getPropertyName()); for (PropertyChangeHandler handler : specHandlers.toArray(new PropertyChangeHandler<?>[specHandlers.size()])) { handler.onPropertyChange(event); } for (PropertyChangeHandler handler : handlers.toArray(new PropertyChangeHandler<?>[handlers.size()])) { handler.onPropertyChange(event); } }
/** * Fires a property change event unless the property is {@code "this"}. The {@code "this"} property is only fired for * types with no other properties. * * @param * <P> * The property type of the changed property. * @param property * The name of the property that changed. Must not be null. * @param oldValue * The old value of the property. * @param newValue * The new value of the property. * @return true Iff property change handlers were notified for this type. */ private <P> boolean maybeFirePropertyChangeEvent(final String property, final P oldValue, final P newValue) { knownValues.put(property, newValue); final PropertyChangeEvent<P> event = new PropertyChangeEvent<>(proxy, Assert.notNull(property), oldValue, newValue); if (!"this".equals(property) || propertyTypes.size() == 1) { propertyChangeHandlerSupport.notifyHandlers(event); return true; } else { return false; } }
/** * Notify registered {@link PropertyChangeHandlers} of a * {@link PropertyChangeEvent}. Will only dispatch events that represent a * change. If oldValue and newValue are equal, the event will be ignored. * * @param event * {@link the PropertyChangeEvent} to provide to handlers. */ @SuppressWarnings({ "rawtypes", "unchecked" }) public void notifyHandlers(PropertyChangeEvent<?> event) { if (!acceptEvent(event)) { return; } final Collection<PropertyChangeHandler<?>> specHandlers = specificPropertyHandlers.get(event.getPropertyName()); for (PropertyChangeHandler handler : specHandlers.toArray(new PropertyChangeHandler<?>[specHandlers.size()])) { handler.onPropertyChange(event); } for (PropertyChangeHandler handler : handlers.toArray(new PropertyChangeHandler<?>[handlers.size()])) { handler.onPropertyChange(event); } }
/** * Fires a property change event unless the property is {@code "this"}. The {@code "this"} property is only fired for * types with no other properties. * * @param * <P> * The property type of the changed property. * @param property * The name of the property that changed. Must not be null. * @param oldValue * The old value of the property. * @param newValue * The new value of the property. * @return true Iff property change handlers were notified for this type. */ private <P> boolean maybeFirePropertyChangeEvent(final String property, final P oldValue, final P newValue) { knownValues.put(property, newValue); final PropertyChangeEvent<P> event = new PropertyChangeEvent<>(proxy, Assert.notNull(property), oldValue, newValue); if (!"this".equals(property) || propertyTypes.size() == 1) { propertyChangeHandlerSupport.notifyHandlers(event); return true; } else { return false; } }
@Override public PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final PropertyChangeHandler handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } }; }
@Override public void doUnsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } };
@Override public PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final PropertyChangeHandler<?> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void doUnsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } };
@Override public <P> PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final String property, final PropertyChangeHandler<P> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(property, handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(property, handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(property, handler); } });
@Override public <P> PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final String property, final PropertyChangeHandler<P> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(property, handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(property, handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } });
@Override public PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final PropertyChangeHandler<?> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } });
@Override public <P> PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final String property, final PropertyChangeHandler<P> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(property, handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(property, handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(property, handler); } });
@Override public PropertyChangeUnsubscribeHandle addPropertyChangeHandler(final PropertyChangeHandler<?> handler) { propertyChangeHandlerSupport.addPropertyChangeHandler(handler); final PropertyChangeUnsubscribeHandle agentUnsubHandle = getAgent().addPropertyChangeHandler(handler); return new OneTimeUnsubscribeHandle() { @Override public void doUnsubscribe() { agentUnsubHandle.unsubscribe(); } }; }
@Override public void unsubscribe() { propertyChangeHandlerSupport.removePropertyChangeHandler(handler); } });