Package com.vaadin.tests.push

Source Code of com.vaadin.tests.push.PushWithPreserveOnRefresh

package com.vaadin.tests.push;

import com.vaadin.annotations.PreserveOnRefresh;
import com.vaadin.annotations.Push;
import com.vaadin.server.VaadinRequest;
import com.vaadin.tests.components.AbstractTestUI;
import com.vaadin.tests.util.Log;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Button.ClickListener;
import com.vaadin.ui.Label;

@PreserveOnRefresh
@Push
public class PushWithPreserveOnRefresh extends AbstractTestUI {

    private Log log = new Log(5);
    private int times = 0;

    @Override
    protected void setup(VaadinRequest request) {
        // Internal parameter sent by vaadinBootstrap.js,
        addComponent(new Label("window.name: " + request.getParameter("v-wn")));
        addComponent(new Label("UI id: " + getUIId()));
        addComponent(log);

        addButton("click me", new ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                log.log("Button has been clicked " + (++times) + " times");
            }
        });
    }

    @Override
    protected String getTestDescription() {
        return "Refreshing the browser window should preserve the state and push should continue to work";
    }

    @Override
    protected Integer getTicketNumber() {
        return Integer.valueOf(13620);
    }
}
TOP

Related Classes of com.vaadin.tests.push.PushWithPreserveOnRefresh

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.