use of de.catma.ui.events.routing.RouteToAnalyzeEvent in project catma by forTEXT.
the class TaggerView method analyzeDocument.
public void analyzeDocument() {
Corpus corpus = new Corpus();
corpus.addSourceDocument(sourceDocument);
for (AnnotationCollection umc : userMarkupCollectionManager.getUserMarkupCollections()) {
AnnotationCollectionReference userMarkupCollRef = sourceDocument.getUserMarkupCollectionReference(umc.getId());
if (userMarkupCollRef != null) {
corpus.addUserMarkupCollectionReference(userMarkupCollRef);
}
}
if (project instanceof IndexedProject) {
eventBus.post(new RouteToAnalyzeEvent((IndexedProject) project, corpus));
}
}
use of de.catma.ui.events.routing.RouteToAnalyzeEvent in project catma by forTEXT.
the class ProjectView method handleAnalyzeResources.
private void handleAnalyzeResources(MenuBar.MenuItem menuItem, TreeGrid<Resource> resourceGrid) {
if (resourceGrid.getSelectedItems().isEmpty()) {
Notification.show("Info", "Please select something first!", Type.HUMANIZED_MESSAGE);
} else {
Corpus corpus = new Corpus();
for (Resource resource : resourceGrid.getSelectedItems()) {
try {
if (resource.getClass().equals(DocumentResource.class)) {
DocumentResource docResource = (DocumentResource) resource;
corpus.addSourceDocument(docResource.getDocument());
} else {
CollectionResource collResource = (CollectionResource) resource;
corpus.addUserMarkupCollectionReference(collResource.getCollectionReference());
DocumentResource docParent = (DocumentResource) resourceGrid.getTreeData().getParent(collResource);
if (!corpus.getSourceDocuments().contains(docParent.getDocument())) {
corpus.addSourceDocument(docParent.getDocument());
}
}
} catch (Exception e) {
errorHandler.showAndLogError("Error adding resource to analyzer module " + resource, e);
}
}
eventBus.post(new RouteToAnalyzeEvent((IndexedProject) project, corpus));
}
}
Aggregations