Example usage for com.vaadin.server PaintTarget isFullRepaint

List of usage examples for com.vaadin.server PaintTarget isFullRepaint

Introduction

In this page you can find the example usage for com.vaadin.server PaintTarget isFullRepaint.

Prototype

public boolean isFullRepaint();

Source Link

Usage

From source file:annis.gui.widgets.MediaPlayerBase.java

License:Apache License

@Override
public void paintContent(PaintTarget target) throws PaintException {
    if (target.isFullRepaint()) {
        sourcesAdded = false;//from  w  ww  .  ja v a 2s  . c om
        wasLoaded = false;
    }

    boolean sourcesNeeded = true;

    if (action == PlayerAction.play) {
        String[] args;
        if (endTime == null) {
            args = new String[] { "" + startTime };
        } else {
            args = new String[] { "" + startTime, "" + endTime };
        }
        target.addAttribute(VMediaPlayerBase.PLAY, args);
        action = PlayerAction.idle;
    } else if (action == PlayerAction.pause) {
        target.addAttribute(VMediaPlayerBase.PAUSE, true);
        action = PlayerAction.idle;
    } else if (action == PlayerAction.stop) {
        target.addAttribute(VMediaPlayerBase.STOP, true);
        action = PlayerAction.idle;
        // re-add source the next time someone wants to play something
        sourcesAdded = false;
        sourcesNeeded = false;
    }

    if (sourcesNeeded && !sourcesAdded) {
        target.addAttribute(VMediaPlayerBase.SOURCE_URL, resourceURL);
        target.addAttribute(VMediaPlayerBase.MIME_TYPE, mimeType);
        sourcesAdded = true;
    }

}