Search in sources :

Example 6 with FrequencyTableEntry

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);
}
Also used : FrequencyTable(annis.service.objects.FrequencyTable) Table(com.vaadin.ui.Table) FrequencyTableEntry(annis.service.objects.FrequencyTableEntry) FrequencyTable(annis.service.objects.FrequencyTable)

Aggregations

FrequencyTableEntry (annis.service.objects.FrequencyTableEntry)6 FrequencyTableQuery (annis.service.objects.FrequencyTableQuery)3 AnnisQLSemanticsException (annis.exceptions.AnnisQLSemanticsException)1 FrequencyBackgroundJob (annis.gui.controller.FrequencyBackgroundJob)1 UserGeneratedFrequencyEntry (annis.gui.frequency.UserGeneratedFrequencyEntry)1 FrequencyQuery (annis.gui.objects.FrequencyQuery)1 QueryNode (annis.model.QueryNode)1 FrequencyTable (annis.service.objects.FrequencyTable)1 Table (com.vaadin.ui.Table)1 Future (java.util.concurrent.Future)1