Package com.vaadin.terminal

Examples of com.vaadin.terminal.StreamResource


      * Here we create a new StreamResource to get our PDF
      * Not working for the moment
      * __this__ must be replaced with a StreamSource
      *
      */
        StreamResource resource = new StreamResource(this, "/home/matrix/Desktop/pv.pdf", __app);
       
        // Set the right MIME type
        resource.setMIMEType(resource.getMIMEType());
        e.setSource(new ClassResource(resource.getFilename(), __app));
        window.addComponent(e);
        __app.getMainWindow().addWindow(window);
    }
View Full Code Here


         *  Here we create a new StreamResource to get our PDF
         *  Not working for the moment
         *  __this__ must be replaced with a StreamSource
         * 
         */
        StreamResource resource = new StreamResource(this, "/home/matrix/Desktop/pv.pdf", __app);
       
        // Set the right MIME type
        resource.setMIMEType(resource.getMIMEType());
        e.setSource(new ClassResource(resource.getFilename(), __app));
        __app.getMainWindow().addComponent(e);
    }
View Full Code Here

    e.setSizeFull();
    e.setType(Embedded.TYPE_BROWSER);

    // Here we create a new StreamResource which downloads our StreamSource,
    // which is our pdf.
    StreamResource resource = new StreamResource(this, "schedule.pdf?"
        + System.currentTimeMillis(), application);
    // Set the right mime type
    resource.setMIMEType("application/pdf");

    e.setSource(resource);
    window.addComponent(e);
    application.getMainWindow().addWindow(window);
  }
View Full Code Here

                    return new ByteArrayInputStream(byteArray);
                }
                return null;
            }
        };
        StreamResource resource = new StreamResource(streamSource, name,
                getApplication());

        // show the file contents - images only for now
        Embedded embedded = new Embedded(name, resource);
        showComponent(embedded, name);
View Full Code Here

  protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
    if(renderPicture) {
      Picture picture = identityService.getUserPicture(userName);
      if(picture != null) {
        Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()),
          userName + picture.getMimeType(), ExplorerApp.get());
       
        Embedded image = new Embedded(null, imageResource);
        image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        image.setType(Embedded.TYPE_IMAGE);
View Full Code Here

            processEngineConfiguration.getLabelFontName(), processEngineConfiguration.getClassLoader());
      }
    };
   
    // resource must have unique id (or cache-crap can happen)!
    StreamResource imageresource = new StreamResource(streamSource,UUID.randomUUID() + ".png", ExplorerApp.get());
    Embedded diagram = new Embedded("", imageresource);
    diagram.setType(Embedded.TYPE_IMAGE);
    diagram.setSizeUndefined();
   
    imagePanel = new Panel(); // using panel for scrollbars
View Full Code Here

  protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
    if(renderPicture) {
      Picture picture = identityService.getUserPicture(userName);
      if(picture != null) {
        Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()),
          userName + picture.getMimeType(), ExplorerApp.get());
       
        Embedded image = new Embedded(null, imageResource);
        image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
        image.setType(Embedded.TYPE_IMAGE);
View Full Code Here

      }
     
      if(!didDrawImage && processDefinitionEntity.isGraphicalNotationDefined()) {
        ProcessEngineConfiguration processEngineConfiguration = ProcessEngines.getDefaultProcessEngine().getProcessEngineConfiguration();
        ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
        StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
          .buildStreamResource(processInstance, repositoryService, runtimeService, diagramGenerator, processEngineConfiguration);
 
        if(diagram != null) {
          Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
          header.addStyleName(ExplorerLayout.STYLE_H3);
View Full Code Here

      }

      ProcessEngineConfiguration processEngineConfig = ((ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine()).getProcessEngineConfiguration();
      ProcessDiagramGenerator diagramGenerator = processEngineConfig.getProcessDiagramGenerator();

      StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
          .buildStreamResource(processInstance.getId(), processInstance.getProcessDefinitionId(),
              repositoryService, runtimeService, diagramGenerator, processEngineConfig);

      currentEmbedded = new Embedded(null, diagram);
      currentEmbedded.setType(Embedded.TYPE_IMAGE);
View Full Code Here

    profilePanelLayout.addComponent(imageLayout);
    initPicture();
  }
 
  protected void initPicture() {
    StreamResource imageresource = new StreamResource(new StreamSource() {
      private static final long serialVersionUID = 1L;
      public InputStream getStream() {
        return picture.getInputStream();
      }
    }, user.getId(), ExplorerApp.get());
    imageresource.setCacheTime(0);
   
    Embedded picture = new Embedded(null, imageresource);
    picture.setType(Embedded.TYPE_IMAGE);
    picture.setHeight(200, UNITS_PIXELS);
    picture.setWidth(200, UNITS_PIXELS);
View Full Code Here

TOP

Related Classes of com.vaadin.terminal.StreamResource

Copyright © 2018 www.massapicom. 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.