Package com.vaadin.terminal

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


  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

    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

                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

            }
        };

        // 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

        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

                        @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

  protected void loadPicture() {
    Component pictureComponent = null;
    final Picture userPicture = identityService.getUserPicture(user.getId());
    if (userPicture != null) {
      StreamResource imageresource = new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 1L;
        public InputStream getStream() {
          return userPicture.getInputStream();
        }
      }, user.getId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
View Full Code Here

    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

  protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) {
    final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
    Embedded authorPicture = null;
   
    if (userPicture != null) {
      StreamResource imageresource = new StreamResource(new StreamSource() {
        private static final long serialVersionUID = 1L;
        public InputStream getStream() {
          return userPicture.getInputStream();
        }
      }, "event_" + taskEvent.getUserId() + "." + Constants.MIMETYPE_EXTENSION_MAPPING.get(userPicture.getMimeType()), ExplorerApp.get());
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.