use of annis.gui.frequency.UserGeneratedFrequencyEntry in project ANNIS by korpling.
the class QueryController method executeFrequency.
public void executeFrequency(FrequencyQueryPanel panel) {
// kill old request
Future freqFuture = state.getExecutedTasks().get(QueryUIState.QueryType.FREQUENCY);
if (freqFuture != null && !freqFuture.isDone()) {
freqFuture.cancel(true);
}
if ("".equals(state.getAql().getValue())) {
Notification.show("Empty query", Notification.Type.WARNING_MESSAGE);
panel.showQueryDefinitionPanel();
return;
} else if (state.getSelectedCorpora().getValue().isEmpty()) {
Notification.show("Please select a corpus", Notification.Type.WARNING_MESSAGE);
panel.showQueryDefinitionPanel();
return;
}
BeanContainer<Integer, UserGeneratedFrequencyEntry> container = state.getFrequencyTableDefinition();
FrequencyTableQuery freqDefinition = new FrequencyTableQuery();
for (Integer id : container.getItemIds()) {
UserGeneratedFrequencyEntry userGen = container.getItem(id).getBean();
freqDefinition.add(userGen.toFrequencyTableEntry());
}
// additionally add meta data columns
for (String m : state.getFrequencyMetaData().getValue()) {
FrequencyTableEntry entry = new FrequencyTableEntry();
entry.setType(FrequencyTableEntryType.meta);
entry.setKey(m);
freqDefinition.add(entry);
}
FrequencyQuery query = QueryGenerator.frequency().query(state.getAql().getValue()).corpora(state.getSelectedCorpora().getValue()).def(freqDefinition).build();
addHistoryEntry(query);
FrequencyBackgroundJob job = new FrequencyBackgroundJob(ui, query, panel);
freqFuture = Background.call(job);
state.getExecutedTasks().put(QueryUIState.QueryType.FREQUENCY, freqFuture);
}
Aggregations