use of de.catma.ui.module.analyze.CSVExportGroupedStreamSource 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