use of de.catma.ui.component.actiongrid.ActionGridBar in project catma by forTEXT.
the class KwicPanel method initActions.
private void initActions(EventBus eventBus) {
ContextMenu moreOptionsMenu = kwicGridComponent.getActionGridBar().getBtnMoreOptionsContextMenu();
moreOptionsMenu.addItem("Annotate selected rows", mi -> handleAnnotateSelectedRequest(eventBus));
ActionGridBar actionBar = kwicGridComponent.getActionGridBar();
actionBar.addButtonAfterSearchField(btnClearSelectedRows);
btnClearSelectedRows.addClickListener(new ClickListener() {
@Override
public void buttonClick(ClickEvent event) {
handleRemoveRowRequest();
}
});
miRemoveAnnotations = moreOptionsMenu.addItem("Remove selected Annotations", mi -> handleRemoveAnnotationsRequest(eventBus));
miRemoveAnnotations.setEnabled(false);
MenuItem miExport = moreOptionsMenu.addItem("Export");
MenuItem miCSVFlatExport = miExport.addItem("Export as CSV");
StreamResource csvFlatExportResource = new StreamResource(new CSVExportFlatStreamSource(() -> getFilteredQueryResult(), project, kwicItemHandler.getKwicProviderCache(), ((BackgroundServiceProvider) UI.getCurrent())), "CATMA-KWIC_Export-" + LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME) + ".csv");
csvFlatExportResource.setCacheTime(0);
csvFlatExportResource.setMIMEType("text/comma-separated-values");
FileDownloader csvFlatExportFileDownloader = new FileDownloader(csvFlatExportResource);
csvFlatExportFileDownloader.extend(miCSVFlatExport);
kwicGridComponent.setSearchFilterProvider(new SearchFilterProvider<QueryResultRow>() {
@Override
public SerializablePredicate<QueryResultRow> createSearchFilter(String searchInput) {
return (row) -> kwicItemHandler.containsSearchInput(row, searchInput);
}
});
btExpandCompress.addClickListener(clickEvent -> handleMaxMinRequest());
defaultDoubleClickRegistration = kwicGrid.addItemClickListener(clickEvent -> handleKwicItemClick(clickEvent, eventBus));
}
Aggregations