Search in sources :

Example 1 with AnnotationWizard

use of de.catma.ui.module.analyze.visualization.kwic.annotation.AnnotationWizard in project catma by forTEXT.

the class KwicPanel method handleAnnotateSelectedRequest.

private void handleAnnotateSelectedRequest(EventBus eventBus) {
    final Set<QueryResultRow> selectedRows = kwicGrid.getSelectedItems();
    if (selectedRows.isEmpty()) {
        Notification.show("Info", "Please select one or more rows to annotate!", Type.HUMANIZED_MESSAGE);
        return;
    }
    Set<String> documentIds = kwicDataProvider.getItems().stream().map(row -> row.getSourceDocumentId()).collect(Collectors.toSet());
    WizardContext wizardContext = new WizardContext();
    wizardContext.put(AnnotationWizardContextKey.DOCUMENTIDS, documentIds);
    AnnotationWizard wizard = new AnnotationWizard(eventBus, project, wizardContext, new SaveCancelListener<WizardContext>() {

        @Override
        public void savePressed(WizardContext result) {
            try {
                annotateSelection(selectedRows, result);
            } catch (Exception e) {
                ((ErrorHandler) UI.getCurrent()).showAndLogError("error annotating selected rows", e);
            }
        }
    });
    wizard.show();
}
Also used : BackgroundServiceProvider(de.catma.backgroundservice.BackgroundServiceProvider) DisplaySetting(de.catma.ui.module.analyze.queryresultpanel.DisplaySetting) MenuItem(com.vaadin.ui.MenuBar.MenuItem) LoadingCache(com.google.common.cache.LoadingCache) ZonedDateTime(java.time.ZonedDateTime) UI(com.vaadin.ui.UI) QueryResultRowArray(de.catma.queryengine.result.QueryResultRowArray) SearchFilterProvider(de.catma.ui.component.actiongrid.SearchFilterProvider) KwicProvider(de.catma.indexer.KwicProvider) ErrorHandler(de.catma.ui.module.main.ErrorHandler) Map(java.util.Map) TagQueryResultRow(de.catma.queryengine.result.TagQueryResultRow) VaadinIcons(com.vaadin.icons.VaadinIcons) Version(de.catma.tag.Version) AnnotationWizard(de.catma.ui.module.analyze.visualization.kwic.annotation.AnnotationWizard) IconButton(de.catma.ui.component.IconButton) ExpansionListener(de.catma.ui.module.analyze.visualization.ExpansionListener) Set(java.util.Set) TagInstance(de.catma.tag.TagInstance) Collectors(java.util.stream.Collectors) MarginInfo(com.vaadin.shared.ui.MarginInfo) ItemClick(com.vaadin.ui.Grid.ItemClick) ItemClickListener(com.vaadin.ui.components.grid.ItemClickListener) TagReference(de.catma.document.annotation.TagReference) CacheLoader(com.google.common.cache.CacheLoader) List(java.util.List) Type(com.vaadin.ui.Notification.Type) TagDefinition(de.catma.tag.TagDefinition) CacheBuilder(com.google.common.cache.CacheBuilder) SelectionMode(com.vaadin.ui.Grid.SelectionMode) RBACPermission(de.catma.rbac.RBACPermission) StreamResource(com.vaadin.server.StreamResource) Range(de.catma.document.Range) ClickListener(com.vaadin.ui.Button.ClickListener) Column(com.vaadin.ui.Grid.Column) VerticalLayout(com.vaadin.ui.VerticalLayout) AnnotationCollectionManager(de.catma.document.annotation.AnnotationCollectionManager) LocalDateTime(java.time.LocalDateTime) Query(com.vaadin.data.provider.Query) WizardContext(de.catma.ui.dialog.wizard.WizardContext) ActionGridComponent(de.catma.ui.component.actiongrid.ActionGridComponent) ActionGridBar(de.catma.ui.component.actiongrid.ActionGridBar) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) EventBus(com.google.common.eventbus.EventBus) Registration(com.vaadin.shared.Registration) Notification(com.vaadin.ui.Notification) Label(com.vaadin.ui.Label) IDGenerator(de.catma.util.IDGenerator) SaveCancelListener(de.catma.ui.dialog.SaveCancelListener) CSVExportGroupedStreamSource(de.catma.ui.module.analyze.CSVExportGroupedStreamSource) ListDataProvider(com.vaadin.data.provider.ListDataProvider) ContentMode(com.vaadin.shared.ui.ContentMode) Property(de.catma.tag.Property) ClickEvent(com.vaadin.ui.Button.ClickEvent) AnnotationCollectionReference(de.catma.document.annotation.AnnotationCollectionReference) Project(de.catma.project.Project) QueryResultRow(de.catma.queryengine.result.QueryResultRow) SourceDocument(de.catma.document.source.SourceDocument) Visualization(de.catma.ui.module.analyze.visualization.Visualization) ContextMenu(com.vaadin.contextmenu.ContextMenu) QueryResultRowInAnnotateEvent(de.catma.ui.events.QueryResultRowInAnnotateEvent) DateTimeFormatter(java.time.format.DateTimeFormatter) FileDownloader(com.vaadin.server.FileDownloader) SerializablePredicate(com.vaadin.server.SerializablePredicate) HtmlRenderer(com.vaadin.ui.renderers.HtmlRenderer) CSVExportFlatStreamSource(de.catma.ui.module.analyze.CSVExportFlatStreamSource) AnnotationWizardContextKey(de.catma.ui.module.analyze.visualization.kwic.annotation.AnnotationWizardContextKey) Grid(com.vaadin.ui.Grid) ErrorHandler(de.catma.ui.module.main.ErrorHandler) TagQueryResultRow(de.catma.queryengine.result.TagQueryResultRow) QueryResultRow(de.catma.queryengine.result.QueryResultRow) WizardContext(de.catma.ui.dialog.wizard.WizardContext) AnnotationWizard(de.catma.ui.module.analyze.visualization.kwic.annotation.AnnotationWizard)

Aggregations

CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 EventBus (com.google.common.eventbus.EventBus)1 ContextMenu (com.vaadin.contextmenu.ContextMenu)1 ListDataProvider (com.vaadin.data.provider.ListDataProvider)1 Query (com.vaadin.data.provider.Query)1 VaadinIcons (com.vaadin.icons.VaadinIcons)1 FileDownloader (com.vaadin.server.FileDownloader)1 SerializablePredicate (com.vaadin.server.SerializablePredicate)1 StreamResource (com.vaadin.server.StreamResource)1 Registration (com.vaadin.shared.Registration)1 ContentMode (com.vaadin.shared.ui.ContentMode)1 MarginInfo (com.vaadin.shared.ui.MarginInfo)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 Grid (com.vaadin.ui.Grid)1 Column (com.vaadin.ui.Grid.Column)1 ItemClick (com.vaadin.ui.Grid.ItemClick)1 SelectionMode (com.vaadin.ui.Grid.SelectionMode)1