@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VSpan> annoToSpanIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } // Since we split spans into multiple ranges at sentence boundaries, we can simply check // if there are multiple ranges for a given span. This is cheaper than checking for // every annotation whether the begin/end offset is in the same sentence. for (Entry<AnnotationFS, VSpan> e : annoToSpanIdx.entrySet()) { if (e.getValue().getRanges().size() > 1) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } }
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
aVDoc.add(new VAnnotationMarker(this, VMarker.FOCUS, highlightVID)); if (state.getWindowBeginOffset() <= highlightSpan.getBegin() && highlightSpan.getEnd() <= state.getWindowEndOffset()) { aVDoc.add(new VTextMarker(this, VMarker.FOCUS, highlightSpan.getBegin() - state.getWindowBeginOffset(), highlightSpan.getEnd() - state.getWindowBeginOffset()));
default void renderRequiredFeatureErrors(List<AnnotationFeature> aFeatures, FeatureStructure aFS, VDocument aResponse) { for (AnnotationFeature f : aFeatures) { if (isRequiredFeatureMissing(f, aFS)) { aResponse.add(new VComment(new VID(getAddr(aFS)), VCommentType.ERROR, "Required feature [" + f.getName() + "] not set.")); } } } }
aVDoc.add(new VAnnotationMarker(this, VMarker.FOCUS, highlightVID)); if (state.getWindowBeginOffset() <= highlightSpan.getBegin() && highlightSpan.getEnd() <= state.getWindowEndOffset()) { aVDoc.add(new VTextMarker(this, VMarker.FOCUS, highlightSpan.getBegin() - state.getWindowBeginOffset(), highlightSpan.getEnd() - state.getWindowBeginOffset()));
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VArc> aAnnoToArcIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } try { for (Entry<AnnotationFS, VArc> e : aAnnoToArcIdx.entrySet()) { JCas jcas = e.getKey().getCAS().getJCas(); if (!isBeginInSameSentence(jcas, selectByAddr(jcas, e.getValue().getSource().getId()).getBegin(), selectByAddr(jcas, e.getValue().getTarget().getId()).getBegin())) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } } catch (CASException e) { throw new IllegalStateException("Unable to obtain JCas"); } }
@Override public void onRender(TypeAdapter aAdapter, VDocument aResponse, Map<AnnotationFS, VArc> aAnnoToArcIdx) { if (aAdapter.getLayer().isCrossSentence()) { return; } try { for (Entry<AnnotationFS, VArc> e : aAnnoToArcIdx.entrySet()) { JCas jcas = e.getKey().getCAS().getJCas(); if (!isBeginInSameSentence(jcas, selectByAddr(jcas, e.getValue().getSource().getId()).getBegin(), selectByAddr(jcas, e.getValue().getTarget().getId()).getBegin())) { aResponse.add(new VComment(new VID(e.getKey()), ERROR, "Crossing sentence bounardies is not permitted.")); } } } catch (CASException e) { throw new IllegalStateException("Unable to obtain JCas"); } }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { if (selectedResult != null) { AnnotatorState state = aEvent.getState(); if (state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset()) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }
vdoc.add(new VAnnotationMarker( VMarker.FOCUS, state.getSelection().getAnnotation()));
vdoc.add(new VAnnotationMarker( VMarker.FOCUS, state.getSelection().getAnnotation()));
@OnEvent public void onRenderAnnotations(RenderAnnotationsEvent aEvent) { AnnotatorState state = aEvent.getState(); if (selectedResult != null) { if ( // Check if match is in current document selectedResult.getDocumentId() == state.getDocument().getId() && // Check if match is in currently visible part of the document state.getWindowBeginOffset() <= selectedResult.getOffsetStart() && selectedResult.getOffsetEnd() <= state.getWindowEndOffset() ) { aEvent.getVDocument() .add(new VTextMarker(VMarker.MATCH_FOCUS, selectedResult.getOffsetStart() - state.getWindowBeginOffset(), selectedResult.getOffsetEnd() - state.getWindowBeginOffset())); } } }