use of gate.event.AnnotationListener in project gate-core by GateNLP.
the class AnnotationImpl method addAnnotationListener.
/**
* Adds an annotation listener
*/
@Override
public synchronized void addAnnotationListener(AnnotationListener l) {
@SuppressWarnings("unchecked") Vector<AnnotationListener> v = annotationListeners == null ? new Vector<AnnotationListener>(2) : (Vector<AnnotationListener>) annotationListeners.clone();
// also be propagated
if (v.isEmpty()) {
FeatureMap features = getFeatures();
if (eventHandler == null)
eventHandler = new EventsHandler();
features.addFeatureMapListener(eventHandler);
}
if (!v.contains(l)) {
v.addElement(l);
annotationListeners = v;
}
}
Aggregations