Search in sources :

Example 6 with FrequencyTable

use of annis.service.objects.FrequencyTable in project ANNIS by korpling.

the class FrequencyResultPanel method showResult.

private void showResult(FrequencyTable table) {
    if (queryPanel != null) {
        queryPanel.notifiyQueryFinished();
    }
    recreateTable(table);
    btDownloadCSV.setVisible(true);
    FileDownloader downloader = new FileDownloader(new StreamResource(new CSVResource(table, query.getFrequencyDefinition()), "frequency.txt"));
    downloader.extend(btDownloadCSV);
    chart.setVisible(true);
    FrequencyTable clippedTable = table;
    if (clippedTable.getEntries().size() > MAX_NUMBER_OF_CHART_ITEMS) {
        List<FrequencyTable.Entry> entries = new ArrayList<>(clippedTable.getEntries());
        clippedTable = new FrequencyTable();
        clippedTable.setEntries(entries.subList(0, MAX_NUMBER_OF_CHART_ITEMS));
        clippedTable.setSum(table.getSum());
        chart.setCaption("Showing historgram of top " + MAX_NUMBER_OF_CHART_ITEMS + " results, see table below for complete dataset.");
    }
    chart.setFrequencyData(clippedTable);
}
Also used : FrequencyTableEntry(annis.service.objects.FrequencyTableEntry) StreamResource(com.vaadin.server.StreamResource) ArrayList(java.util.ArrayList) FileDownloader(com.vaadin.server.FileDownloader) FrequencyTable(annis.service.objects.FrequencyTable)

Aggregations

FrequencyTable (annis.service.objects.FrequencyTable)6 FrequencyTableEntry (annis.service.objects.FrequencyTableEntry)2 QueryData (annis.ql.parser.QueryData)1 FrequencyTableQuery (annis.service.objects.FrequencyTableQuery)1 MatrixQueryData (annis.sqlgen.MatrixQueryData)1 AnnotateQueryData (annis.sqlgen.extensions.AnnotateQueryData)1 LimitOffsetQueryData (annis.sqlgen.extensions.LimitOffsetQueryData)1 ClientHandlerException (com.sun.jersey.api.client.ClientHandlerException)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 WebResource (com.sun.jersey.api.client.WebResource)1 FileDownloader (com.vaadin.server.FileDownloader)1 StreamResource (com.vaadin.server.StreamResource)1 Table (com.vaadin.ui.Table)1 ResultSetMetaData (java.sql.ResultSetMetaData)1 ArrayList (java.util.ArrayList)1 Date (java.util.Date)1 GET (javax.ws.rs.GET)1 Path (javax.ws.rs.Path)1 Produces (javax.ws.rs.Produces)1 Subject (org.apache.shiro.subject.Subject)1