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