Examples of Upload


Examples of com.vaadin.ui.Upload

     * VaadinRequest)
     */
    @Override
    protected void setup(VaadinRequest request) {

        Upload upload = new Upload();
        upload.setId("upload");
        upload.setImmediate(false);
        addComponent(upload);

        Upload immediateUpload = new Upload();
        immediateUpload.setId("immediateupload");
        immediateUpload.setImmediate(true);
        addComponent(immediateUpload);
    }
View Full Code Here

Examples of com.vaadin.ui.Upload

                    } else {

                        int separatorPos = name.lastIndexOf("_");
                        final String pid = name.substring(0, separatorPos);
                        final Upload uploadComponent = (Upload) idPaintableMap
                                .get(pid);
                        if (uploadComponent == null) {
                            throw new FileUploadException(
                                    "Upload component not found");
                        }
                        if (uploadComponent.isReadOnly()) {
                            throw new FileUploadException(
                                    "Warning: ignored file upload because upload component is set as read-only");
                        }
                        synchronized (application) {
                            // put upload component into receiving state
                            uploadComponent.startUpload();
                        }

                        // tell UploadProgressListener which component is
                        // receiving
                        // file
                        pl.setUpload(uploadComponent);

                        try {
                            uploadComponent.receiveUpload(upstream);
                        } catch (UploadException e) {
                            // error happened while receiving file. Handle the
                            // error in the same manner as it would have
                            // happened in
                            // variable change.
View Full Code Here

Examples of com.vaadin.ui.Upload

                logError("Upload of " + uploadedArtifact + " failed.");
            }
        };

        final Upload uploadArtifact = new Upload("Upload Artifact", uploadHandler);
        uploadArtifact.addListener((SucceededListener) uploadHandler);
        uploadArtifact.addListener((FailedListener) uploadHandler);
        uploadArtifact.setImmediate(true);

        final DragAndDropWrapper finalUploadedArtifacts = new DragAndDropWrapper(uploadedArtifacts);
        finalUploadedArtifacts.setDropHandler(new ArtifactDropHandler(uploadHandler));

        addListener(new Window.CloseListener() {
View Full Code Here

Examples of com.vaadin.ui.Upload

                final InputStream stream = item.openStream();
                if (item.isFormField()) {
                    // ignored, upload requests contains only files
                } else {
                    final String pid = name.split("_")[0];
                    final Upload uploadComponent = (Upload) idPaintableMap
                            .get(pid);
                    if (uploadComponent == null) {
                        throw new FileUploadException(
                                "Upload component not found");
                    }
                    if (uploadComponent.isReadOnly()) {
                        throw new FileUploadException(
                                "Warning: ignored file upload because upload component is set as read-only");
                    }
                    synchronized (application) {
                        // put upload component into receiving state
                        uploadComponent.startUpload();
                    }
                    final UploadStream upstream = new UploadStream() {

                        public String getContentName() {
                            return filename;
                        }

                        public String getContentType() {
                            return mimeType;
                        }

                        public InputStream getStream() {
                            return stream;
                        }

                        public String getStreamName() {
                            return "stream";
                        }

                    };

                    // tell UploadProgressListener which component is receiving
                    // file
                    pl.setUpload(uploadComponent);

                    try {
                        uploadComponent.receiveUpload(upstream);
                    } catch (UploadException e) {
                        // error happened while receiving file. Handle the
                        // error in the same manner as it would have happened in
                        // variable change.
                        synchronized (application) {
View Full Code Here

Examples of com.vaadin.ui.Upload

                    }
                }
            }
        };

        final Upload uploadArtifact = new Upload();
        uploadArtifact.setCaption("Upload Artifact");
        uploadHandler.install(uploadArtifact);

        final DragAndDropWrapper finalUploadedArtifacts = new DragAndDropWrapper(uploadedArtifacts);
        finalUploadedArtifacts.setDropHandler(new ArtifactDropHandler(uploadHandler));
View Full Code Here

Examples of com.vaadin.ui.Upload

                    } else {

                        int separatorPos = name.lastIndexOf("_");
                        final String pid = name.substring(0, separatorPos);
                        final Upload uploadComponent = (Upload) idPaintableMap
                                .get(pid);
                        if (uploadComponent == null) {
                            throw new FileUploadException(
                                    "Upload component not found");
                        }
                        if (uploadComponent.isReadOnly()) {
                            throw new FileUploadException(
                                    "Warning: ignored file upload because upload component is set as read-only");
                        }
                        synchronized (application) {
                            // put upload component into receiving state
                            uploadComponent.startUpload();
                        }

                        // tell UploadProgressListener which component is
                        // receiving
                        // file
                        pl.setUpload(uploadComponent);

                        try {
                            uploadComponent.receiveUpload(upstream);
                        } catch (UploadException e) {
                            // error happened while receiving file. Handle the
                            // error in the same manner as it would have
                            // happened in
                            // variable change.
View Full Code Here

Examples of models.Upload

              out.write(buff, 0, n);
          }
         
          out.flush();
          out.close();
          Upload up = new Upload();
          up.filename = filename;
          up.originalname = originalname;
          up.contenttype = request.contentType;
          up.file = new Blob(((ByteArrayOutputStream)out).toByteArray());
          up.insert();

      renderText(up.id);
         
      } catch (IOException ioe) {
         Logger.error(ioe.getMessage());
View Full Code Here

Examples of org.eweb4j.mvc.upload.Upload

  }

  private void handleUpload() throws Exception{
    ConfigBean cb = (ConfigBean) SingleBeanCache.get(ConfigConstant.CONFIGBEAN_ID);
   
    Upload upload = method.getAnnotation(Upload.class);
    UploadConfigBean ucb = cb.getMvc().getUpload();
    String tmpDir = ucb.getTmp();
    int memoryMax = StringUtil.strToInt(StringUtil.parseFileSize(ucb.getMaxMemorySize())+"");
    long sizeMax = StringUtil.parseFileSize(ucb.getMaxRequestSize());
    //String[] suffix = ucb.getSuffix().split(",");
    if (upload != null){
      if (upload.tmpDir().trim().length() > 0)
        tmpDir = upload.tmpDir();
     
      if (upload.maxMemorySize().trim().length() > 0)
        memoryMax =  StringUtil.strToInt(StringUtil.parseFileSize(upload.maxMemorySize())+"");
     
      if (upload.maxRequestSize().trim().length() > 0)
        sizeMax = StringUtil.parseFileSize(upload.maxRequestSize());
     
      //if (upload.suffix().length > 0)
        //suffix = upload.suffix();
    }
   
    if (tmpDir.trim().length() == 0)
      tmpDir = "${RootPath}"+File.separator+"WEB-INF"+File.separator+"tmp";
   
    tmpDir = tmpDir.replace("${RootPath}", ConfigConstant.ROOT_PATH);
   
    DiskFileItemFactory factory = new DiskFileItemFactory();
    factory.setSizeThreshold(memoryMax);
    factory.setRepository(new File(tmpDir));
   
    ServletFileUpload _upload = new ServletFileUpload(factory);
    _upload.setSizeMax(sizeMax);
    if (upload != null){
      Class<?> clazz = upload.listener();
      if (!void.class.isAssignableFrom(clazz) && ProgressListener.class.isAssignableFrom(clazz))
        _upload.setProgressListener((ProgressListener) clazz.newInstance());
    }
   
    try{
View Full Code Here

Examples of org.gradle.api.tasks.Upload

        resolverContainer.getMavenScopeMappings().addMapping(PROVIDED_RUNTIME_PRIORITY, configurations.getByName(WarPlugin.PROVIDED_RUNTIME_CONFIGURATION_NAME),
                Conf2ScopeMappingContainer.PROVIDED);
    }

    private void configureInstall(Project project) {
        Upload installUpload = project.getTasks().add(INSTALL_TASK_NAME, Upload.class);
        Configuration configuration = project.getConfigurations().getByName(Dependency.ARCHIVES_CONFIGURATION);
        installUpload.dependsOn(configuration.getBuildArtifacts());
        installUpload.setConfiguration(configuration);
        installUpload.getRepositories().mavenInstaller(WrapUtil.toMap("name", RepositoryHandler.DEFAULT_MAVEN_INSTALLER_NAME));
        installUpload.setDescription("Does a maven install of the archives artifacts into the local .m2 cache.");
    }
View Full Code Here

Examples of org.gradle.api.tasks.Upload

                            "and task '{}' is not an Upload task." +
                            "\nYou'll need to set publishIvy=false or provide a path to the ivy file to " +
                            "publish to solve this issue.",
                            new Object[]{getPath(), archiveConfig.getUploadTaskName()});
                } else {
                    Upload uploadTask = (Upload) candidateUploadTask;
                    if (!uploadTask.isUploadDescriptor()) {
                        log.info("Forcing task '{}' to upload its Ivy descriptor (uploadDescriptor was false).",
                                uploadTask.getPath());
                        uploadTask.setUploadDescriptor(true);
                    }
                    ivyDescriptor = uploadTask.getDescriptorDestination();
                    dependsOn(candidateUploadTask);
                }
            }
        }
    }
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.