Search in sources :

Example 1 with ExporterPlugin

use of annis.libgui.exporter.ExporterPlugin in project ANNIS by korpling.

the class QueryController method executeExport.

public void executeExport(ExportPanel panel, EventBus eventBus) {
    Future exportFuture = state.getExecutedTasks().get(QueryUIState.QueryType.EXPORT);
    if (exportFuture != null && !exportFuture.isDone()) {
        exportFuture.cancel(true);
    }
    ExportQuery query = getExportQuery();
    addHistoryEntry(query);
    ExporterPlugin exporterImpl = ui.getExporter(query.getExporter());
    exportFuture = Background.call(new ExportBackgroundJob(query, exporterImpl, ui, eventBus, panel));
    state.getExecutedTasks().put(QueryUIState.QueryType.EXPORT, exportFuture);
}
Also used : ExporterPlugin(annis.libgui.exporter.ExporterPlugin) Future(java.util.concurrent.Future) ExportQuery(annis.gui.objects.ExportQuery) ExportBackgroundJob(annis.gui.controller.ExportBackgroundJob)

Example 2 with ExporterPlugin

use of annis.libgui.exporter.ExporterPlugin in project ANNIS by korpling.

the class ExportPanel method attach.

@Override
public void attach() {
    super.attach();
    this.ui = UI.getCurrent();
    if (this.ui instanceof AnnisBaseUI) {
        PluginManagerUtil util = new PluginManagerUtil(((AnnisBaseUI) getUI()).getPluginManager());
        for (ExporterPlugin e : util.getPlugins(ExporterPlugin.class)) {
            exporterClassContainer.addItem(e.getClass());
        }
    }
    exporterClassContainer.sort(new Object[] { "simpleName" }, new boolean[] { true });
    cbExporter.setItemCaptionMode(ItemCaptionMode.PROPERTY);
    cbExporter.setItemCaptionPropertyId("simpleName");
    if (exporterClassContainer.size() > 0) {
        cbExporter.setValue(exporterClassContainer.getIdByIndex(0));
    }
}
Also used : ExporterPlugin(annis.libgui.exporter.ExporterPlugin) PluginManagerUtil(net.xeoh.plugins.base.util.PluginManagerUtil) AnnisBaseUI(annis.libgui.AnnisBaseUI)

Example 3 with ExporterPlugin

use of annis.libgui.exporter.ExporterPlugin in project ANNIS by korpling.

the class AnnisBaseUI method getExporter.

@Override
public ExporterPlugin getExporter(Class<? extends ExporterPlugin> clazz) {
    if (exporterRegistryCache == null) {
        exporterRegistryCache = MutableClassToInstanceMap.create();
        PluginManagerUtil util = new PluginManagerUtil(getPluginManager());
        for (ExporterPlugin e : util.getPlugins(ExporterPlugin.class)) {
            exporterRegistryCache.put(e.getClass(), e);
        }
    }
    return exporterRegistryCache.get(clazz);
}
Also used : ExporterPlugin(annis.libgui.exporter.ExporterPlugin) PluginManagerUtil(net.xeoh.plugins.base.util.PluginManagerUtil)

Aggregations

ExporterPlugin (annis.libgui.exporter.ExporterPlugin)3 PluginManagerUtil (net.xeoh.plugins.base.util.PluginManagerUtil)2 ExportBackgroundJob (annis.gui.controller.ExportBackgroundJob)1 ExportQuery (annis.gui.objects.ExportQuery)1 AnnisBaseUI (annis.libgui.AnnisBaseUI)1 Future (java.util.concurrent.Future)1