Examples of Upload


Examples of com.vaadin.ui.Upload

public class DisabledUploadButton extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        final Upload upload = new Upload();

        addComponent(upload);

        addButton("Set readonly", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                upload.setReadOnly(true);
            }
        });

        addButton("Set disabled", new Button.ClickListener() {
            @Override
            public void buttonClick(Button.ClickEvent event) {
                upload.setEnabled(false);
            }
        });
    }
View Full Code Here

Examples of com.vaadin.ui.Upload

    @Override
    protected void setup() {
        getLayout().setMargin(new MarginInfo(true, false, false, false));
        getLayout().setSpacing(true);

        Upload u = new Upload("Upload", new Upload.Receiver() {

            @Override
            public OutputStream receiveUpload(String filename, String mimeType) {
                return baos;
            }
        });
        u.setId("UPL");
        u.addStartedListener(new Upload.StartedListener() {

            @Override
            public void uploadStarted(StartedEvent event) {
                expectedSize.setValue(String.valueOf(event.getContentLength()));
            }
        });
        u.addFinishedListener(new Upload.FinishedListener() {

            @Override
            public void uploadFinished(FinishedEvent event) {
                label.setValue("Upload finished. Name: " + event.getFilename());
                receivedSize.setValue(String.valueOf(baos.size()));
View Full Code Here

Examples of com.vaadin.ui.Upload

*/
public class UploadTitleWithTooltip extends AbstractTestUI {

    @Override
    protected void setup(VaadinRequest request) {
        Upload upload = new Upload();
        upload.setDescription("tootlip");

        addComponent(upload);
    }
View Full Code Here

Examples of com.vaadin.ui.Upload

        final Label labe = new Label();

        addComponent(labe);

        final Upload u;
        u = new Upload(null, this);
        u.setImmediate(true);
        addTestComponent(u);

        l = new Label(getUploadcount());
        addComponent(l);

        u.addListener(new Upload.StartedListener() {

            @Override
            public void uploadStarted(StartedEvent event) {
                /*
                 * Remove component before upload from the same vertical layout.
                 * Causes upload to be detached/attached -> upload loses it
                 * target iframes onload listener -> puts VUpload inappropriate
                 * state.
                 */
                getLayout().removeComponent(labe);
            }
        });

        u.addListener(new Upload.FinishedListener() {
            @Override
            public void uploadFinished(FinishedEvent event) {
                getMainWindow().showNotification("Done");
                l.setValue(getUploadcount());
            }
View Full Code Here

Examples of com.vaadin.ui.Upload

        addComponent(layout);
    }

    private Upload getImmediateUpload(String id, String width) {
        Upload upload = new Upload();

        upload.setId(id);
        upload.setWidth(width);
        upload.setImmediate(true);

        return upload;
    }
View Full Code Here

Examples of com.vaadin.ui.Upload

        uploadsLayout.removeComponent(source);

    }

    protected void addUpload() {
        Upload upload = createUpload();
        upload.addSucceededListener(new SucceededListener() {

            @Override
            public void uploadSucceeded(SucceededEvent event) {
                log("Upload of " + event.getFilename() + " complete");
                uploadsLayout.removeComponent(event.getUpload());
            }
        });

        upload.addFailedListener(new FailedListener() {
            @Override
            public void uploadFailed(FailedEvent event) {
                log("Upload of " + event.getFilename() + " FAILED");
            }
        });

        upload.setReceiver(new Receiver() {
            @Override
            public OutputStream receiveUpload(String filename, String mimeType) {
                return new OutputStream() {
                    @Override
                    public void write(int arg0) throws IOException {

                    }
                };
            }
        });
        upload.setStyleName("hidden-button");
        uploadsLayout.addComponent(upload);

    }
View Full Code Here

Examples of com.vaadin.ui.Upload

        uploadsLayout.addComponent(upload);

    }

    private Upload createUpload() {
        Upload upload = new Upload();
        upload.addChangeListener(changeListener);
        return upload;
    }
View Full Code Here

Examples of com.vaadin.ui.Upload

        portletEdit.setEnabled(false);
        main.addComponent(portletEdit);
        portletMax.setEnabled(false);
        main.addComponent(portletMax);

        Upload upload = new Upload("Upload a file", new Receiver() {

            @Override
            public OutputStream receiveUpload(String filename, String mimeType) {
                return new ByteArrayOutputStream();
            }
View Full Code Here

Examples of com.vaadin.ui.Upload

        final VerticalLayout layout = new VerticalLayout();
        layout.setMargin(true);
        layout.setSpacing(true);
        setContent(layout);

        upload = new Upload(null, buffer);
        upload.setId("upload");
        layout.addComponent(upload);

        Button button = new Button("show notification");
        button.setId("notify");
View Full Code Here

Examples of com.vaadin.ui.Upload

public class UploadCssTest {

    private int debugIdCounter = 0;

    public UploadCssTest(TestSampler parent) {
        Upload up = new Upload();
        up.setId("upload" + debugIdCounter++);
        parent.addComponent(up);

        up = new Upload();
        up.setId("upload" + debugIdCounter++);
        up.setImmediate(true);
        parent.addComponent(up);
    }
View Full Code Here
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.