use of de.catma.ui.module.analyze.CSVExportFlatStreamSource 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));
}
use of de.catma.ui.module.analyze.CSVExportFlatStreamSource in project catma by forTEXT.
the class QueryResultPanel method initActions.
private void initActions(CloseListener resultPanelCloseListener) {
if (cardStyle) {
caretRightBt.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
addComponent(treeGridPanel);
((HorizontalLayout) caretRightBt.getParent()).replaceComponent(caretRightBt, caretDownBt);
searchField.setEnabled(true);
}
});
caretDownBt.addClickListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
removeComponent(treeGridPanel);
((HorizontalLayout) caretDownBt.getParent()).replaceComponent(caretDownBt, caretRightBt);
searchField.setEnabled(false);
}
});
}
optionsBt.addClickListener((evt) -> optionsMenu.open(evt.getClientX(), evt.getClientY()));
miGroupByPhrase = optionsMenu.addItem("Group by Phrase", mi -> initPhraseBasedData());
miGroupByPhrase.setEnabled(false);
miGroupByTagPath = optionsMenu.addItem("Group by Tag Path", mi -> initTagBasedData());
miFlatTable = optionsMenu.addItem("Display Annotations as flat table", mi -> initFlatTagBasedData());
miPropertiesAsColumns = optionsMenu.addItem("Display Properties as columns", mi -> initPropertiesAsColumnsTagBasedData());
MenuItem miExport = optionsMenu.addItem("Export");
MenuItem miCSVFlatExport = miExport.addItem("Export flat as CSV");
StreamResource csvFlatExportResource = new StreamResource(new CSVExportFlatStreamSource(() -> getFilteredQueryResult(), project, kwicProviderCache, ((BackgroundServiceProvider) UI.getCurrent())), "CATMA-Query-Result_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);
MenuItem miCSVGroupedByPhraseExport = miExport.addItem("Export grouped as CSV");
StreamResource csvGroupedByPhraseExportResource = new StreamResource(new CSVExportGroupedStreamSource(() -> getFilteredQueryResult(), project, () -> getDisplaySetting().equals(DisplaySetting.GROUPED_BY_TAG), kwicProviderCache, ((BackgroundServiceProvider) UI.getCurrent())), "CATMA-Query-Result_Export-" + LocalDateTime.now().format(DateTimeFormatter.ISO_DATE_TIME) + ".csv");
csvGroupedByPhraseExportResource.setCacheTime(0);
csvGroupedByPhraseExportResource.setMIMEType("text/comma-separated-values");
FileDownloader csvGroupedByPhraseExportFileDownloader = new FileDownloader(csvGroupedByPhraseExportResource);
csvGroupedByPhraseExportFileDownloader.extend(miCSVGroupedByPhraseExport);
MenuItem miFilterPunctuation = optionsMenu.addItem("Filter punctuation", mi -> queryResultGrid.getDataProvider().refreshAll());
miFilterPunctuation.setCheckable(true);
miFilterPunctuation.setChecked(true);
punctuationFilter = new PunctuationFilter(() -> miFilterPunctuation.isChecked());
if (resultPanelCloseListener != null) {
removeBt.addClickListener(clickEvent -> resultPanelCloseListener.closeRequest(QueryResultPanel.this));
} else {
removeBt.setVisible(false);
}
searchField.addValueChangeListener(event -> handleSearchValueInput(event.getValue()));
}
Aggregations