use of de.tudarmstadt.ukp.clarin.webanno.ui.curation.component.model.BratSuggestionVisualizer in project webanno by webanno.
the class SuggestionViewPanel method updatePanel.
/**
* @param aTarget
* the AJAX target.
* @param aCurationContainer
* the container.
* @param aAnnotationSelectionByUsernameAndAddress
* selections by user.
* @param aCurationSegment
* the segment.
* @throws UIMAException
* hum?
* @throws ClassNotFoundException
* hum?
* @throws IOException
* hum?
* @throws AnnotationException
* hum?
*/
public void updatePanel(AjaxRequestTarget aTarget, CurationContainer aCurationContainer, Map<String, Map<Integer, AnnotationSelection>> aAnnotationSelectionByUsernameAndAddress, SourceListView aCurationSegment) throws UIMAException, ClassNotFoundException, IOException, AnnotationException {
AnnotatorState state = aCurationContainer.getAnnotatorState();
SourceDocument sourceDocument = state.getDocument();
Map<String, JCas> jCases = new HashMap<>();
// This is the CAS that the user can actively edit
JCas annotatorCas = getAnnotatorCas(state, aAnnotationSelectionByUsernameAndAddress, sourceDocument, jCases);
// We store the CAS that the user will edit as the "CURATION USER"
jCases.put(CURATION_USER, annotatorCas);
// get differing feature structures
Map<String, Map<VID, AnnotationState>> annoStates = calcColors(state, aCurationSegment, annotatorCas, jCases);
sentenceListView.visitChildren(BratSuggestionVisualizer.class, (v, visit) -> {
BratSuggestionVisualizer vis = (BratSuggestionVisualizer) v;
UserAnnotationSegment seg = vis.getModelObject();
JCas jCas = jCases.get(seg.getUsername());
// Set up coloring strategy
ColoringStrategy curationColoringStrategy = makeColoringStrategy(annoStates.get(seg.getUsername()));
// Create curation view for the current user
try {
seg.setCollectionData(getCollectionInformation(annotationService, aCurationContainer));
seg.setDocumentResponse(render(jCas, state, curationColoringStrategy));
seg.setAnnotatorState(state);
seg.setSelectionByUsernameAndAddress(aAnnotationSelectionByUsernameAndAddress);
} catch (IOException e) {
error("Unable to render: " + e.getMessage());
LOG.error("Unable to render", e);
}
vis.requestRender(aTarget);
});
}
Aggregations