• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StreamResource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.vaadin.terminal.StreamResource的典型用法代码示例。如果您正苦于以下问题:Java StreamResource类的具体用法?Java StreamResource怎么用?Java StreamResource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StreamResource类属于com.vaadin.terminal包,在下文中一共展示了StreamResource类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: initPicture

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
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);
      image.setHeight(30, Embedded.UNITS_PIXELS);
      image.setWidth(30, Embedded.UNITS_PIXELS);
      image.addListener(new MouseEvents.ClickListener() {
        private static final long serialVersionUID = 7341560240277898495L;
        public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
          viewManager.showProfilePopup(userName);
        }
      });
      
      addComponent(image);
      setComponentAlignment(image, Alignment.MIDDLE_LEFT);
    } else {
     // TODO: what when no image is available?
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:27,代码来源:UserProfileLink.java


示例2: addProcessImage

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
protected void addProcessImage() {
  ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
    .getDeployedProcessDefinition(processDefinition.getId());

  // Only show when graphical notation is defined
  if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);
    
    StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
      .buildStreamResource(processInstance, repositoryService, runtimeService);

    Embedded embedded = new Embedded(null, diagram);
    embedded.setType(Embedded.TYPE_IMAGE);
    panelLayout.addComponent(embedded);
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:21,代码来源:ProcessInstanceDetailPanel.java


示例3: LebCreator

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
public LebCreator(FossaApplication app, SchuelerLaso schueler, KlasseLaso klasse, String dateiname) throws DocumentException, IOException {
	LebData lebData = collectLebData(schueler, klasse);
	boolean done = false;
	while (!done ) {
		try {
			lebPdf = new PdfStreamSource(app, lebData, this);
			done = true;
		} catch (PdfFormatierungsException pdfFE) {
			System.out.println(pdfFE.getMessage());
			if (pdfFE.getType() == PdfFormatierungsException.TYPE_HURENKIND) {
				hurenkinderCount = hurenkinderCount + 1;
			} else if (pdfFE.getType() == PdfFormatierungsException.TYPE_LONELY_HEADER_OR_FOOTER) {
				dummyLineCount = dummyLineCount + 1;
				hurenkinderMarker = new HashMap<Integer, Boolean>();
				hurenkinderCount = 0;
			}
		}
	}
	filename = dateiname;
	resource = new StreamResource(lebPdf, filename, app);
	resource.setMIMEType("application/pdf");
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:23,代码来源:LebCreator.java


示例4: attach

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
@Override
public void attach() {
	super.attach();
	if(rootCategory.getIcon() != null) {
		StreamResource streamResource = new StreamResource(new StreamResource.StreamSource() {
			private static final long serialVersionUID = 1L;
			public InputStream getStream() {
				return new ByteArrayInputStream(rootCategory.getIcon());
			}
		}, rootCategory.getName() + ".png", getApplication());
		
		iconLayout.addComponent(new Embedded(null, streamResource));
	} else {
		iconLayout.addComponent(new Embedded("", new ThemeResource("category.png")));
	}
}
 
开发者ID:alejandro-du,项目名称:cis,代码行数:17,代码来源:FileComponent.java


示例5: addResourceLinks

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
protected void addResourceLinks() {
  List<String> resourceNames = repositoryService.getDeploymentResourceNames(deployment.getId());
  Collections.sort(resourceNames); // small nr of elements, so we can do it in-memory
  
  if (resourceNames.size() > 0) {
    Label resourceHeader = new Label(i18nManager.getMessage(Messages.DEPLOYMENT_HEADER_RESOURCES));
    resourceHeader.setWidth("95%");
    resourceHeader.addStyleName(ExplorerLayout.STYLE_H3);
    resourceHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    addDetailComponent(resourceHeader);
    
    // resources
    VerticalLayout resourceLinksLayout = new VerticalLayout();
    resourceLinksLayout.setSpacing(true);
    resourceLinksLayout.setMargin(true, false, false, false);
    addDetailComponent(resourceLinksLayout);
    
    for (final String resourceName : resourceNames) {
      StreamResource.StreamSource streamSource = new StreamSource() {
        public InputStream getStream() {
          return repositoryService.getResourceAsStream(deployment.getId(), resourceName);
        }
      };
      Link resourceLink = new Link(resourceName, new StreamResource(streamSource, resourceName, ExplorerApp.get()));
      resourceLinksLayout.addComponent(resourceLink);
    }
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:29,代码来源:DeploymentDetailPanel.java


示例6: initImage

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
protected void initImage() {
  processImageContainer = new VerticalLayout();
  
  Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
  processTitle.addStyleName(ExplorerLayout.STYLE_H3);
  processImageContainer.addComponent(processTitle);
  
  if(processDefinition.getDiagramResourceName() != null) {
    StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
      .buildStreamResource(processDefinition, repositoryService);
    
    Embedded embedded = new Embedded(null, diagram);
    embedded.setType(Embedded.TYPE_IMAGE);
    embedded.setSizeUndefined();
    
    Panel imagePanel = new Panel(); // using panel for scrollbars
    imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
    imagePanel.setWidth(100, UNITS_PERCENTAGE);
    imagePanel.setHeight(400, UNITS_PIXELS);
    HorizontalLayout panelLayout = new HorizontalLayout();
    panelLayout.setSizeUndefined();
    imagePanel.setContent(panelLayout);
    imagePanel.addComponent(embedded);
    
    processImageContainer.addComponent(imagePanel);
  } else {
    Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
    processImageContainer.addComponent(noImageAvailable);
  }
  addComponent(processImageContainer);
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:32,代码来源:ProcessDefinitionInfoComponent.java


示例7: addProcessImage

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
protected void addProcessImage() {
  ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService)
    .getDeployedProcessDefinition(processDefinition.getId());

  // Only show when graphical notation is defined
  if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) {
    Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
    header.addStyleName(ExplorerLayout.STYLE_H3);
    header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
    header.addStyleName(ExplorerLayout.STYLE_NO_LINE);
    panelLayout.addComponent(header);
    
    StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder()
      .buildStreamResource(processInstance, repositoryService, runtimeService);

    Embedded embedded = new Embedded(null, diagram);
    embedded.setType(Embedded.TYPE_IMAGE);
    embedded.setSizeUndefined();

    Panel imagePanel = new Panel(); // using panel for scrollbars
    imagePanel.setScrollable(true);
    imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
    imagePanel.setWidth(100, UNITS_PERCENTAGE);
    imagePanel.setHeight(400, UNITS_PIXELS);
    
    HorizontalLayout panelLayoutT = new HorizontalLayout();
    panelLayoutT.setSizeUndefined();
    imagePanel.setContent(panelLayoutT);
    imagePanel.addComponent(embedded);
    
    panelLayout.addComponent(imagePanel);
  }
}
 
开发者ID:iotsap,项目名称:FiWare-Template-Handler,代码行数:34,代码来源:ProcessInstanceDetailPanel.java


示例8: getImageUser

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
private StreamResource getImageUser(String name, final byte[] byteResource) {
	if (byteResource == null)
		return null;
	
	// create an instance of our stream source.
	StreamSource imagesource = new ModuleResource(byteResource);
	
	// Create a resource that uses the stream source and give it a name.
	// The constructor will automatically register the resource in the application.
	
	StreamResource imageresource = new StreamResource(imagesource, name + "_user.png", application);
	
    return imageresource;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:15,代码来源:ImageField.java


示例9: getIcon

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
private StreamResource getIcon(final byte[] byteResource, String name) {
	if (byteResource == null)
		return null;

	// create an instance of our stream source.
	StreamSource imagesource = new ModuleResource(byteResource);

	// Create a resource that uses the stream source and give it a name.
	// The constructor will automatically register the resource in the
	// application.
	StreamResource imageresource = new StreamResource(imagesource, name
			+ ".png", this);

	return imageresource;
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:16,代码来源:Main.java


示例10: download

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
protected void download(String filename, final JRExporter exporter) {
	StreamResource resource = new StreamResource(new StreamResource.StreamSource() {
		private static final long serialVersionUID = 1L;

		@Override
		public InputStream getStream() {
			return new ByteArrayInputStream(getOutputStream(exporter).toByteArray());
		}
		
	}, filename, getApplication());
	
	getApplication().getMainWindow().open(resource, "_blank");
}
 
开发者ID:thingtrack,项目名称:konekti,代码行数:14,代码来源:TemplateComponentReport.java


示例11: createVaadinComponent

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
protected VerticalLayout createVaadinComponent(UserTask userTask, UIApplication<IUnoVaadinApplication> application) {

	EntityInfo info = extractEntity(userTask);

	String documentName = userTask.getMetaData(METADATA_PRINT_DOCUMENT_NAME);
	if (documentName == null || documentName.trim().length() == 0) {
		throw new IllegalArgumentException("The user task has not document meta data");
	}

	System.out.print(info.classDefinition);

	final EntityDocument document = entityDocumentService.findDocument((Class<Object>) info.classDefinition.getClassDefined(),
			info.entity, documentName);
	if (document == null) {
		throw new RuntimeException("Document not found");
	}

	final StreamSource streamSource = new StreamSource() {

		@Override
		public InputStream getStream() {
			try {
				return document.openInputStream();
			} catch (IOException e) {
				throw new RuntimeException(e);
			}
		}
	};
	final StreamResource resource = new StreamResource(streamSource, document.getName(), application.getConcreteApplication()
			.getMainWindow().getApplication());

	VerticalLayout layout = super.createVaadinComponent(userTask, application);

	Panel panel = createPanel("Documents");
	panel.setWidth("100%");

	Button buttonDocument = new Button();
	buttonDocument.setStyleName(Reindeer.BUTTON_LINK);
	buttonDocument.addListener(new Button.ClickListener() {

		@Override
		public void buttonClick(ClickEvent event) {
			event.getButton().getWindow().open(resource, document.getName());
		}
	});
	buttonDocument.setCaption(documentName);

	panel.addComponent(buttonDocument);
	layout.addComponent(panel);

	return layout;
}
 
开发者ID:frincon,项目名称:openeos,代码行数:55,代码来源:VaadinPrintDocumentUsertaskUI.java


示例12: getLebResource

import com.vaadin.terminal.StreamResource; //导入依赖的package包/类
public StreamResource getLebResource() {
	return resource;
}
 
开发者ID:fossaag,项目名称:rolp,代码行数:4,代码来源:LebCreator.java



注:本文中的com.vaadin.terminal.StreamResource类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LocationEngine类代码示例发布时间:2022-05-23
下一篇:
Java UserInfos类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap