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