Example usage for com.vaadin.server FontAwesome FILES_O

List of usage examples for com.vaadin.server FontAwesome FILES_O

Introduction

In this page you can find the example usage for com.vaadin.server FontAwesome FILES_O.

Prototype

FontAwesome FILES_O

To view the source code for com.vaadin.server FontAwesome FILES_O.

Click Source Link

Usage

From source file:dev.DevUI.java

License:Open Source License

private Plupload createSimpleUploader() {
    //instantiate the uploader just as it was a norman Vaadin Button
    final Plupload uploader = new Plupload("Browse", FontAwesome.FILES_O);
    //set the maximum size of uploaded file
    uploader.setMaxFileSize("5mb");
    //prevent duplicate files
    uploader.setPreventDuplicates(true);

    uploader.setMultiSelection(false);/*from   w  ww.  ja  va2  s. c om*/
    //add filter
    uploader.addFilter(new PluploadFilter("music", "mp3,flac"));
    //add file uploaded handler
    uploader.addFileUploadedListener(new Plupload.FileUploadedListener() {

        @Override
        public void onFileUploaded(PluploadFile file) {
            File uploadedFile = file.getUploadedFileAs(File.class);
            System.out.println("This file was just uploaded: " + uploadedFile.getAbsolutePath());
        }
    });
    //add upload completed handler
    uploader.addUploadCompleteListener(new Plupload.UploadCompleteListener() {

        @Override
        public void onUploadComplete() {
            System.out.println("Upload was completed");
            for (PluploadFile file : uploader.getUploadedFiles()) {
                System.out.println("Uploaded file " + file.getName() + " is located: "
                        + file.getUploadedFileAs(File.class).getAbsolutePath());
            }
        }
    });
    //add upload pgoress handler
    uploader.addUploadProgressListener(new Plupload.UploadProgressListener() {

        @Override
        public void onUploadProgress(PluploadFile file) {
            System.out
                    .println("I'm uploading file " + file.getName() + " and I'm at " + file.getPercent() + "%");
        }
    });
    //add files added handler - autostart the uploader after files addition
    uploader.addFilesAddedListener(new Plupload.FilesAddedListener() {

        @Override
        public void onFilesAdded(PluploadFile[] files) {
            uploader.start();
        }
    });
    return uploader;
}

From source file:pl.exsio.plupload.examples.util.Util.java

License:Open Source License

public static Plupload createUploader() {
    Plupload uploader = new Plupload("Browse", FontAwesome.FILES_O);
    uploader.setMaxFileSize("5mb");
    uploader.addUploadCompleteListener(getDisposeListener(uploader));
    return uploader;
}