com.actelion.research.gui.generic.GenericEventHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openchemlib Show documentation
Show all versions of openchemlib Show documentation
Open Source Chemistry Library
package com.actelion.research.gui.generic;
import java.util.ArrayList;
public abstract class GenericEventHandler {
private ArrayList> mListeners;
private Object mSource;
public GenericEventHandler(Object source) {
mSource = source;
mListeners = new ArrayList<>();
}
public Object getSource() {
return mSource;
}
public void addListener(GenericEventListener e) {
mListeners.add(e);
}
public void removeListener(GenericEventListener e) {
mListeners.remove(e);
}
public void fireEvent(T e) {
for (GenericEventListener gel:mListeners)
gel.eventHappened(e);
}
}