Example usage for com.vaadin.ui Upload Upload

List of usage examples for com.vaadin.ui Upload Upload

Introduction

In this page you can find the example usage for com.vaadin.ui Upload Upload.

Prototype

public Upload() 

Source Link

Document

Creates a new instance of Upload.

Usage

From source file:org.eclipse.hawkbit.ui.artifacts.upload.UploadLayout.java

License:Open Source License

private void buildLayout() {

    final Upload upload = new Upload();
    final UploadHandler uploadHandler = new UploadHandler(null, 0, this,
            multipartConfigElement.getMaxFileSize(), upload, null, null, softwareModuleManagement);
    upload.setButtonCaption(i18n.getMessage("upload.file"));
    upload.setImmediate(true);//from  ww  w .j av a  2s.  c  o m
    upload.setReceiver(uploadHandler);
    upload.addSucceededListener(uploadHandler);
    upload.addFailedListener(uploadHandler);
    upload.addFinishedListener(uploadHandler);
    upload.addProgressListener(uploadHandler);
    upload.addStartedListener(uploadHandler);
    upload.addStyleName(SPUIStyleDefinitions.ACTION_BUTTON);
    upload.addStyleName("no-border");

    fileUploadLayout = new HorizontalLayout();
    fileUploadLayout.setSpacing(true);
    fileUploadLayout.addStyleName(SPUIStyleDefinitions.FOOTER_LAYOUT);
    fileUploadLayout.addComponent(upload);
    fileUploadLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
    fileUploadLayout.addComponent(processBtn);
    fileUploadLayout.setComponentAlignment(processBtn, Alignment.MIDDLE_RIGHT);
    fileUploadLayout.addComponent(discardBtn);
    fileUploadLayout.setComponentAlignment(discardBtn, Alignment.MIDDLE_RIGHT);
    fileUploadLayout.addComponent(uploadStatusButton);
    fileUploadLayout.setComponentAlignment(uploadStatusButton, Alignment.MIDDLE_RIGHT);
    setMargin(false);

    /* create drag-drop wrapper for drop area */
    dropAreaWrapper = new DragAndDropWrapper(createDropAreaLayout());
    dropAreaWrapper.setDropHandler(new DropAreahandler());
    setSizeFull();
    setSpacing(true);
}

From source file:org.eclipse.hawkbit.ui.management.targettable.BulkUploadHandler.java

License:Open Source License

void buildLayout() {
    final HorizontalLayout horizontalLayout = new HorizontalLayout();
    upload = new Upload();
    upload.setEnabled(false);//from  w  w w. j ava  2  s . com
    upload.setButtonCaption(i18n.getMessage("caption.bulk.upload"));
    upload.setReceiver(this);
    upload.setImmediate(true);
    upload.setWidthUndefined();
    upload.addSucceededListener(this);
    upload.addFailedListener(this);
    upload.addStartedListener(this);
    horizontalLayout.addComponent(upload);
    horizontalLayout.setComponentAlignment(upload, Alignment.BOTTOM_RIGHT);
    setCompositionRoot(horizontalLayout);
}

From source file:org.generationcp.breeding.manager.crosses.NurseryTemplateImportFileComponent.java

License:Open Source License

protected void initializeComponents() {
    selectFileLabel = new Label();
    addComponent(selectFileLabel);/*from   w w w.  java 2 s.com*/

    uploadComponents = new Upload();
    uploadComponents.setButtonCaption(messageSource.getMessage(Message.UPLOAD));
    addComponent(uploadComponents);

    filenameLabel = new Label();
    addComponent(filenameLabel);

    buttonArea = layoutButtonArea();
    addComponent(buttonArea);
}

From source file:org.hip.vif.web.util.UploadComponent.java

License:Open Source License

private Upload createUpload(final IBibliographyTask inTask) {
    final Upload outUpload = new Upload();
    outUpload.setWidthUndefined();// w  ww.  j  a  v a2s. co m
    outUpload.setReceiver(new Upload.Receiver() {
        @Override
        public OutputStream receiveUpload(final String inFilename, // NOPMD
                final String inMimeType) {
            return createStream(inFilename);
        }
    });

    final String lCaption = Activator.getMessages().getMessage("ui.upload.button.lbl"); //$NON-NLS-1$
    outUpload.setButtonCaption(lCaption);
    outUpload.setImmediate(true);
    outUpload.setStyleName("vif-upload"); //$NON-NLS-1$

    outUpload.addStartedListener(new Upload.StartedListener() {
        @Override
        public void uploadStarted(final StartedEvent inEvent) { // NOPMD
            fileInfo = new FileInfo(inEvent.getFilename(), inEvent.getMIMEType());
            tempUpload = null; // NOPMD
            uploadFinished = false;
            outUpload.setVisible(false);
            if (hasDownloads) {
                dialog.setVisible(true); // FF
            }
        }
    });
    outUpload.addFinishedListener(new Upload.FinishedListener() {
        @Override
        public void uploadFinished(final FinishedEvent inEvent) { // NOPMD
            uploadFinished = true;
            outUpload.setVisible(true);
        }
    });
    outUpload.addSucceededListener(new Upload.SucceededListener() {
        @Override
        public void uploadSucceeded(final SucceededEvent inEvent) { // NOPMD
            if (!hasDownloads) {
                handleUpload(inTask, false);
            }
        }
    });
    outUpload.addFailedListener(new Upload.FailedListener() {
        @Override
        public void uploadFailed(final FailedEvent inEvent) { // NOPMD
            handleDeleteTemp();
        }
    });

    return outUpload;
}

From source file:org.investovator.ui.main.components.DataUploadWindow.java

License:Open Source License

private void setLayout() {

    //Window Properties
    setCaption("Upload Data");
    setResizable(false);//from w w  w . jav  a 2s.com
    setClosable(true);
    setModal(true);
    center();

    content = new VerticalLayout();
    content.setSpacing(true);
    content.setMargin(true);

    companySelectLayout = new HorizontalLayout();
    companyDetailUploadLayout = new HorizontalLayout();
    newCompanyForm = new FormLayout();

    newCompanyCheckBox = new CheckBox("New Company");

    companySelect = new ComboBox();

    companySelect = new ComboBox();
    companySelect.setNullSelectionAllowed(false);
    companySelect.setImmediate(true);

    dataTypeSelect = new ComboBox();
    dataTypeSelect.setNullSelectionAllowed(false);

    dataUpload = new Upload();
    dataUpload.setCaption("Select Data File");
    dataUpload.setButtonCaption(null);

    detailUpload = new Upload();
    detailUpload.setCaption("select Company Info XML");
    detailUpload.setButtonCaption(null);

    symbol = new TextField("Company Symbol");
    symbol.setRequired(true);
    companyName = new TextField("Company Name");
    companyName.setRequired(true);

    submitButton = new Button("Upload Data");

    newCompanyForm.addComponent(symbol);
    newCompanyForm.addComponent(companyName);

    companyDetailUploadLayout.addComponent(detailUpload);

    companySelectLayout.addComponent(companySelect);
    companySelectLayout.addComponent(newCompanyCheckBox);

    content.addComponent(companySelectLayout);
    content.addComponent(dataTypeSelect);
    content.addComponent(dataUpload);
    content.addComponent(submitButton);

    content.setComponentAlignment(submitButton, Alignment.MIDDLE_CENTER);

    setContent(content);
    setDefaults();
    bindListeners();

}

From source file:org.investovator.ui.nngaming.config.ParameterAddView.java

License:Open Source License

public ParameterAddView() {

    newParameters = new HashMap();

    upload = new Upload();
    upload.setCaption("Select Data File");
    upload.setButtonCaption(null);//ww  w . j ava2s.  c  om

    newParamField = new TextField();
    newParamField.setCaption("Specify New Parameter");
    newParamField.setRequired(true);
    newParamField.setImmediate(true);

    submit = new Button("Upload Data");

    layout = new HorizontalLayout();
    layout.addComponent(newParamField);
    layout.setSpacing(true);
    layout.setMargin(true);

    HorizontalLayout bottomLayout = new HorizontalLayout();
    bottomLayout.addComponent(upload);
    bottomLayout.addComponent(submit);
    bottomLayout.setSpacing(true);
    bottomLayout.setMargin(true);
    bottomLayout.setComponentAlignment(upload, Alignment.MIDDLE_LEFT);
    bottomLayout.setComponentAlignment(submit, Alignment.MIDDLE_RIGHT);

    content = new VerticalLayout();
    content.addComponent(layout);
    content.addComponent(bottomLayout);

    bindListeners();
}

From source file:org.s23m.cell.editor.semanticdomain.ui.components.upload.IconUploadComponent.java

License:Mozilla Public License

/**
 * Constructor//from   w  ww  .  j a v a 2  s  .co m
 *
 * @param set the {@link Set} in focus
 */
public IconUploadComponent(final Set set) {
    this.set = set;

    root = new Panel("My Upload Component");
    setCompositionRoot(root);

    // Create the Upload component.
    final Upload upload = new Upload();
    upload.setReceiver(this);

    // Use a custom button caption instead of plain "Upload".
    //upload.setButtonCaption("Upload Now");

    // Listen for events regarding the success of upload.
    upload.addListener((Upload.SucceededListener) this);
    upload.addListener((Upload.FailedListener) this);

    root.addComponent(upload);
    root.addComponent(new Label("Click 'Browse' to " + "select a file and then click 'Upload'."));

    // Create a panel for displaying the uploaded image.
    imagePanel = new Panel("Uploaded image");
    imagePanel.addComponent(new Label("No image uploaded yet"));
    root.addComponent(imagePanel);
}

From source file:ru.codeinside.adm.ui.BusinessCalendar.java

License:Mozilla Public License

public BusinessCalendar() {
    Upload upload = new Upload();
    upload.setImmediate(false);/*ww  w .java 2s.co m*/
    upload.setButtonCaption("  ");
    upload.setReceiver(this);
    upload.addListener(this);

    datesTable = new BusinessDatesTable();
    removeButton = createButton("");

    VerticalLayout vr = new VerticalLayout();
    vr.setSizeFull();
    vr.setSpacing(true);
    vr.setMargin(true);

    HorizontalLayout horLayout = new HorizontalLayout();
    horLayout.setSizeFull();
    horLayout.setSpacing(true);
    horLayout.setMargin(true);
    horLayout.addComponent(upload);
    horLayout.addComponent(removeButton);
    vr.addComponent(horLayout);
    vr.addComponent(datesTable);

    addComponent(vr);
    vr.setExpandRatio(horLayout, .1f);
    vr.setExpandRatio(datesTable, .9f);
    datesTable.addListener(new Property.ValueChangeListener() {
        @Override
        public void valueChange(Property.ValueChangeEvent event) {
            removeButton.setVisible(event.getProperty().getValue() != null);
        }
    });
    setSizeFull();
}

From source file:ru.codeinside.adm.ui.employee.EmployeeWidget.java

License:Mozilla Public License

public EmployeeWidget(boolean lockedFilterValue, TreeTable table) {
    this.table = table;
    Upload upload = new Upload();
    upload.setImmediate(false);//from   ww  w  . j  ava2 s  .  com
    upload.setButtonCaption("  ");
    upload.setReceiver(this);
    upload.addListener(this);
    /*    Panel panel1 = new Panel();
        Button button = new Button("??? ", new Button.ClickListener() {
          @Override
          public void buttonClick(Button.ClickEvent event) {
            try {
              URL url = new URL(getApplication().getURL(), "/registry/structures");
              loadEmployeeData(url.openStream());
            } catch (MalformedURLException e) {
              getWindow().showNotification(" " + e.getMessage());
            } catch (IOException e) {
              getWindow().showNotification(" " + e.getMessage());
            }
          }
        });
        panel1.addComponent(button);*/
    tableEmployee = new TableAllEmployee(lockedFilterValue);
    tableEmployee.setSizeFull();
    HorizontalLayout hr = new HorizontalLayout();
    hr.setSizeFull();
    hr.setHeight("70px");
    hr.setSpacing(true);
    hr.setMargin(true);
    hr.addComponent(upload);
    addComponent(hr);
    addComponent(tableEmployee);
    tableEmployee.addButtonToLayout(hr);
    setExpandRatio(hr, 0.01f);
    setExpandRatio(tableEmployee, 0.99f);
    setSizeFull();
}

From source file:ru.codeinside.gses.webui.components.DeploymentAddUi.java

License:Mozilla Public License

@AutoGenerated
private void buildMainLayout() {
    upload = new Upload();
    upload.setImmediate(false);//from  w w  w .  ja va 2s  .c o  m
    addComponent(upload);

    upload.setButtonCaption("?? ??");
    upload.addListener(uploadStartListener);

    upload.setReceiver(receiver);
    upload.addListener(succeededListener);
}