@Override public void addConfigurationListener(ConfigurationListener l) { eventSource.addConfigurationListener(l); }
@Override public void addErrorListener(ConfigurationErrorListener l) { eventSource.addErrorListener(l); }
private void removeListeners(EventSource eventSource) { for(ConfigurationListener listener : eventSource.getConfigurationListeners()) { if(listener instanceof ConfigurationListenerImpl) { eventSource.removeConfigurationListener(listener); } } }
/** * Creates an event object and delivers it to all registered event * listeners. The method will check first if sending an event is allowed * (making use of the {@code detailEvents} property), and if * listeners are registered. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param before the before update flag */ protected void fireEvent(int type, String propName, Object propValue, boolean before) { if (checkDetailEvents(-1)) { Iterator<ConfigurationListener> it = listeners.iterator(); if (it.hasNext()) { ConfigurationEvent event = createEvent(type, propName, propValue, before); while (it.hasNext()) { it.next().configurationChanged(event); } } } }
@Override public Collection<ConfigurationListener> getConfigurationListeners() { return eventSource.getConfigurationListeners(); } }
@Override public boolean removeConfigurationListener(ConfigurationListener l) { return eventSource.removeConfigurationListener(l); }
/** * Adds a configuration listener to this object. * * @param l the listener to add */ public void addConfigurationListener(ConfigurationListener l) { checkListener(l); listeners.add(l); }
/** * Creates a new instance of {@code EventSource}. */ public EventSource() { initListeners(); }
/** * Returns a flag whether detail events are enabled. * * @return a flag if detail events are generated */ public boolean isDetailEvents() { return checkDetailEvents(0); }
/** * Creates an error event object and delivers it to all registered error * listeners. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param ex the {@code Throwable} object that caused this error event * @since 1.4 */ protected void fireError(int type, String propName, Object propValue, Throwable ex) { Iterator<ConfigurationErrorListener> it = errorListeners.iterator(); if (it.hasNext()) { ConfigurationErrorEvent event = createErrorEvent(type, propName, propValue, ex); while (it.hasNext()) { it.next().configurationError(event); } } }
/** * Creates an event object and delivers it to all registered event * listeners. The method will check first if sending an event is allowed * (making use of the {@code detailEvents} property), and if * listeners are registered. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param before the before update flag */ protected void fireEvent(int type, String propName, Object propValue, boolean before) { if (checkDetailEvents(-1)) { Iterator<ConfigurationListener> it = listeners.iterator(); if (it.hasNext()) { ConfigurationEvent event = createEvent(type, propName, propValue, before); while (it.hasNext()) { it.next().configurationChanged(event); } } } }
public int getChangeListenersSize() { return EventSource.class.cast( this.configuration ).getConfigurationListeners().size(); }
@Override public boolean removeChangeListener( RegistryListener listener ) { EventSource eventSource = EventSource.class.cast( this.configuration ); boolean removed = eventSource.removeConfigurationListener( new ConfigurationListenerDelegate( listener, this ) ); return removed; }
/** * Adds a new configuration error listener to this object. This listener * will then be notified about internal problems. * * @param l the listener to register (must not be <b>null</b>) * @since 1.4 */ public void addErrorListener(ConfigurationErrorListener l) { checkListener(l); errorListeners.add(l); }
/** * Creates a new instance of {@code EventSource}. */ public EventSource() { initListeners(); }
/** * Returns a flag whether detail events are enabled. * * @return a flag if detail events are generated */ public boolean isDetailEvents() { return checkDetailEvents(0); }
/** * Creates an error event object and delivers it to all registered error * listeners. * * @param type the event's type * @param propName the name of the affected property (can be <b>null</b>) * @param propValue the value of the affected property (can be <b>null</b>) * @param ex the {@code Throwable} object that caused this error event * @since 1.4 */ protected void fireError(int type, String propName, Object propValue, Throwable ex) { Iterator<ConfigurationErrorListener> it = errorListeners.iterator(); if (it.hasNext()) { ConfigurationErrorEvent event = createErrorEvent(type, propName, propValue, ex); while (it.hasNext()) { it.next().configurationError(event); } } }
public void addChangeListener( RegistryListener listener ) { EventSource configuration = (EventSource) this.configuration; configuration.addConfigurationListener( new ConfigurationListenerDelegate( listener, this ) ); }
"Configuration must be derived from EventSource!"); ((EventSource) src).addErrorListener(new ConfigurationErrorListener()
/** * Adds a configuration listener to this object. * * @param l the listener to add */ public void addConfigurationListener(ConfigurationListener l) { checkListener(l); listeners.add(l); }