Example usage for com.google.gwt.user.client DOM createUniqueId

List of usage examples for com.google.gwt.user.client DOM createUniqueId

Introduction

In this page you can find the example usage for com.google.gwt.user.client DOM createUniqueId.

Prototype

public static String createUniqueId() 

Source Link

Document

Generates a unique DOM id.

Usage

From source file:bufferings.ktr.wjr.client.ui.WjrDialogPanel.java

License:Apache License

/**
 * Constructs the WjrDialogPanel.// ww  w. j  av a2  s .  c o  m
 * 
 * @param title
 *          The dialog title.
 */
public WjrDialogPanel(String title) {
    listBox = new WjrListBox();
    listBox.setStyleName(UI_WIDGET);
    listBox.getElement().setId(DOM.createUniqueId());
    listBox.setVisible(false);
    listBox.setTitle(title);

    initWidget(listBox);
    RootPanel.get().add(this);
}

From source file:bufferings.ktr.wjr.client.ui.WjrPopupPanel.java

License:Apache License

/**
 * Constructs the WjrPopupPanel.//from www . jav  a  2s.  c o m
 */
public WjrPopupPanel() {
    HorizontalPanel mainPanel = new HorizontalPanel();
    mainPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_CENTER);
    mainPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);
    mainPanel.setSpacing(5);
    mainPanel.setStyleName(UI_STATE_HIGHLIGHT);
    mainPanel.setSize("200px", "30px");
    mainPanel.setVisible(false);
    mainPanel.getElement().getStyle().setPosition(Position.ABSOLUTE);
    mainPanel.getElement().getStyle().setPropertyPx("left", -9999);
    mainPanel.getElement().setId(DOM.createUniqueId());

    label = new Label();
    label.setStyleName(UI_WIDGET);
    mainPanel.add(label);

    initWidget(mainPanel);
    RootPanel.get().add(this);
}

From source file:com.anzsoft.client.ui.ChatWindow.java

License:Open Source License

private DivElement createMessage(final String user, final String message, boolean local) {
    Element element = DOM.createDiv();
    DivElement messageDiv = DivElement.as(element);
    lastMsgID = DOM.createUniqueId();
    messageDiv.setId(lastMsgID);/*  w  ww.j a v  a  2 s. c  o m*/
    messageDiv.setClassName("selected-article");

    //create the avatar table
    element = DOM.createTable();
    TableElement avatarTable = TableElement.as(element);
    messageDiv.appendChild(avatarTable);
    avatarTable.setAttribute("hspace", "4");
    avatarTable.setAttribute("cellspacing", "0");
    avatarTable.setAttribute("vspace", "2");
    avatarTable.setAttribute("border", "0");
    avatarTable.setAttribute("align", "left");

    Element tbodyElement = DOM.createTBody();
    avatarTable.appendChild(tbodyElement);

    Element trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);

    Element tdElement = DOM.createTD();
    trElement.appendChild(tdElement);
    tdElement.setAttribute("height", "45");
    tdElement.setAttribute("width", "45");
    tdElement.setAttribute("align", "middle");
    Style style = tdElement.getStyle();
    style.setProperty("border", "1px solid black");
    style.setProperty("background-color", "white");

    Element imgElement = DOM.createImg();
    ImageElement imageElement = ImageElement.as(imgElement);
    tdElement.appendChild(imageElement);
    imageElement.setAttribute("height", "45");
    imageElement.setAttribute("widht", "45");
    XmppVCard vc = null;
    if (local)
        vc = JabberApp.instance().getSelfVCard();
    else
        vc = vcard;
    if (!GXT.isIE && vc != null && !vc.photo().isEmpty())
        imageElement.setSrc("data:image;base64," + vc.photo());
    else
        imageElement.setSrc(JabberApp.instance().getAvatarUrl(jid));

    tdElement = DOM.createTD();
    tdElement.setInnerHTML("&nbsp&nbsp");
    trElement.appendChild(tdElement);

    //create the div for timestamp and nick
    element = DOM.createDiv();
    DivElement tnDiv = DivElement.as(element);
    tnDiv.setClassName("msg_header");
    messageDiv.appendChild(tnDiv);
    //style = tnDiv.getStyle();
    //style.setProperty("border-bottom", "1px solid black");

    element = DOM.createTable();
    TableElement tnTableElement = TableElement.as(element);
    tnDiv.appendChild(tnTableElement);
    tnTableElement.setAttribute("cellspacing", "0");
    tnTableElement.setAttribute("cellpadding", "0");
    tnTableElement.setAttribute("width", "80%");
    tnTableElement.setAttribute("border", "0");

    tbodyElement = DOM.createTBody();
    tnTableElement.appendChild(tbodyElement);

    trElement = DOM.createTR();
    tbodyElement.appendChild(trElement);

    Element nickElement = DOM.createTD();
    trElement.appendChild(nickElement);
    nickElement.setClassName("msg-nick");
    nickElement.setAttribute("valign", "bottom");
    nickElement.setAttribute("align", "left");
    nickElement.setInnerHTML("<b>" + user + "</b>");

    Element timeElement = DOM.createTD();
    trElement.appendChild(timeElement);
    timeElement.setClassName("msg-nick");
    timeElement.setAttribute("valign", "bottom");
    timeElement.setAttribute("align", "right");
    DateTimeFormat timeFormat = DateTimeFormat.getMediumTimeFormat();
    String datetime = timeFormat.format(new java.util.Date());
    timeElement.setInnerHTML("<small>" + datetime + "</small>");

    Element messageElement = DOM.createSpan();
    messageElement.setInnerHTML(ChatTextFormatter.format(message == null ? "" : message).getHTML());

    messageDiv.appendChild(messageElement);
    return messageDiv;
}

From source file:com.bramosystems.oss.player.core.client.ui.DivXPlayer.java

License:Apache License

private DivXPlayer() throws PluginNotFoundException, PluginVersionException {
    PluginVersion req;/*from  w ww .  j av a2 s  .  com*/
    try {
        req = PluginVersion.get(reqVer);
        PluginVersion v = PlayerUtil.getDivXPlayerPluginVersion();
        if (v.compareTo(req) < 0) {
            throw new PluginVersionException(Plugin.DivXPlayer, req.toString(), v.toString());
        }
    } catch (RegExp.RegexException ex) {
        throw new PluginNotFoundException(Plugin.DivXPlayer);
    }

    playerId = DOM.createUniqueId().replace("-", "");
    loopManager = new LoopManager(new LoopManager.LoopCallback() {

        @Override
        public void onLoopFinished() {
            fireDebug("Play finished");
            firePlayStateEvent(PlayStateEvent.State.Finished, playlistManager.getPlaylistIndex());
        }

        @Override
        public void playNextItem() throws PlayException {
            playlistManager.playNext();
        }

        @Override
        public void repeatPlay() {
            playlistManager.play(playlistManager.getPlaylistIndex());
        }

        @Override
        public void playNextLoop() {
            try {
                playlistManager.playNext(true);
            } catch (PlayException ex) {
            }
        }
    });

    ((CorePlayerProvider) getWidgetFactory("core")).initDivXHandlers(playerId,
            new DivXStateManager.StateCallback() {

                @Override
                public void onStatusChanged(int statusId) {
                    switch (statusId) {
                    case 1: // OPEN_DONE - media info available
                        fireDebug("Loading media @ '" + playlistManager.getCurrentItem() + "'");
                        fireDebug("Media Info available");
                        fireMediaInfoAvailable(DivXStateManager.getFilledMediaInfo(impl.getMediaDuration(),
                                impl.getVideoWidth(), impl.getVideoHeight()));
                        break;
                    case 2: // VIDEO_END, notify loop manager...
                        fireDebug("Playback ended");
                        loopManager.notifyPlayFinished();
                        break;
                    case 6: // WINDOWED_START
                        fireDebug("Window mode started");
                        break;
                    case 7: // WINDOWED_END
                        fireDebug("Window mode ended");
                        break;
                    case 8: // FULLSCREEN_START
                        fireDebug("Fullscreen started");
                        firePlayerStateEvent(PlayerStateEvent.State.FullScreenStarted);
                        break;
                    case 9: // FULLSCREEN_END
                        fireDebug("Fullscreen ended");
                        firePlayerStateEvent(PlayerStateEvent.State.FullScreenFinished);
                        break;
                    case 10: // STATUS_PLAYING
                        fireDebug("Playback started");
                        firePlayStateEvent(PlayStateEvent.State.Started, playlistManager.getPlaylistIndex());
                        break;
                    case 11: // STATUS_PAUSED
                        fireDebug("Playback paused");
                        firePlayStateEvent(PlayStateEvent.State.Paused, playlistManager.getPlaylistIndex());
                        break;
                    case 14: // STATUS_STOPPED
                        fireDebug("Playback stopped");
                        firePlayStateEvent(PlayStateEvent.State.Stopped, playlistManager.getPlaylistIndex());
                        break;
                    case 15: // BUFFERING_START
                        fireDebug("Buffering started");
                        firePlayerStateEvent(PlayerStateEvent.State.BufferingStarted);
                        break;
                    case 16: // BUFFERING_STOP
                        fireDebug("Buffering stopped");
                        firePlayerStateEvent(PlayerStateEvent.State.BufferingFinished);
                        fireLoadingProgress(1.0);
                        break;
                    case 17: // DOWNLOAD_START
                        fireDebug("Download started");
                        fireLoadingProgress(0);
                        break;
                    case 18: // DOWNLOAD_FAILED
                        fireError("ERROR: Download failed - '" + playlistManager.getCurrentItem() + "'");
                        loopManager.notifyPlayFinished();
                        break;
                    case 19: // DOWNLOAD_DONE
                        fireDebug("Download finished");
                        fireLoadingProgress(1.0);
                        break;
                    /*
                    case 4: // EMBEDDED_START
                    case 5: // EMBEDDED_END
                    case 12: // STATUS_FF
                    case 13: // STATUS_RW
                    //                        break;
                    case 0: // INIT_DONE
                    case 3: // SHUT_DONE
                    default:
                    //                        fireDebug("DEV: Status Changed : " + statusId);
                     */
                    }
                }

                @Override
                public void onLoadingChanged(double current, double total) {
                    fireLoadingProgress(current / total);
                }

                @Override
                public void onPositionChanged(double time) {
                    currentPosition = time * 1000;
                }
            });
    playlistManager = new PlaylistManager(this);
    displayMode = DisplayMode.MINI;

    // add play state monitoring to enhance setPlayPosition method..
    addPlayStateHandler(new PlayStateHandler() {

        @Override
        public void onPlayStateChanged(PlayStateEvent event) {
            playing = event.getPlayState().equals(PlayStateEvent.State.Started);
        }
    });
}

From source file:com.bramosystems.oss.player.core.client.ui.NativePlayer.java

License:Apache License

private NativePlayer() throws PluginNotFoundException {
    if (!PlayerUtil.isHTML5CompliantClient()) {
        throw new PluginNotFoundException(Plugin.Native);
    }/*from w ww  .j av  a 2 s. co  m*/

    playerId = DOM.createUniqueId().replace("-", "");
    adjustToVideoSize = false;
    playlistManager = new PlaylistManager(this);
    loopManager = new LoopManager(new LoopManager.LoopCallback() {

        @Override
        public void playNextItem() throws PlayException {
            playlistManager.playNext();
        }

        @Override
        public void onLoopFinished() {
            isWasPlaying = false;
            fireDebug("Play finished - " + playlistManager.getPlaylistIndex());
            firePlayStateEvent(PlayStateEvent.State.Finished, playlistManager.getPlaylistIndex());
        }

        @Override
        public void repeatPlay() {
            playlistManager.play(playlistManager.getPlaylistIndex());
        }

        @Override
        public void playNextLoop() {
            impl.play();
        }
    });
    _callback = new NativePlayerUtil.NativeEventCallback() {

        @Override
        public void onProgressChanged() {
            NativePlayerImpl.TimeRange time = impl.getBuffered();
            if (time != null) {
                double i = time.getLength();
                fireLoadingProgress((time.getEnd(i - 1) - time.getStart(0)) * 1000 / impl.getDuration());
            }
        }

        @Override
        public void onStateChanged(int code) {
            switch (code) {
            case 1: // play started
                isWasPlaying = true;
                fireDebug("Play started");
                firePlayStateEvent(PlayStateEvent.State.Started, playlistManager.getPlaylistIndex());
                fireDebug("Playing media at '" + impl.getMediaURL() + "'");
                break;
            case 2: // pause
                fireDebug("Play paused");
                firePlayStateEvent(PlayStateEvent.State.Paused, playlistManager.getPlaylistIndex());
                break;
            case 3: // finished
                // notify loop manager, it handles play finished event ...
                loopManager.notifyPlayFinished();
                break;
            case 4: // buffering
                fireDebug("Buffering started");
                firePlayerStateEvent(PlayerStateEvent.State.BufferingStarted);
                break;
            case 5: // playing again, buffering stopped
                fireDebug("Buffering stopped");
                firePlayerStateEvent(PlayerStateEvent.State.BufferingFinished);
                break;
            case 6: // process metadata
                fireDebug("Media Metadata available");
                MediaInfo info = new MediaInfo();
                impl.fillMediaInfo(info);
                fireMediaInfoAvailable(info);
                break;
            case 7: // volume changed
                if (impl.isMute()) {
                    fireDebug("Volume muted");
                } else {
                    fireDebug("Volume changed : " + volFmt.format(impl.getVolume()));
                }
                break;
            case 10: // loading started
                fireDebug("Loading '" + impl.getMediaURL() + "'");
                fireLoadingProgress(0);
                break;
            case 11: // loading finished
                fireDebug("Loading completed");
                fireLoadingProgress(1.0);
                break;
            case 12: // error
                switch (MediaError.values()[impl.getErrorState()]) {
                case Aborted:
                    fireError("ERROR: Loading aborted!");
                    break;
                case DecodeError:
                    fireError("ERROR: Decoding error");
                    break;
                case NetworkError:
                    fireError("ERROR: Network error");
                    break;
                case UnsupportedMedia:
                    fireError("ERROR: Media could not be loaded or format not supported! '"
                            + playlistManager.getCurrentItem() + "'");
                    fireDebug("Trying alternative playlist item ...");
                    try {
                        playlistManager.loadAlternative();
                    } catch (LoadException ex) {
                        fireError("ERROR: No alternative media available!");
                        if (isWasPlaying) {
                            loopManager.notifyPlayFinished();
                        } else {
                            playlistManager.loadNext();
                        }
                    }
                    break;
                }
                break;
            case 13: // loading aborted
                fireDebug("Media loading aborted!");
                break;
            }
        }
    };
}

From source file:com.bramosystems.oss.player.core.client.ui.QuickTimePlayer.java

License:Apache License

private QuickTimePlayer() throws PluginNotFoundException, PluginVersionException {
    PluginVersion req;/*  w  ww .j  a va  2  s  .com*/
    try {
        req = PluginVersion.get(reqVer);
        PluginVersion v = PlayerUtil.getQuickTimePluginVersion();
        if (v.compareTo(req) < 0) {
            throw new PluginVersionException(Plugin.QuickTimePlayer, req.toString(), v.toString());
        }
    } catch (RegexException ex) {
        throw new PluginNotFoundException(Plugin.QuickTimePlayer);
    }

    playerId = DOM.createUniqueId().replace("-", "");
    resizeToVideoSize = false;

    playlistManager = new PlaylistManager(this);
    loopManager = new LoopManager(new LoopManager.LoopCallback() {

        @Override
        public void onLoopFinished() {
            playlistManager.loadNext();
            firePlayStateEvent(PlayStateEvent.State.Finished, playlistManager.getPlaylistIndex());
        }

        @Override
        public void repeatPlay() {
            playlistManager.play(playlistManager.getPlaylistIndex());
        }

        @Override
        public void playNextLoop() {
            try {
                playlistManager.playNext(true);
            } catch (PlayException ex) {
            }
        }

        @Override
        public void playNextItem() throws PlayException {
            playlistManager.playNext();
        }
    });
    handler = new QTStateManager.QTEventHandler() {

        @Override
        public void onStateChange(int newState) {
            switch (newState) {
            //                    case 1: // plugin init complete ...
            case 2: // loading complete ...
                fireDebug("Media loading complete");
                fireLoadingProgress(1.0);
                break;
            case 3: // play started ...
                if (_isBuffering) {
                    _isBuffering = false;
                    firePlayerStateEvent(PlayerStateEvent.State.BufferingFinished);
                    fireDebug("Buffering ended ...");
                }
                fireDebug("Playing media at " + impl.getMovieURL());
                firePlayStateEvent(PlayStateEvent.State.Started, playlistManager.getPlaylistIndex());
                break;
            case 4: // play finished, notify loop manager ...
                loopManager.notifyPlayFinished();
                break;
            case 5: // player ready ...
                fireDebug("Loaded media at " + impl.getMovieURL());
                break;
            case 6: // volume changed ...
                fireDebug("Volume changed to " + volFmt.format(impl.getVolume()));
                break;
            case 7: // progress changed ...
                fireLoadingProgress(impl.getMaxBytesLoaded() / (double) impl.getMovieSize());
                break;
            case 8: // error event ...
                fireError(impl.getStatus() + " occured while loading media!");
                break;
            case 9: // metadata stuffs ...
                fireDebug("Metadata available");
                MediaInfo info = new MediaInfo();
                impl.fillMediaInfo(info);
                fireMediaInfoAvailable(info);
                break;
            case 10: // playback paused ...
                fireDebug("Playback paused");
                firePlayStateEvent(PlayStateEvent.State.Paused, playlistManager.getPlaylistIndex());
                break;
            case 11: // buffering ...
                _isBuffering = true;
                fireDebug("Buffering started ...");
                firePlayerStateEvent(PlayerStateEvent.State.BufferingStarted);
                break;
            case 12: // stalled ...
                fireDebug("Player stalled !");
                break;
            }
        }
    };
}

From source file:com.bramosystems.oss.player.core.client.ui.SWFWidget.java

License:Apache License

/**
 * Constructs <code>SWFWidget</code> with the specified {@code height} and
 * {@code width} to embed Flash application located at {@code sourceURL} if the client
 * has a Flash plugin of version {@code minFlashVersion} or later installed.
 *
 * <p> {@code height} and {@code width} are specified as CSS units.
 *
 * @param sourceURL the URL of the media to playback
 * @param height the height of the player
 * @param width the width of the player.
 * @param minFlashVersion minimum version of the required Flash plugin
 *
 * @throws PluginVersionException if the required Flash plugin version is not installed on the client.
 * @throws PluginNotFoundException if the Flash plugin is not installed on the client.
 * @throws NullPointerException if {@code sourceURL}, {@code height} or {@code width} is null.
 *
 * @see PluginVersion// www.  ja  v a2 s .co m
 */
public SWFWidget(String sourceURL, String width, String height, PluginVersion minFlashVersion)
        throws PluginNotFoundException, PluginVersionException {

    if (height == null) {
        throw new NullPointerException("height cannot be null");
    }
    if (width == null) {
        throw new NullPointerException("width cannot be null");
    }
    if (sourceURL == null) {
        throw new NullPointerException("sourceURL cannot be null");
    }

    PluginVersion v = PlayerUtil.getFlashPlayerVersion();
    if (v.compareTo(minFlashVersion) < 0) {
        throw new PluginVersionException(Plugin.FlashPlayer, minFlashVersion.toString(), v.toString());
    }

    this.swfURL = sourceURL;
    this.width = width;
    this.height = height;
    playerId = DOM.createUniqueId().replace("-", "");

    widget = new PlayerWidget("api", "swf", playerId, swfURL, false);
    initWidget(widget);
    setSize(width, height);
}

From source file:com.bramosystems.oss.player.core.client.ui.VLCPlayer.java

License:Apache License

private VLCPlayer() throws PluginNotFoundException, PluginVersionException {
    PluginVersion req;/*from w  w  w. java 2s. c  o m*/
    try {
        req = PluginVersion.get(reqVer);
        PluginVersion v = PlayerUtil.getVLCPlayerPluginVersion();
        if (v.compareTo(req) < 0) {
            throw new PluginVersionException(Plugin.VLCPlayer, req.toString(), v.toString());
        }
    } catch (RegExp.RegexException ex) {
        throw new PluginNotFoundException(Plugin.VLCPlayer);
    }

    playerId = DOM.createUniqueId().replace("-", "");

    loopManager = new LoopManager(new LoopManager.LoopCallback() {
        @Override
        public void playNextItem() throws PlayException {
            stateHandler.getPlaylistManager().playNext();
        }

        @Override
        public void onLoopFinished() {
            firePlayStateEvent(PlayStateEvent.State.Finished, 0);
        }

        @Override
        public void repeatPlay() {
            stateHandler.getPlaylistManager().play(stateHandler.getPlaylistManager().getPlaylistIndex());
        }

        @Override
        public void playNextLoop() {
            try {
                stateHandler.getPlaylistManager().playNext(true);
            } catch (PlayException ex) {
                fireDebug(ex.getMessage());
            }
        }
    });
    stateHandler = GWT.create(VLCStateManager.class);
    stateHandler.init(new VLCStateManager.VLCStateCallback() {
        ///           @Override
        public void onLoadingComplete() {
            fireLoadingProgress(1.0);
        }

        @Override
        public void onIdle() {
            fireDebug("Player Idle");
        }

        @Override
        public void onOpening() {
            fireDebug("Opening playlist item #" + stateHandler.getPlaylistManager().getPlaylistIndex());
        }

        @Override
        public void onBuffering(boolean started) {
            firePlayerStateEvent(started ? PlayerStateEvent.State.BufferingStarted
                    : PlayerStateEvent.State.BufferingFinished);
        }

        @Override
        public void onPlaying() {
            fireDebug("Playback started - '" + stateHandler.getPlaylistManager().getCurrentItem() + "'");
            firePlayStateEvent(PlayStateEvent.State.Started,
                    stateHandler.getPlaylistManager().getPlaylistIndex());
        }

        @Override
        public void onPaused() {
            fireDebug("Playback paused");
            firePlayStateEvent(PlayStateEvent.State.Paused,
                    stateHandler.getPlaylistManager().getPlaylistIndex());
        }

        @Override
        public void onError(String message) {
            fireError(message);
        }

        @Override
        public void onInfo(String message) {
            fireDebug(message);
        }

        @Override
        public void onEndReached() {
            loopManager.notifyPlayFinished();
        }

        @Override
        public void onStopped() {
            firePlayStateEvent(PlayStateEvent.State.Stopped,
                    stateHandler.getPlaylistManager().getPlaylistIndex());
            fireDebug("Playback stopped");
        }

        @Override
        public void onMediaInfo(MediaInfo info) {
            fireDebug("MediaInfo available");
            fireMediaInfoAvailable(info);
        }
    }, new VLCStateManager.VLCPlayerImplCallback() {
        @Override
        public VLCPlayerImpl getImpl() {
            return impl;
        }
    });
}

From source file:com.bramosystems.oss.player.core.client.ui.WinMediaPlayer.java

License:Apache License

private WinMediaPlayer(EmbedMode embedMode, boolean autoplay)
        throws PluginNotFoundException, PluginVersionException {
    CorePlayerProvider cwf = (CorePlayerProvider) getWidgetFactory("core");
    if (embedMode.equals(EmbedMode.PROGRAMMABLE) && !cwf.isWMPProgrammableEmbedModeSupported()) {
        throw new PluginNotFoundException(Plugin.WinMediaPlayer,
                "'Media Player plugin for Firefox' is required");
    }/* w ww  .  j a  v a2s . c o  m*/

    PluginVersion req;
    try {
        req = PluginVersion.get(reqVer);
        PluginVersion v = PlayerUtil.getWindowsMediaPlayerPluginVersion();
        if (v.compareTo(req) < 0) {
            throw new PluginVersionException(Plugin.WinMediaPlayer, req.toString(), v.toString());
        }
    } catch (RegExp.RegexException ex) {
        throw new PluginNotFoundException(Plugin.WinMediaPlayer);
    }

    playerId = DOM.createUniqueId().replace("-", "");
    if (stateManager == null) {
        stateManager = GWT.create(WMPStateManager.class);
    }

    playlistManager = new WMPPlaylistManager(autoplay);
    loopManager = new LoopManager(new LoopManager.LoopCallback() {

        @Override
        public void onLoopFinished() {
            fireDebug("Media playback finished");
            playlistManager.loadNext();
            firePlayStateEvent(PlayStateEvent.State.Finished, playlistManager.getPlaylistIndex());
        }

        @Override
        public void repeatPlay() {
            playlistManager.play(playlistManager.getPlaylistIndex());
        }

        @Override
        public void playNextLoop() {
            try {
                playlistManager.playNext(true);
            } catch (PlayException ex) {
            }
        }

        @Override
        public void playNextItem() throws PlayException {
            playlistManager.playNext();
        }
    });
    eventProcessor = stateManager.init(playerId, playlistManager, new WMPStateManager.WMPImplCallback() {

        @Override
        public WinMediaPlayerImpl getImpl() {
            return impl;
        }
    });
    resizeToVideoSize = false;
}

From source file:com.bramosystems.oss.player.provider.vimeo.client.VimeoUniversalPlayer.java

License:Apache License

private VimeoUniversalPlayer() throws PluginNotFoundException {
    if (!PlayerUtil.isHTML5CompliantClient()) {
        throw new PluginNotFoundException(Plugin.Native, "HTML5 Compliant browser not found !");
    }/*  ww w  . jav a  2  s  . c  om*/

    playerId = DOM.createUniqueId().replace("-", "");
    repeatMode = RepeatMode.REPEAT_OFF;

    provider = ((VimeoPlayerProvider) getWidgetFactory(VimeoPlayerProvider.PROVIDER_NAME));
    provider.initHandlers(playerId, new VimeoPlayerProvider.EventHandler() {
        @Override
        public void onInit() {
            fireDebug("Vimeo Universal Player");
            impl = VimeoPlayerIFImpl.getPlayerImpl(playerId);
            impl.registerHandlers(provider.getEvtFunctionBaseName(playerId));
            firePlayerStateEvent(PlayerStateEvent.State.Ready);
            impl.getVideoHeight();
            impl.getVideoWidth();
            impl.getVolume();
        }

        @Override
        public void onLoadingProgress(double progress, double duration) {
            _duration = duration * 1000;
            fireLoadingProgress(progress);
        }

        @Override
        public void onPlayingProgress(double seconds) {
            _playTime = seconds * 1000;
        }

        @Override
        public void onPlay() {
            firePlayStateEvent(State.Started, 1);
            fireDebug("Playback Started");
        }

        @Override
        public void onFinish() {
            firePlayStateEvent(State.Finished, 1);
            fireDebug("Playback Finished");
        }

        @Override
        public void onPause() {
            firePlayStateEvent(State.Paused, 1);
            fireDebug("Playback Paused");
        }

        @Override
        public void onSeek(double seconds) {
            _playTime = seconds;
        }

        @Override
        public void onMsg(String msg) {
            fireDebug("- " + msg);
        }

        @Override
        public void onMethod(String method, String retVal) {
            fireDebug("Method: " + method + ", Val: " + retVal);
            if (method.equalsIgnoreCase("getvideowidth")) {
                _vidWidth = Integer.parseInt(retVal);
            } else if (method.equalsIgnoreCase("getvideoheight")) {
                _vidHeight = Integer.parseInt(retVal);
            } else if (method.equalsIgnoreCase("getvolume")) {
                _vol = Double.parseDouble(retVal);
            }
        }
    });
}