Search in sources :

Example 1 with MediaController

use of annis.libgui.media.MediaController in project ANNIS by korpling.

the class GridVisualizer method createComponent.

@Override
public GridComponent createComponent(VisualizerInput visInput, VisualizationToggle visToggle) {
    MediaController mediaController = VaadinSession.getCurrent().getAttribute(MediaController.class);
    PDFController pdfController = VaadinSession.getCurrent().getAttribute(PDFController.class);
    GridComponent component = null;
    try {
        component = new GridComponent(visInput, mediaController, pdfController, true, null);
    } catch (Exception ex) {
        log.error("create {} failed", GridComponent.class.getName(), ex);
    }
    return component;
}
Also used : MediaController(annis.libgui.media.MediaController) PDFController(annis.libgui.media.PDFController)

Example 2 with MediaController

use of annis.libgui.media.MediaController in project ANNIS by korpling.

the class KWICVisualizer method createComponent.

@Override
public KWICInterface createComponent(VisualizerInput visInput, VisualizationToggle visToggle) {
    MediaController mediaController = VaadinSession.getCurrent().getAttribute(MediaController.class);
    PDFController pdfController = VaadinSession.getCurrent().getAttribute(PDFController.class);
    List<STextualDS> texts = visInput.getDocument().getDocumentGraph().getTextualDSs();
    // having the KWIC nested in a panel can slow down rendering
    if (texts.size() == 1) {
        // directly return the single non-nested KWIC panel
        return new KWICComponent(visInput, mediaController, pdfController, texts.get(0));
    } else {
        // return a more complicated implementation which can handle several texts
        return new KWICMultipleTextComponent(visInput, mediaController, pdfController);
    }
}
Also used : MediaController(annis.libgui.media.MediaController) PDFController(annis.libgui.media.PDFController) STextualDS(org.corpus_tools.salt.common.STextualDS)

Example 3 with MediaController

use of annis.libgui.media.MediaController in project ANNIS by korpling.

the class VisualizerPanel method updateGUIAfterLoadingVisualizer.

// end loadVisualizer
private void updateGUIAfterLoadingVisualizer(LoadableVisualizer.Callback callback) {
    if (callback != null && vis instanceof LoadableVisualizer) {
        LoadableVisualizer loadableVis = (LoadableVisualizer) vis;
        if (loadableVis.isLoaded()) {
            // direct call callback since the visualizer is already ready
            callback.visualizerLoaded(loadableVis);
        } else {
            loadableVis.clearCallbacks();
            // add listener when player was fully loaded
            loadableVis.addOnLoadCallBack(callback);
        }
    }
    progress.setEnabled(false);
    progress.setVisible(false);
    if (vis != null) {
        btEntry.setEnabled(true);
        vis.setVisible(true);
        if (vis instanceof PDFViewer) {
            ((PDFViewer) vis).openPDFPage("-1");
        }
        if (vis instanceof MediaPlayer) {
            // if this is a media player visualizer, close all other media players
            // since some browsers (e.g. Chrome) have problems if there are multiple
            // audio/video elements on one page
            MediaController mediaController = VaadinSession.getCurrent().getAttribute(MediaController.class);
            mediaController.closeOtherPlayers((MediaPlayer) vis);
        }
        // add if not already added
        if (getComponentIndex(vis) < 0) {
            addComponent(vis);
        }
    }
}
Also used : MediaController(annis.libgui.media.MediaController) LoadableVisualizer(annis.visualizers.LoadableVisualizer) PDFViewer(annis.libgui.media.PDFViewer) MediaPlayer(annis.libgui.media.MediaPlayer)

Aggregations

MediaController (annis.libgui.media.MediaController)3 PDFController (annis.libgui.media.PDFController)2 MediaPlayer (annis.libgui.media.MediaPlayer)1 PDFViewer (annis.libgui.media.PDFViewer)1 LoadableVisualizer (annis.visualizers.LoadableVisualizer)1 STextualDS (org.corpus_tools.salt.common.STextualDS)1