Search in sources :

Example 1 with RouteToAnnotateEvent

use of de.catma.ui.events.routing.RouteToAnnotateEvent in project catma by forTEXT.

the class ProjectView method handleResourceItemClick.

private void handleResourceItemClick(ItemClick<Resource> itemClickEvent) {
    if (itemClickEvent.getMouseEventDetails().isDoubleClick()) {
        Resource resource = itemClickEvent.getItem();
        @SuppressWarnings("unchecked") TreeDataProvider<Resource> resourceDataProvider = (TreeDataProvider<Resource>) documentGrid.getDataProvider();
        Resource root = resourceDataProvider.getTreeData().getParent(resource);
        Resource child = null;
        if (root == null) {
            root = resource;
        } else {
            child = resource;
        }
        if (root != null) {
            SourceDocument document = ((DocumentResource) root).getDocument();
            AnnotationCollectionReference collectionReference = (child == null ? null : ((CollectionResource) child).getCollectionReference());
            eventBus.post(new RouteToAnnotateEvent(project, document, collectionReference));
        }
    }
}
Also used : TreeDataProvider(com.vaadin.data.provider.TreeDataProvider) RouteToAnnotateEvent(de.catma.ui.events.routing.RouteToAnnotateEvent) SourceDocument(de.catma.document.source.SourceDocument) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference)

Aggregations

TreeDataProvider (com.vaadin.data.provider.TreeDataProvider)1 AnnotationCollectionReference (de.catma.document.annotation.AnnotationCollectionReference)1 SourceDocument (de.catma.document.source.SourceDocument)1 RouteToAnnotateEvent (de.catma.ui.events.routing.RouteToAnnotateEvent)1