Example usage for com.vaadin.ui Upload addSucceededListener

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

Introduction

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

Prototype

public Registration addSucceededListener(SucceededListener listener) 

Source Link

Document

Adds the upload success event listener.

Usage

From source file:com.constellio.app.ui.pages.management.updates.UpdateManagerViewImpl.java

private Component buildLicenseUploadPanel() {
    Upload upload = new Upload($("UpdateManagerViewImpl.uploadLicenseCaption"), new Receiver() {
        @Override/* w ww .j  ava 2  s .  c o  m*/
        public OutputStream receiveUpload(String filename, String mimeType) {
            return presenter.getLicenseOutputStream();
        }
    });
    upload.addSucceededListener(new SucceededListener() {
        @Override
        public void uploadSucceeded(SucceededEvent event) {
            presenter.licenseUploadSucceeded();
        }
    });
    upload.setButtonCaption($("UpdateManagerViewImpl.uploadLicense"));

    Button cancel = new LinkButton($("cancel")) {
        @Override
        protected void buttonClick(ClickEvent event) {
            presenter.licenseUploadCancelled();
        }
    };

    VerticalLayout layout = new VerticalLayout(upload, cancel);
    layout.setWidth("100%");
    layout.setSpacing(true);

    return layout;
}

From source file:com.firstbanknigeria.ofsaaenhancers.UI.AdjustmentUI.java

public AdjustmentUI() {
    super("Load Adjustments");
    this.setWidth("1000px");
    this.setHeight("250px");

    objectContext = ObjectStore.getObjectContext(VaadinSession.getCurrent().getSession().getId());

    final VerticalLayout layout = new VerticalLayout();
    layout.setDefaultComponentAlignment(Alignment.MIDDLE_CENTER);
    layout.setSpacing(true);/* w  ww .java  2 s.c  om*/

    AdjustmentFileProcessor adjFileProcessor = new AdjustmentFileProcessor();
    adjFileProcessor.setAdjustmentUI(this);

    Upload uploadComponent = new Upload("", adjFileProcessor);
    uploadComponent.addSucceededListener(adjFileProcessor);
    uploadComponent.setButtonCaption("Upload Adjustments");
    uploadComponent.setImmediate(true);

    Button runAdjustmenstButton = new Button("Run Adjustments");
    runAdjustmenstButton.addClickListener(new Button.ClickListener() {

        public void buttonClick(Button.ClickEvent e) {
            ProcedureQuery query = new ProcedureQuery("RUN_ADJUSTMENTS");
            QueryResponse response = objectContext.performGenericQuery(query);
        }
    });

    layout.addComponents(uploadComponent, runAdjustmenstButton);
    layout.setMargin(true);
    layout.setSpacing(true);

    setContent(layout);
}

From source file:com.ocs.dynamo.ui.composite.form.UploadForm.java

License:Apache License

@Override
protected void doBuildLayout(Layout main) {
    FormLayout form = new FormLayout();
    form.setMargin(true);// w  ww  .  j a  v  a 2  s.co  m
    if (ScreenMode.VERTICAL.equals(screenMode)) {
        form.setStyleName(DynamoConstants.CSS_CLASS_HALFSCREEN);
    }

    main.addComponent(form);

    // add custom components
    doBuildForm(form);

    // add file upload field
    UploadReceiver receiver = new UploadReceiver();

    Upload upload = new Upload(message("ocs.uploadform.title"), receiver);

    upload.addSucceededListener(receiver);
    form.addComponent(upload);

    if (showCancelButton) {
        Button cancelButton = new Button(message("ocs.cancel"));
        cancelButton.addClickListener(new Button.ClickListener() {

            @Override
            public void buttonClick(ClickEvent event) {
                cancel();
            }
        });
        main.addComponent(cancelButton);
    }
}

From source file:com.peergreen.webconsole.scope.deployment.internal.DeploymentScope.java

License:Open Source License

@PostConstruct
public void init() {
    deploymentViewManager = createDeploymentViewManager();

    OptionGroup option = new OptionGroup();
    HorizontalLayout toolBar = new HorizontalLayout();
    toolBar.setWidth("100%");
    toolBar.setSpacing(true);/*  w  w w. ja  v a2s .  c  o  m*/
    toolBar.setMargin(true);

    VerticalLayout uploadLayout = new VerticalLayout();

    Upload uploader = new Upload("Upload a file here", null);
    uploader.setButtonCaption("Upload");
    final FileUploader fileUploader = new FileUploader(deploymentViewManager, notifierService, artifactBuilder,
            option);
    uploader.setReceiver(fileUploader);
    uploader.addSucceededListener(fileUploader);
    uploader.addStartedListener(fileUploader);
    uploadLayout.addComponent(uploader);

    HorizontalLayout target = new HorizontalLayout();
    option.addContainerProperty("id", String.class, null);
    option.setItemCaptionPropertyId("id");
    option.addItem(DeployableContainerType.DEPLOYABLE.attribute()).getItemProperty("id")
            .setValue("Add to deployables");
    option.addItem(DeployableContainerType.DEPLOYED.attribute()).getItemProperty("id").setValue("Deploy");
    option.addItem(DeployableContainerType.DEPLOYMENT_PLAN.attribute()).getItemProperty("id")
            .setValue("Create a deployment plan");
    option.addStyleName("horizontal");
    option.select(DeployableContainerType.DEPLOYABLE.attribute());

    target.addComponent(option);
    uploadLayout.addComponent(target);
    toolBar.addComponent(uploadLayout);

    Label infoLabel = new Label("Drop files here to create a deployment plan");
    infoLabel.setSizeUndefined();
    final VerticalLayout deploymentPlanMaker = new VerticalLayout(infoLabel);
    deploymentPlanMaker.setComponentAlignment(infoLabel, Alignment.MIDDLE_CENTER);
    Button draft = new Button("A draft is under construction");
    draft.addStyleName("link");
    draft.addClickListener(new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            deploymentViewManager.showDeploymentPlanView();
        }
    });
    draft.setVisible(false);
    deploymentViewManager.setDeploymentPlanDraftViewer(draft);
    deploymentPlanMaker.addComponent(draft);
    deploymentPlanMaker.setComponentAlignment(draft, Alignment.TOP_CENTER);
    deploymentPlanMaker.setSizeFull();
    deploymentPlanMaker.addStyleName("drop-area");
    deploymentPlanMakerWrapper = new DragAndDropWrapper(deploymentPlanMaker);
    deploymentPlanMakerWrapper.setSizeFull();
    toolBar.addComponent(deploymentPlanMakerWrapper);
    addComponent(toolBar);

    addComponent(framesContainer);
    setExpandRatio(framesContainer, 1.5f);

    helpWindow = notifierService.createHelpOverlay("Deployment module",
            "<p>To deploy, or undeploy, artifacts, you can drag and drop elements from deployables panel "
                    + "to deployed panel and vice versa.</p>"
                    + "<p>You can also drag files from desktop and drop them where you want to add them.");
}

From source file:control.ExperimentImportController.java

License:Open Source License

public void init(final String user) {
    ExperimentImportController control = this;
    Upload upload = new Upload("Upload your file here", uploader);
    view.initView(upload);/* ww w . j  a va2 s.  c  o m*/
    upload.setButtonCaption("Upload");
    // Listen for events regarding the success of upload.
    upload.addFailedListener(uploader);
    upload.addSucceededListener(uploader);
    FinishedListener uploadFinListener = new FinishedListener() {
        /**
         * 
         */
        private static final long serialVersionUID = -8413963075202260180L;

        public void uploadFinished(FinishedEvent event) {
            String uploadError = uploader.getError();
            File file = uploader.getFile();
            view.resetAfterUpload();
            if (file.getPath().endsWith("up_")) {
                String msg = "No file selected.";
                logger.warn(msg);
                Styles.notification("Failed to read file.", msg, NotificationType.ERROR);
                if (!file.delete())
                    logger.error("uploaded tmp file " + file.getAbsolutePath() + " could not be deleted!");
            } else {
                if (uploadError == null || uploadError.isEmpty()) {
                    String msg = "Upload successful!";
                    logger.info(msg);
                    try {
                        view.setRegEnabled(false);
                        prep = new SamplePreparator();
                        Map<String, Set<String>> experimentTypeVocabularies = new HashMap<String, Set<String>>();
                        experimentTypeVocabularies.put("Q_ANTIBODY", vocabs.getAntibodiesMap().keySet());
                        experimentTypeVocabularies.put("Q_CHROMATOGRAPHY_TYPE",
                                vocabs.getChromTypesMap().keySet());
                        experimentTypeVocabularies.put("Q_MS_DEVICE",
                                new HashSet<String>(vocabs.getDeviceMap().values()));
                        experimentTypeVocabularies.put("Q_MS_LCMS_METHOD",
                                new HashSet<String>(vocabs.getLcmsMethods()));

                        VocabularyValidator validator = new VocabularyValidator(experimentTypeVocabularies);
                        boolean readSuccess = prep.processTSV(file, getImportType());
                        boolean vocabValid = false;
                        if (readSuccess) {
                            msProperties = prep.getSpecialExperimentsOfTypeOrNull("Q_MS_MEASUREMENT");
                            mhcProperties = prep.getSpecialExperimentsOfTypeOrNull("Q_MHC_LIGAND_EXTRACTION");
                            List<Map<String, Object>> metadataList = new ArrayList<Map<String, Object>>();
                            if (msProperties != null)
                                metadataList.addAll(msProperties.values());
                            if (mhcProperties != null)
                                metadataList.addAll(mhcProperties.values());
                            vocabValid = validator.validateExperimentMetadata(metadataList);
                        }
                        if (readSuccess && vocabValid) {
                            List<SampleSummaryBean> summaries = prep.getSummary();
                            for (SampleSummaryBean s : summaries) {
                                String translation = reverseTaxMap.get(s.getFullSampleContent());
                                if (translation != null)
                                    s.setSampleContent(translation);
                            }
                            Styles.notification("Upload successful",
                                    "Experiment was successfully uploaded and read.", NotificationType.SUCCESS);
                            switch (getImportType()) {
                            // Standard hierarchic QBiC design
                            case QBIC:
                                view.setSummary(summaries);
                                view.setProcessed(prep.getProcessed());
                                view.setRegEnabled(true);
                                projectInfo = prep.getProjectInfo();
                                break;
                            // Standard non-hierarchic design without QBiC specific keywords
                            case Standard:
                                Map<String, List<String>> catToVocabulary = new HashMap<String, List<String>>();
                                catToVocabulary.put("Species", new ArrayList<String>(taxMap.keySet()));
                                catToVocabulary.put("Tissues", new ArrayList<String>(tissueMap.keySet()));
                                catToVocabulary.put("Analytes", new ArrayList<String>(analytesVocabulary));
                                Map<String, List<String>> missingCategoryToValues = new HashMap<String, List<String>>();
                                missingCategoryToValues.put("Species",
                                        new ArrayList<String>(prep.getSpeciesSet()));
                                missingCategoryToValues.put("Tissues",
                                        new ArrayList<String>(prep.getTissueSet()));
                                missingCategoryToValues.put("Analytes",
                                        new ArrayList<String>(prep.getAnalyteSet()));
                                initMissingInfoListener(prep, missingCategoryToValues, catToVocabulary);
                                break;
                            // MHC Ligands that have already been measured (Filenames exist)
                            case MHC_Ligands_Finished:
                                catToVocabulary = new HashMap<String, List<String>>();
                                catToVocabulary.put("Species", new ArrayList<String>(taxMap.keySet()));
                                catToVocabulary.put("Tissues", new ArrayList<String>(tissueMap.keySet()));
                                catToVocabulary.put("Analytes", new ArrayList<String>(analytesVocabulary));
                                missingCategoryToValues = new HashMap<String, List<String>>();
                                missingCategoryToValues.put("Species",
                                        new ArrayList<String>(prep.getSpeciesSet()));
                                missingCategoryToValues.put("Tissues",
                                        new ArrayList<String>(prep.getTissueSet()));
                                missingCategoryToValues.put("Analytes",
                                        new ArrayList<String>(prep.getAnalyteSet()));
                                initMissingInfoListener(prep, missingCategoryToValues, catToVocabulary);
                                break;
                            default:
                                logger.error("Error parsing tsv: " + prep.getError());
                                // view.showError(prep.getError());
                                Styles.notification("Failed to read file.", prep.getError(),
                                        NotificationType.ERROR);
                                break;
                            }
                        } else {
                            if (!readSuccess) {
                                String error = prep.getError();
                                Styles.notification("Failed to read file.", error, NotificationType.ERROR);
                            } else {
                                String error = validator.getError();
                                Styles.notification("Failed to process file.", error, NotificationType.ERROR);
                            }
                            if (!file.delete())
                                logger.error("uploaded tmp file " + file.getAbsolutePath()
                                        + " could not be deleted!");
                        }
                    } catch (IOException e) {
                        e.printStackTrace();
                    }
                } else {
                    // view.showError(error);
                    Styles.notification("Failed to upload file.", uploadError, NotificationType.ERROR);
                    if (!file.delete())
                        logger.error("uploaded tmp file " + file.getAbsolutePath() + " could not be deleted!");
                }
            }
        }
    };
    upload.addFinishedListener(uploadFinListener);
    // view.initUpload(upload);

    Button.ClickListener cl = new Button.ClickListener() {
        /**
         * 
         */
        private static final long serialVersionUID = 1L;

        /**
         * 
         */

        @Override
        public void buttonClick(ClickEvent event) {
            String src = event.getButton().getCaption();
            if (src.equals("Register All")) {
                view.getRegisterButton().setEnabled(false);
                view.showRegistration();
                // collect experiment information
                complexExperiments = new ArrayList<OpenbisExperiment>();
                complexExperiments
                        .addAll(collectComplexExperiments(msProperties, ExperimentType.Q_MS_MEASUREMENT));
                complexExperiments.addAll(
                        collectComplexExperiments(mhcProperties, ExperimentType.Q_MHC_LIGAND_EXTRACTION));
                openbisCreator.registerProjectWithExperimentsAndSamplesBatchWise(view.getSamples(),
                        projectInfo.getDescription(), complexExperiments, view.getProgressBar(),
                        view.getProgressLabel(), new RegisteredSamplesReadyRunnable(view, control), user,
                        projectInfo.isPilot());
                List<String> tsv = prep.getOriginalTSV();
                switch (getImportType()) {
                case Standard:
                case MHC_Ligands_Finished:
                    String tsvContent = addBarcodesToTSV(tsv, view.getSamples(), getImportType());
                    view.setTSVWithBarcodes(tsvContent,
                            uploader.getFileNameWithoutExtension() + "_with_barcodes");
                    break;
                default:
                    break;
                }
            }
        }

        private Collection<? extends OpenbisExperiment> collectComplexExperiments(
                Map<String, Map<String, Object>> propsMap, ExperimentType type) {
            List<OpenbisExperiment> res = new ArrayList<OpenbisExperiment>();
            if (propsMap != null) {
                for (String code : propsMap.keySet())
                    res.add(new OpenbisExperiment(code, type, propsMap.get(code)));
            }
            return res;
        }
    };
    view.getRegisterButton().addClickListener(cl);
}

From source file:cz.zcu.pia.social.network.frontend.components.profile.profile.ComponentEditProfile.java

@Override
@PostConstruct/*  w  ww .ja v a  2 s  .c o  m*/
public void postConstruct() {
    receiver = appContext.getBean(ImageUploader.class);
    Upload upload = new Upload(msgs.getMessage("upload.image"), receiver);
    upload.setButtonCaption(msgs.getMessage("upload"));
    upload.addSucceededListener(receiver);

    upload.addFailedListener(new Upload.FailedListener() {

        @Override
        public void uploadFailed(Upload.FailedEvent event) {
            Notification.show(msgs.getMessage("upload.not.ok"));
        }
    });
    this.layout.addComponent(upload, "upload");
    super.postConstruct();

    this.password.setVisible(false);
    this.passwordRepeat.setVisible(false);
    this.validation.setVisible(false);

}

From source file:cz.zcu.pia.social.network.frontend.components.profile.profile.ComponentProfile.java

/**
 * Post Construct//from   www . j  ava  2  s .  c  om
 */
@PostConstruct
public void postConstruct() {
    if (!securityHelper.isAuthenticated()) {
        ((MyUI) UI.getCurrent().getUI()).getNavigator().navigateTo(ViewHome.NAME);
        return;
    }
    Users user = usersService.getUserByUsername(securityHelper.getLogedInUser().getUsername());
    if (user == null) {
        return;
    }

    this.addComponent(editProfile);
    editProfile.setUser(user);
    editProfile.setVisible(false);
    editProfile.setParentReference(this);

    setLabels(user);
    editButton = new Button(msgs.getMessage("edit"));
    editButton.addClickListener(new Button.ClickListener() {

        @Override
        public void buttonClick(Button.ClickEvent event) {
            buttonEditFunction(event);
        }
    });

    if (securityHelper.getLogedInUser().getUserImageName() != null) {
        reloadImage();

    } else {
        ImageUploader receiver = appContext.getBean(ImageUploader.class);
        receiver.setParentReference(this);
        Upload upload = new Upload(msgs.getMessage("upload.image"), receiver);
        upload.setButtonCaption(msgs.getMessage("upload"));
        upload.addSucceededListener(receiver);

        upload.addFailedListener(new Upload.FailedListener() {

            @Override
            public void uploadFailed(Upload.FailedEvent event) {
                Notification.show(msgs.getMessage("upload.not.ok"));
            }
        });
        layout.addComponent(upload, "picture");

    }

    fullname = new Label(user.getName() + " " + user.getSurname());
    layout.addComponent(fullname, "name");

    Label usernameLabel = new Label(msgs.getMessage("username") + ":");
    Label postsLabel = new Label(msgs.getMessage("number-of-posts") + ":");
    Label followersLabel = new Label(msgs.getMessage("number-of-followers") + ":");

    usernameLabel.setWidth(LABEL_WIDTH, Unit.PIXELS);
    postsLabel.setWidth(LABEL_WIDTH, Unit.PIXELS);
    followersLabel.setWidth(LABEL_WIDTH, Unit.PIXELS);

    layout.addComponent(usernameLabel, "usernameLabel");
    layout.addComponent(postsLabel, "numberPostsLabel");
    layout.addComponent(followersLabel, "numberFollowersLabel");

    layout.addComponent(username, "username");
    layout.addComponent(numberOfposts, "numberPosts");
    layout.addComponent(numberOfFollowers, "numberFollowers");
    layout.addComponent(editButton, "button");
}

From source file:facs.components.UploadBox.java

License:Open Source License

public UploadBox() {
    this.setCaption(CAPTION);
    // there has to be a device selected.
    devices = new NativeSelect("Devices");
    devices.setDescription("Select a device in order to upload information for that specific devices.");
    devices.setNullSelectionAllowed(false);
    deviceNameToId = new HashMap<String, Integer>();
    for (DeviceBean bean : DBManager.getDatabaseInstance().getDevices()) {
        deviceNameToId.put(bean.getName(), bean.getId());
        devices.addItem(bean.getName());
        // System.out.println("Bean.getName: " + bean.getName() + " Bean.getId: " + bean.getId());
    }// w  ww. j ava2  s  . c  o m
    occupationGrid = new Grid();
    occupationGrid.setSizeFull();

    // Create the upload component and handle all its events
    final Upload upload = new Upload();
    upload.setReceiver(this);
    upload.addProgressListener(this);
    upload.addFailedListener(this);
    upload.addSucceededListener(this);
    upload.setVisible(false);

    // one can only upload csvs, if a device was selected.
    devices.addValueChangeListener(new ValueChangeListener() {

        /**
         * 
         */
        private static final long serialVersionUID = 7890499571475184208L;

        @Override
        public void valueChange(ValueChangeEvent event) {
            upload.setVisible(event.getProperty().getValue() != null);
        }
    });

    // Put the upload and image display in a panel
    // Panel panel = new Panel(UPLOAD_CAPTION);
    // panel.setWidth("100%");
    VerticalLayout panelContent = new VerticalLayout();
    panelContent.setSpacing(true);
    // panel.setContent(panelContent);
    panelContent.addComponent(devices);
    panelContent.addComponent(upload);
    panelContent.addComponent(progress);
    panelContent.addComponent(occupationGrid);

    panelContent.setMargin(true);
    panelContent.setSpacing(true);

    progress.setVisible(false);

    setCompositionRoot(panelContent);
}

From source file:fi.aalto.drumbeat.drumbeatUI.DrumbeatinterfaceUI.java

License:Open Source License

@SuppressWarnings("deprecation")
private void createTab_Datasets() {
    VerticalLayout tab_datasets = new VerticalLayout();
    tab_datasets.setCaption("Data sets");
    tabsheet.addTab(tab_datasets);//from  ww w . j a  va 2 s. c o  m
    tab_datasets.addComponent(datasets_tree);
    Link void_link = new Link("Void description of the data sets",
            new ExternalResource("http://drumbeat.cs.hut.fi/void.ttl"));
    tab_datasets.addComponent(void_link);
    Panel p_model = new Panel("Upload and convert an IFC file");
    p_model.setWidth("900");
    tab_datasets.addComponent(p_model);

    HorizontalLayout hor1 = new HorizontalLayout();
    hor1.setSizeFull(); // Use all available space
    hor1.setMargin(true);
    p_model.setContent(hor1);

    VerticalLayout upload_selections = new VerticalLayout();
    hor1.addComponent(upload_selections);

    upload_selections.addComponent(sites_tree_4upload);
    VerticalLayout upload_panels = new VerticalLayout();
    hor1.addComponent(upload_panels);

    Panel p_model_file = new Panel("Upload a file");
    p_model_file.setWidth("400");
    upload_panels.addComponent(p_model_file);

    Panel p_model_url = new Panel("Upload from a URL");
    p_model_url.setWidth("400");
    upload_panels.addComponent(p_model_url);

    // Create the upload with a caption and set receiver later
    Upload upload = new Upload("Select a file and press Upload", drumbeat_fileReceiver);
    upload.addSucceededListener(drumbeat_fileReceiver);
    upload.addFailedListener(drumbeat_fileReceiver);
    p_model_file.setContent(upload);

    url_textField.setImmediate(true);
    Button button = new Button("Upload from the URL", new Button.ClickListener() {
        @Override
        public void buttonClick(Button.ClickEvent event) {
            drumbeat_fileReceiver.receiveFileFromURL(url_textField.getValue());
        }
    });

    HorizontalLayout url_upload = new HorizontalLayout();
    url_upload.setSizeUndefined();
    url_upload.addComponent(url_textField);
    url_upload.addComponent(button);
    url_upload.setSpacing(true);
    p_model_url.setContent(url_upload);

    bim_projects_selection.setInvalidAllowed(false);
    bim_projects_selection.setNullSelectionAllowed(false);
    bim_projects_selection.setNewItemsAllowed(false);
    bim_projects_selection.setWidth("400");
    final VerticalLayout project_browser = new VerticalLayout();
    bim_projects_selection.addListener(new Property.ValueChangeListener() {
        private static final long serialVersionUID = -5188369735622627751L;

        public void valueChange(ValueChangeEvent event) {
            if (bim_projects_selection.getValue() != null) {
                htmlView_BIMProject(project_browser, bim_projects.get(bim_projects_selection.getValue()));
            }
        }
    });

    tab_datasets.addComponent(bim_projects_selection);
    tab_datasets.addComponent(project_browser);
}

From source file:fi.vtt.RVaadin.RUpload.java

License:Apache License

/**
 * Contruct an upload element for R (implemented as Vaadin CustomComponent).
 * //from   w w  w.ja va  2  s  .  co m
 * @param caption
 *            String caption or null
 * @param R
 *            the corresponding RSession to upload the files to
 */
public RUpload(String caption, RContainer R) {

    /* Create the RUpload custom component */
    super.setSizeUndefined();
    root = new Panel(caption);
    root.setWidth("90ex");

    setCompositionRoot(root);

    HorizontalLayout hbox = new HorizontalLayout();
    hbox.setWidth("100%");

    /* Create the Upload component */
    final Upload upload = new Upload("Choose file", this);
    upload.setButtonCaption("Submit");

    /* Listen for events regarding the success of upload. */
    upload.addSucceededListener(this);
    upload.addFailedListener(this);
    hbox.addComponent(upload);

    Label hfill = new Label();
    hbox.addComponent(hfill);
    hbox.setExpandRatio(hfill, 1.0f);

    remove = new Button("Remove", new Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            String current = getSelection();

            if (current != null) {
                /* Delete the file */
                delete(current);

                /* Update the lists and the notification area */
                int i = fileNames.indexOf(current);
                fileNames.remove(i);
                mimeTypes.remove(i);
                uploadedFiles.removeItem(current);

                /* Gray out the button, if this was the last item */
                if (fileNames.isEmpty()) {
                    remove.setEnabled(false);
                }
            }
        }
    });

    hbox.addComponent(remove);
    remove.setEnabled(false);
    hbox.setComponentAlignment(remove, Alignment.BOTTOM_RIGHT);

    /* Notification area for already uploaded files */
    uploadedFiles = new ListSelect("Already submitted files");
    uploadedFiles.setMultiSelect(false);
    uploadedFiles.setNullSelectionAllowed(false);
    uploadedFiles.setHeight("4em");
    uploadedFiles.setWidth("100%");

    // Changed for Vaadin 7, not tested!!
    VerticalLayout vbox = new VerticalLayout();
    vbox.addComponent(hbox);
    vbox.addComponent(uploadedFiles);
    root.setContent(vbox);

    /* Bind the component to the given R session */
    this.R = R;
}