Search in sources :

Example 1 with Visualizer

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

the class EmbeddedVisUI method showHtmlDoc.

private void showHtmlDoc(String corpus, String doc, Map<String, String[]> args) {
    // do nothing for empty fragments
    if (args == null || args.isEmpty()) {
        return;
    }
    if (args.get("config") != null && args.get("config").length > 0) {
        String config = args.get("config")[0];
        // get input parameters
        HTMLVis visualizer;
        visualizer = new HTMLVis();
        VisualizerInput input;
        Visualizer visConfig;
        visConfig = new Visualizer();
        visConfig.setDisplayName(" ");
        visConfig.setMappings("config:" + config);
        visConfig.setNamespace(null);
        visConfig.setType("htmldoc");
        // create input
        try {
            input = DocBrowserController.createInput(corpus, doc, visConfig, false, null);
            // create components, put in a panel
            Panel viszr = visualizer.createComponent(input, null);
            // Set the panel as the content of the UI
            setContent(viszr);
        } catch (UniformInterfaceException ex) {
            displayMessage("Could not query document", "error was \"" + ex.getMessage() + "\" (detailed error is available in the server log-files)");
            log.error("Could not get document for embedded visualizer", ex);
        }
    } else {
        displayMessage("Missing required argument for visualizer \"htmldoc\"", "The following arguments are required:" + "<ul>" + "<li><code>config</code>: the internal config file to use (same as <a href=\"http://korpling.github.io/ANNIS/doc/classannis_1_1visualizers_1_1htmlvis_1_1HTMLVis.html\">\"config\" mapping parameter)</a></li>" + "</ul>");
    }
}
Also used : Panel(com.vaadin.ui.Panel) UniformInterfaceException(com.sun.jersey.api.client.UniformInterfaceException) VisualizerInput(annis.libgui.visualizers.VisualizerInput) Visualizer(annis.service.objects.Visualizer) HTMLVis(annis.visualizers.htmlvis.HTMLVis)

Example 2 with Visualizer

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

the class DocBrowserTable method generateVisualizerLinks.

private Panel generateVisualizerLinks(String docName) {
    Panel p = new Panel();
    VerticalLayout l = new VerticalLayout();
    p.addStyleName(ChameleonTheme.PANEL_BORDERLESS);
    if (docVisualizerConfig != null) {
        Visualizer[] visualizers = docVisualizerConfig.getVisualizers();
        if (visualizers != null) {
            for (Visualizer visualizer : visualizers) {
                Button openVis = new Button(visualizer.getDisplayName());
                openVis.setDescription("open visualizer with the full text of " + docName);
                openVis.addClickListener(new OpenVisualizerWindow(docName, visualizer, openVis));
                openVis.setStyleName(BaseTheme.BUTTON_LINK);
                openVis.setDisableOnClick(true);
                l.addComponent(openVis);
            }
        }
    }
    p.setContent(l);
    return p;
}
Also used : Panel(com.vaadin.ui.Panel) MetaDataPanel(annis.gui.MetaDataPanel) Button(com.vaadin.ui.Button) VerticalLayout(com.vaadin.ui.VerticalLayout) Visualizer(annis.service.objects.Visualizer)

Aggregations

Visualizer (annis.service.objects.Visualizer)2 Panel (com.vaadin.ui.Panel)2 MetaDataPanel (annis.gui.MetaDataPanel)1 VisualizerInput (annis.libgui.visualizers.VisualizerInput)1 HTMLVis (annis.visualizers.htmlvis.HTMLVis)1 UniformInterfaceException (com.sun.jersey.api.client.UniformInterfaceException)1 Button (com.vaadin.ui.Button)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1