Search in sources :

Example 1 with LoadableVisualizer

use of annis.visualizers.LoadableVisualizer 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)1 MediaPlayer (annis.libgui.media.MediaPlayer)1 PDFViewer (annis.libgui.media.PDFViewer)1 LoadableVisualizer (annis.visualizers.LoadableVisualizer)1