Search in sources :

Example 1 with SpanAnnotationResponse

use of de.tudarmstadt.ukp.clarin.webanno.brat.message.SpanAnnotationResponse in project webanno by webanno.

the class BratAnnotationEditor method actionSpan.

private SpanAnnotationResponse actionSpan(AjaxRequestTarget aTarget, IRequestParameters request, JCas jCas, VID paramId) throws IOException, AnnotationException {
    Offsets offsets = getOffsetsFromRequest(request, jCas, paramId);
    AnnotatorState state = getModelObject();
    Selection selection = state.getSelection();
    if (state.isSlotArmed()) {
        // When filling a slot, the current selection is *NOT* changed. The
        // Span annotation which owns the slot that is being filled remains
        // selected!
        getActionHandler().actionFillSlot(aTarget, jCas, offsets.getBegin(), offsets.getEnd(), paramId);
    } else {
        if (!paramId.isSynthetic()) {
            selection.selectSpan(paramId, jCas, offsets.getBegin(), offsets.getEnd());
            if (selection.getAnnotation().isNotSet()) {
                // Create new annotation
                getActionHandler().actionCreateOrUpdate(aTarget, jCas);
            } else {
                getActionHandler().actionSelect(aTarget, jCas);
            }
        }
    }
    return new SpanAnnotationResponse();
}
Also used : SpanAnnotationResponse(de.tudarmstadt.ukp.clarin.webanno.brat.message.SpanAnnotationResponse) Selection(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.Selection) AnnotatorState(de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState) Offsets(de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Offsets)

Aggregations

AnnotatorState (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState)1 Selection (de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.Selection)1 SpanAnnotationResponse (de.tudarmstadt.ukp.clarin.webanno.brat.message.SpanAnnotationResponse)1 Offsets (de.tudarmstadt.ukp.clarin.webanno.brat.render.model.Offsets)1