Search in sources :

Example 1 with AnnotationListener

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;
    }
}
Also used : FeatureMap(gate.FeatureMap) AnnotationListener(gate.event.AnnotationListener)

Aggregations

FeatureMap (gate.FeatureMap)1 AnnotationListener (gate.event.AnnotationListener)1