use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.
the class CurationPage method updatePanel.
private void updatePanel(CurationContainer aCurationContainer, AjaxRequestTarget aTarget) {
AnnotatorState state = getModelObject();
gotoPageTextField.setModelObject(state.getFirstVisibleUnitIndex());
curationPanel.setDefaultModelObject(curationContainer);
aTarget.add(gotoPageTextField);
aTarget.add(curationPanel);
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.
the class CurationPage method actionFinishDocument.
private void actionFinishDocument(AjaxRequestTarget aTarget) {
finishDocumentDialog.setConfirmAction((aCallbackTarget) -> {
ensureRequiredFeatureValuesSet(aCallbackTarget, getEditorCas());
AnnotatorState state = getModelObject();
SourceDocument sourceDocument = state.getDocument();
if (SourceDocumentState.CURATION_FINISHED.equals(sourceDocument.getState())) {
documentService.transitionSourceDocumentState(sourceDocument, CURATION_FINISHED_TO_CURATION_IN_PROGRESS);
} else {
documentService.transitionSourceDocumentState(sourceDocument, CURATION_IN_PROGRESS_TO_CURATION_FINISHED);
}
aCallbackTarget.add(finishDocumentIcon);
aCallbackTarget.add(finishDocumentLink);
aCallbackTarget.add(curationPanel.editor);
aCallbackTarget.add(remergeDocumentLink);
});
finishDocumentDialog.show(aTarget);
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.
the class CopyAnnotationTest method simpleCopyToEmptyTest.
@Test
public void simpleCopyToEmptyTest() throws Exception {
AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
state.setUser(new User());
JCas jcas = JCasFactory.createJCas();
Type type = jcas.getTypeSystem().getType(POS.class.getTypeName());
AnnotationFS clickedFs = createPOSAnno(jcas, type, "NN", 0, 0);
JCas mergeCAs = JCasFactory.createJCas();
createTokenAnno(mergeCAs, 0, 0);
MergeCas.addSpanAnnotation(state, annotationSchemaService, posLayer, mergeCAs, clickedFs, false);
assertEquals(1, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.
the class CopyAnnotationTest method simpleCopyToDiffExistingAnnoWithStackingTest.
@Test
public void simpleCopyToDiffExistingAnnoWithStackingTest() throws Exception {
AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
state.setUser(new User());
posLayer.setAllowStacking(true);
JCas jcas = JCasFactory.createJCas();
Type type = jcas.getTypeSystem().getType(POS.class.getTypeName());
AnnotationFS clickedFs = createPOSAnno(jcas, type, "NN", 0, 0);
JCas mergeCAs = JCasFactory.createJCas();
createTokenAnno(mergeCAs, 0, 0);
AnnotationFS existingFs = mergeCAs.getCas().createAnnotation(type, 0, 0);
Feature posValue = type.getFeatureByBaseName("PosValue");
existingFs.setStringValue(posValue, "NE");
mergeCAs.addFsToIndexes(existingFs);
MergeCas.addSpanAnnotation(state, annotationSchemaService, posLayer, mergeCAs, clickedFs, true);
assertEquals(2, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
use of de.tudarmstadt.ukp.clarin.webanno.api.annotation.model.AnnotatorState in project webanno by webanno.
the class CopyAnnotationTest method copySpanWithSlotWithStackingTest.
@Test
public void copySpanWithSlotWithStackingTest() throws Exception {
AnnotatorState state = new AnnotatorStateImpl(Mode.CURATION);
state.setUser(new User());
slotLayer.setAllowStacking(true);
JCas jcasA = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1"));
Type type = jcasA.getTypeSystem().getType(DiffUtils.HOST_TYPE);
Feature feature = type.getFeatureByBaseName("f1");
AnnotationFS clickedFs = DiffUtils.makeLinkHostMultiSPanFeatureFS(jcasA, 0, 0, feature, "A", DiffUtils.makeLinkFS(jcasA, "slot1", 0, 0));
JCas mergeCAs = JCasFactory.createJCas(DiffUtils.createMultiLinkWithRoleTestTypeSytem("f1"));
DiffUtils.makeLinkHostMultiSPanFeatureFS(mergeCAs, 0, 0, feature, "C", DiffUtils.makeLinkFS(mergeCAs, "slot1", 0, 0));
MergeCas.addSpanAnnotation(state, annotationSchemaService, slotLayer, mergeCAs, clickedFs, true);
assertEquals(2, CasUtil.selectCovered(mergeCAs.getCas(), type, 0, 0).size());
}
Aggregations