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>");
}
}
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;
}
Aggregations