use of de.catma.queryengine.QueryOptions 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.QueryOptions 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.QueryOptions in project catma by forTEXT.
the class AnalyzeView method executeSearch.
private void executeSearch(String searchInput, Consumer<QueryResultPanel> addToLayoutFunction) {
QueryOptions queryOptions = new QueryOptions(new QueryId(searchInput), currentCorpus.getDocumentIds(), currentCorpus.getCollectionIds(), indexInfoSet.getUnseparableCharacterSequences(), indexInfoSet.getUserDefinedSeparatingCharacters(), indexInfoSet.getLocale(), project);
QueryJob job = new QueryJob(searchInput, queryOptions);
showProgress(true);
((BackgroundServiceProvider) UI.getCurrent()).submit("Searching...", job, new ExecutionListener<QueryResult>() {
public void done(QueryResult result) {
try {
QueryResultPanel queryResultPanel = new QueryResultPanel(project, result, new QueryId(searchInput.toString()), kwicProviderCache, closingPanel -> handleRemoveQueryResultPanel(closingPanel));
addToLayoutFunction.accept(queryResultPanel);
addQueryResultPanelSetting(queryResultPanel.getQueryResultPanelSetting());
} finally {
showProgress(false);
}
}
public void error(Throwable t) {
showProgress(false);
if (t instanceof QueryException) {
QueryJob.QueryException qe = (QueryJob.QueryException) t;
String input = qe.getInput();
int idx = ((RecognitionException) qe.getCause()).charPositionInLine;
if ((idx >= 0) && (input.length() > idx)) {
char character = input.charAt(idx);
String message = MessageFormat.format("<html><p>There is something wrong with your query <b>{0}</b> approximately at positon {1} character <b>{2}</b>.</p> <p>If you are unsure about how to construct a query try the Query Builder!</p></html>", input, idx + 1, character);
HTMLNotification.show("Info", message, Type.TRAY_NOTIFICATION);
} else {
String message = MessageFormat.format("<html><p>There is something wrong with your query <b>{0}</b>.</p> <p>If you are unsure about how to construct a query try the Query Builder!</p></html>", input);
HTMLNotification.show("Info", message, Type.TRAY_NOTIFICATION);
}
} else {
((ErrorHandler) UI.getCurrent()).showAndLogError("Error during search!", t);
}
}
});
}
Aggregations