Examples of StreamResource


Examples of com.vaadin.terminal.StreamResource

    TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
   
    String mimeType = extractMineType(attachment.getType());
   
    InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550);
    Resource resource = new StreamResource(new InputStreamStreamSource(imageStream),
            attachment.getName() + extractExtention(attachment.getType()),ExplorerApp.get());
    Embedded image = new Embedded(null, resource);
    verticalLayout.addComponent(image);
   
    // Linke
    HorizontalLayout LinkLayout = new HorizontalLayout();
    LinkLayout.setSpacing(true);
    verticalLayout.addComponent(LinkLayout);
    verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER);
   
    Label fullSizeLabel = new Label(ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE));
    LinkLayout.addComponent(fullSizeLabel);
   
    Link link = null;
    if(attachment.getUrl() != null) {
      link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
    } else {
      taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
      Resource res = new StreamResource(new InputStreamStreamSource(taskService.getAttachmentContent(attachment.getId())),
              attachment.getName() + extractExtention(attachment.getType()),ExplorerApp.get());
     
      link = new Link(attachment.getName(), res);
    }
   
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

    protected void addUserPicture() {
      Resource pictureResource = Images.USER_32; // default icon
      if (user != null) {
        final Picture userPicture = identityService.getUserPicture(user.getId());
        if (userPicture != null) {
          pictureResource = new StreamResource(new StreamSource() {       
            public InputStream getStream() {
              return userPicture.getInputStream();
            }
          }, user.getId(), ExplorerApp.get());
         
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

    for (final ProcessDefinitionConfig definition : orderedByProcessDescr) {
      if (session.hasPermissionsForDefinitionConfig(definition)) {
        if(!logoResourceCache.containsKey(definition)){
          logoResourceCache.put(definition, definition.getProcessLogo() == null ? defaultLogoResource
              : new StreamResource(new StreamSource() {
                @Override
                public InputStream getStream() {
                  return new ByteArrayInputStream(definition.getProcessLogo());
                }
              }, definition.getBpmDefinitionKey() + "_logo.png", activityMainPane.getApplication())
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

  private Resource getWidgetIcon(WidgetItem widgetItem) {
    try {
      final InputStream stream = widgetItem.getBundle().getIconStream(widgetItem.getIcon());

      if (stream != null)
        return new StreamResource(new StreamResource.StreamSource() {
          @Override
          public InputStream getStream() {
            return stream;
          }
        }, widgetItem.getIcon(), application);
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

    I18NSource messages = I18NSource.ThreadUtil.getThreadI18nSource();
    final String path = messages.getMessage(pathKey);
    final InputStream stream = getClass().getClassLoader().getResourceAsStream(path);
    if (stream != null) {
      String[] pathParts = path.split("/");
      return new StreamResource(new StreamResource.StreamSource() {
        @Override
        public InputStream getStream() {
          return stream;
        }
      }, pathParts[pathParts.length - 1], application);
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

                return ProcessListPane.this.getResource(path);
            }

            @Override
            public Resource getStreamResource(String path, final byte[] bytes) {
                Resource res = new StreamResource(new StreamResource.StreamSource() {
                    @Override
                    public InputStream getStream() {
                        return new ByteArrayInputStream(bytes);
                    }
                }, path, application);
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

            }
        };

        // generate random file name to bypass web browser image cache
        String randomFileName = "process-logo-" + System.nanoTime() + ".png";
        StreamResource resource = new StreamResource(source, randomFileName, GenericEditorApplication.getCurrent());

        // show the logo
        logoImage = new Embedded();
        logoImage.setType(Embedded.TYPE_IMAGE);
        logoImage.setSource(resource);
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

        hl.setSpacing(true);
        Label label = new Label(name);
        label.setWidth("100%");
        hl.addComponent(label);
        hl.setExpandRatio(label, 1.0f);
        final StreamResource resource = new StreamResource(new StreamResource.StreamSource() {
          @Override
          public InputStream getStream() {
            ContentStream cs = doc.getContentStream();
            return cs.getStream();
          }
View Full Code Here

Examples of com.vaadin.terminal.StreamResource

                        @Override
                        public InputStream getStream() {
                            return new ByteArrayInputStream(instanceAttachment.getData());
                        }
                    };
                    StreamResource resource = new StreamResource(source, instanceAttachment.getFileName(), getApplication());
                    resource.setMIMEType(instanceAttachment.getMimeType());
                    getApplication().getMainWindow().open(resource, "_new");
                }
            }
        });
        downloadFile.addStyleName("default");
View Full Code Here

Examples of org.xhtmlrenderer.util.StreamResource

     * @param uri Location of the XML source.
     * @return An XMLResource containing the image.
     */
    public XMLResource getXMLResource(String uri) {
        String ruri = _uriResolver.resolve(uri);
        StreamResource sr = new StreamResource(ruri);
        try {
            sr.connect();
            BufferedInputStream bis = sr.bufferedStream();
            return XMLResource.load(bis);
        } catch (IOException e) {
            return null;
        } finally {
            sr.close();
        }
    }
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.