All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.intarsys.tools.event.NotificationSupportProxy Maven / Gradle / Ivy

There is a newer version: 4.11
Show newest version
package de.intarsys.tools.event;

public class NotificationSupportProxy implements INotificationSupport {

	private EventDispatcher dispatcher = new EventDispatcher(this);

	private INotificationSupport delegate;

	public void addNotificationListener(EventType type,
			INotificationListener listener) {
		dispatcher.addNotificationListener(type, listener);
		if (delegate != null) {
			delegate.addNotificationListener(type, listener);
		}
	}

	public INotificationSupport getDelegate() {
		return delegate;
	}

	public void removeNotificationListener(EventType type,
			INotificationListener listener) {
		dispatcher.removeNotificationListener(type, listener);
		if (delegate != null) {
			delegate.removeNotificationListener(type, listener);
		}
	}

	public void setDelegate(INotificationSupport pDelegate) {
		if (delegate != null) {
			dispatcher.detach(delegate);
		}
		this.delegate = pDelegate;
		if (delegate != null) {
			dispatcher.attach(delegate);
		}
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy