use of de.catma.queryengine.QueryId in project catma by forTEXT.
the class AnalyzeView method handleRefreshQueryResultPanel.
private void handleRefreshQueryResultPanel(RefreshQueryResultPanel refreshQueryResultPanel) {
QueryId queryId = refreshQueryResultPanel.getQueryId();
executeSearch(queryId.getQuery(), queryResultPanel -> resultsPanel.replaceComponent(refreshQueryResultPanel, queryResultPanel));
}
use of de.catma.queryengine.QueryId in project catma by forTEXT.
the class AnalyzeView method addDistViz.
private void addDistViz() {
if (getQueryResultPanelSettings().isEmpty()) {
Notification.show("Info", "Please query some data first!", Type.HUMANIZED_MESSAGE);
return;
}
VegaPanel vegaPanel = new VegaPanel(eventBus, project, kwicProviderCache, () -> new QueryOptions(// TODO: ok?
new QueryId(""), currentCorpus.getDocumentIds(), currentCorpus.getCollectionIds(), indexInfoSet.getUnseparableCharacterSequences(), indexInfoSet.getUserDefinedSeparatingCharacters(), indexInfoSet.getLocale(), project), new DistributionDisplaySettingHandler());
String name = "Distribution Chart " + LocalDateTime.now().format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM));
VizMaxPanel vizMaxPanel = new VizMaxPanel(name, vegaPanel, getQueryResultPanelSettings(), project, kwicProviderCache, closedVizMaxPanel -> setContent(contentPanel, closedVizMaxPanel));
VizMinPanel vizMinPanel = new VizMinPanel(name, vizMaxPanel, toBeRemovedVizMinPanel -> vizCardsPanel.removeComponent(toBeRemovedVizMinPanel), () -> setContent(vizMaxPanel, contentPanel));
vizCardsPanel.addComponentAsFirst(vizMinPanel);
setContent(vizMaxPanel, contentPanel);
}
use of de.catma.queryengine.QueryId in project catma by forTEXT.
the class AnalyzeView method addWCViz.
private void addWCViz() {
if (getQueryResultPanelSettings().isEmpty()) {
Notification.show("Info", "Please query some data first!", Type.HUMANIZED_MESSAGE);
return;
}
VegaPanel vegaPanel = new VegaPanel(eventBus, project, kwicProviderCache, () -> new QueryOptions(// TODO: ok?
new QueryId(""), currentCorpus.getDocumentIds(), currentCorpus.getCollectionIds(), indexInfoSet.getUnseparableCharacterSequences(), indexInfoSet.getUserDefinedSeparatingCharacters(), indexInfoSet.getLocale(), project), new WordCloudDisplaySettingHandler());
String name = "Wordcloud " + LocalDateTime.now().format(DateTimeFormatter.ofLocalizedTime(FormatStyle.MEDIUM));
VizMaxPanel vizMaxPanel = new VizMaxPanel(name, vegaPanel, getQueryResultPanelSettings(), project, kwicProviderCache, closedVizMaxPanel -> setContent(contentPanel, closedVizMaxPanel));
VizMinPanel vizMinPanel = new VizMinPanel(name, vizMaxPanel, toBeRemovedVizMinPanel -> vizCardsPanel.removeComponent(toBeRemovedVizMinPanel), () -> setContent(vizMaxPanel, contentPanel));
vizCardsPanel.addComponentAsFirst(vizMinPanel);
setContent(vizMaxPanel, contentPanel);
}
use of de.catma.queryengine.QueryId in project catma by forTEXT.
the class QueryResultPanel method initPropertiesAsColumnsTagBasedData.
void initPropertiesAsColumnsTagBasedData() {
displaySetting = DisplaySetting.PROPERTIES_AS_COLUMNS;
miGroupByTagPath.setEnabled(true);
miGroupByPhrase.setEnabled(true);
miFlatTable.setEnabled(true);
miPropertiesAsColumns.setEnabled(false);
treeGridPanel.removeAllComponents();
initQueryResultGrid();
TreeDataProvider<QueryResultRowItem> queryResultDataProvider = new TreeDataProvider<QueryResultRowItem>(getPropertiesAsColumnsTagBasedTreeData());
queryResultDataProvider.addFilter(punctuationFilter);
Column<QueryResultRowItem, ?> tagPathColumn = queryResultGrid.addColumn(QueryResultRowItem::getTagPath).setCaption("Tag Path").setWidth(200);
if (includeQueryId) {
// TODO: add a queryId column
}
queryResultGrid.addColumn(QueryResultRowItem::getKey).setCaption("Annotation").setDescriptionGenerator(item -> item.getDetailedKeyInContext(), ContentMode.HTML).setRenderer(new HtmlRenderer()).setId("annotation").setWidth(200);
for (String propertyName : propertyNames) {
queryResultGrid.addColumn(item -> item.getPropertyValue(propertyName)).setCaption(propertyName).setWidth(200);
}
queryResultGrid.addColumn(QueryResultRowItem::getDocumentName).setCaption("Document").setWidth(200);
queryResultGrid.addColumn(QueryResultRowItem::getCollectionName).setCaption("Collection").setWidth(200);
if (itemSelectionListener != null) {
ButtonRenderer<QueryResultRowItem> selectItemsRenderer = new ButtonRenderer<QueryResultRowItem>(rendererClickEvent -> itemSelectionListener.itemSelected(rendererClickEvent.getItem()));
selectItemsRenderer.setHtmlContentAllowed(true);
queryResultGrid.addColumn((item) -> VaadinIcons.ARROW_CIRCLE_DOWN_O.getHtml()).setCaption("Select").setRenderer(selectItemsRenderer).setExpandRatio(1);
}
if (itemRemovedListener != null) {
ButtonRenderer<QueryResultRowItem> removeItemsRenderer = new ButtonRenderer<QueryResultRowItem>(rendererClickEvent -> itemRemovedListener.itemRemoved(rendererClickEvent.getItem()));
removeItemsRenderer.setHtmlContentAllowed(true);
queryResultGrid.addColumn((item) -> VaadinIcons.ERASER.getHtml()).setCaption("Remove").setRenderer(removeItemsRenderer).setExpandRatio(1);
}
FooterRow footer = queryResultGrid.prependFooterRow();
queryResultGrid.setFooterVisible(true);
queryResultDataProvider.addDataProviderListener(event -> handleTotalTypesChange(null, null, "Annotations", footer.getCell("annotation"), queryResultDataProvider));
queryResultGrid.setDataProvider(queryResultDataProvider);
handleTotalTypesChange(null, null, "Annotations", footer.getCell("annotation"), queryResultDataProvider);
treeGridPanel.addComponent(queryResultGrid);
if (queryResultDataProvider.getTreeData().getRootItems().size() == 0) {
Notification.show("Info", "Your query result does not contain annotated occurrences!", Type.HUMANIZED_MESSAGE);
}
queryResultGrid.setSortOrder(new GridSortOrderBuilder<QueryResultRowItem>().thenAsc(tagPathColumn).build());
initInfoLabel();
fireDisplaySettingChanged();
}
use of de.catma.queryengine.QueryId in project catma by forTEXT.
the class QueryResultPanel method initFlatTagBasedData.
void initFlatTagBasedData() {
displaySetting = DisplaySetting.ANNOTATIONS_AS_FLAT_TABLE;
miGroupByTagPath.setEnabled(true);
miGroupByPhrase.setEnabled(true);
miFlatTable.setEnabled(false);
miPropertiesAsColumns.setEnabled(true);
treeGridPanel.removeAllComponents();
initQueryResultGrid();
TreeDataProvider<QueryResultRowItem> queryResultDataProvider = new TreeDataProvider<QueryResultRowItem>(getFlatTagBasedTreeData());
queryResultDataProvider.addFilter(punctuationFilter);
Column<QueryResultRowItem, ?> tagPathColumn = queryResultGrid.addColumn(QueryResultRowItem::getTagPath).setCaption("Tag Path").setDescriptionGenerator(item -> item.getDetailedKeyInContext(), ContentMode.HTML).setWidth(200);
if (includeQueryId) {
// TODO: add a queryId column
}
queryResultGrid.addColumn(QueryResultRowItem::getDocumentName).setCaption("Document").setWidth(200);
queryResultGrid.addColumn(QueryResultRowItem::getCollectionName).setCaption("Collection").setWidth(200);
queryResultGrid.addColumn(QueryResultRowItem::getKey).setCaption("Annotation").setId("annotation").setRenderer(new HtmlRenderer()).setWidth(200);
if (resultContainsProperties) {
queryResultGrid.addColumn(QueryResultRowItem::getPropertyName).setCaption("Property").setWidth(100);
queryResultGrid.addColumn(QueryResultRowItem::getPropertyValue).setId("propertyvalue").setCaption("Property Value").setWidth(300);
}
if (itemSelectionListener != null) {
ButtonRenderer<QueryResultRowItem> selectItemsRenderer = new ButtonRenderer<QueryResultRowItem>(rendererClickEvent -> itemSelectionListener.itemSelected(rendererClickEvent.getItem()));
selectItemsRenderer.setHtmlContentAllowed(true);
queryResultGrid.addColumn((item) -> VaadinIcons.ARROW_CIRCLE_DOWN_O.getHtml()).setCaption("Select").setRenderer(selectItemsRenderer).setExpandRatio(1);
}
if (itemRemovedListener != null) {
ButtonRenderer<QueryResultRowItem> removeItemsRenderer = new ButtonRenderer<QueryResultRowItem>(rendererClickEvent -> itemRemovedListener.itemRemoved(rendererClickEvent.getItem()));
removeItemsRenderer.setHtmlContentAllowed(true);
queryResultGrid.addColumn((item) -> VaadinIcons.ERASER.getHtml()).setCaption("Remove").setRenderer(removeItemsRenderer).setExpandRatio(1);
}
queryResultGrid.setDataProvider(queryResultDataProvider);
FooterRow footer = queryResultGrid.prependFooterRow();
queryResultGrid.setFooterVisible(true);
if (resultContainsProperties) {
queryResultDataProvider.addDataProviderListener(event -> handleTotalTypesChange(null, null, "Property Values", footer.getCell("propertyvalue"), queryResultDataProvider));
handleTotalTypesChange(null, null, "Property Values", footer.getCell("propertyvalue"), queryResultDataProvider);
} else {
queryResultDataProvider.addDataProviderListener(event -> handleTotalTypesChange(null, null, "Annotations", footer.getCell("annotation"), queryResultDataProvider));
handleTotalTypesChange(null, null, "Annotations", footer.getCell("annotation"), queryResultDataProvider);
}
treeGridPanel.addComponent(queryResultGrid);
if (queryResultDataProvider.getTreeData().getRootItems().size() == 0) {
Notification.show("Info", "Your query result does not contain annotated occurrences!", Type.HUMANIZED_MESSAGE);
}
queryResultGrid.setSortOrder(new GridSortOrderBuilder<QueryResultRowItem>().thenAsc(tagPathColumn).build());
initInfoLabel();
fireDisplaySettingChanged();
}
Aggregations