Package com.vaadin.tests.components.window

Source Code of com.vaadin.tests.components.window.DownloadAndUpdate

package com.vaadin.tests.components.window;

import com.vaadin.server.ExternalResource;
import com.vaadin.tests.components.TestBase;
import com.vaadin.ui.Button;
import com.vaadin.ui.Button.ClickEvent;
import com.vaadin.ui.Table;

public class DownloadAndUpdate extends TestBase {

    @Override
    protected void setup() {
        addComponent(new Button("Download and update",
                new Button.ClickListener() {
                    @Override
                    public void buttonClick(ClickEvent event) {
                        downloadAndUpdate();
                    }
                }));
    }

    protected void downloadAndUpdate() {
        getMainWindow().open(
                new ExternalResource("/statictestfiles/dummy.zip", "_new"));

        // Any component sending an UIDL request when rendered will likely do
        Table table = new Table();
        table.addContainerProperty("A", String.class, "");
        for (int i = 0; i < 100; i++) {
            table.addItem(new Object[] { Integer.toString(i) },
                    Integer.valueOf(i));
        }
        addComponent(table);
    }

    @Override
    protected String getDescription() {
        return "There should be no problems downloading a file from the same request that triggers another request, even in webkit browsers.";
    }

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

}
TOP

Related Classes of com.vaadin.tests.components.window.DownloadAndUpdate

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.