use of annis.service.objects.FrequencyTableEntry in project ANNIS by korpling.
the class FrequencyResultPanel method recreateTable.
private void recreateTable(FrequencyTable table) {
if (tblResult != null) {
removeComponent(tblResult);
}
tblResult = new Table();
tblResult.setSizeFull();
tblResult.setCaption(table.getEntries().size() + " items with a total sum of " + table.getSum() + " (query on " + Joiner.on(", ").join(query.getCorpora()) + ")");
tblResult.setSelectable(true);
tblResult.setMultiSelect(false);
tblResult.addStyleName(Helper.CORPUS_FONT_FORCE);
if (!table.getEntries().isEmpty()) {
FrequencyTable.Entry firstEntry = table.getEntries().iterator().next();
int tupelCount = firstEntry.getTupel().length;
tblResult.addContainerProperty("rank", Integer.class, -1);
for (int i = 1; i <= tupelCount; i++) {
tblResult.addContainerProperty("tupel-" + i, String.class, "");
FrequencyTableEntry e = query.getFrequencyDefinition().get(i - 1);
tblResult.setColumnHeader("tupel-" + i, getCaption(e));
}
tblResult.addContainerProperty("count", Long.class, -1l);
int line = 0;
for (FrequencyTable.Entry e : table.getEntries()) {
Object[] cells = new Object[tupelCount + 2];
System.arraycopy(e.getTupel(), 0, cells, 1, tupelCount);
cells[0] = line + 1;
cells[cells.length - 1] = e.getCount();
tblResult.addItem(cells, "entry-" + line++);
}
}
addLexicalSort(tblResult.getContainerDataSource());
addComponent(tblResult);
setExpandRatio(tblResult, 1.0f);
}
Aggregations