List of usage examples for com.vaadin.ui Embedded Embedded
public Embedded(String caption, Resource source)
From source file:org.activiti.explorer.ui.content.GenericAttachmentRenderer.java
License:Apache License
public Component getDetailComponent(Attachment attachment) { VerticalLayout verticalLayout = new VerticalLayout(); verticalLayout.setSizeUndefined();/*from ww w . j av a 2 s .co m*/ verticalLayout.setSpacing(true); verticalLayout.setMargin(true); Label description = new Label(attachment.getDescription()); description.setSizeUndefined(); verticalLayout.addComponent(description); HorizontalLayout linkLayout = new HorizontalLayout(); linkLayout.setSpacing(true); verticalLayout.addComponent(linkLayout); // Image linkLayout.addComponent(new Embedded(null, getImage(attachment))); // Link Link link = null; if (attachment.getUrl() != null) { link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl())); } else { TaskService 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); } // Set generic image and external window link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK); linkLayout.addComponent(link); return verticalLayout; }
From source file:org.activiti.explorer.ui.custom.UserProfileLink.java
License:Apache License
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(MouseEvents.ClickEvent event) { viewManager.showProfilePopup(userName); }/*from w w w. ja v a 2s .c om*/ }); addComponent(image); setComponentAlignment(image, Alignment.MIDDLE_LEFT); } else { // TODO: what when no image is available? } } }
From source file:org.activiti.explorer.ui.flow.ProcessDefinitionDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(4, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);/*from www . j a v a 2 s . c o m*/ taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.FLOW_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(processDefinition.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 3, 0); // Add version String versionString = i18nManager.getMessage(Messages.FLOW_VERSION, processDefinition.getVersion()); Label versionLabel = new Label(versionString); versionLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_VERSION); taskDetails.addComponent(versionLabel, 1, 1); // Add deploy time PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_DEPLOY_TIME), deployment.getDeploymentTime(), null); deployTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_DEPLOY_TIME); taskDetails.addComponent(deployTimeLabel, 2, 1); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); verticalLayout.addComponent(taskDetails); }
From source file:org.activiti.explorer.ui.flow.ProcessDefinitionInfoComponent.java
License:Apache License
protected void initImage() { VerticalLayout processImageContainer = new VerticalLayout(); Label processTitle = new Label(i18nManager.getMessage(Messages.FLOW_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("", diagram); embedded.setType(Embedded.TYPE_IMAGE); processImageContainer.addComponent(embedded); } else {/*from w w w . j a va2s .c o m*/ Label noImageAvailable = new Label(i18nManager.getMessage(Messages.FLOW_NO_DIAGRAM)); processImageContainer.addComponent(noImageAvailable); } addComponent(processImageContainer); }
From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java
License:Apache License
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) { Item item = taskTable.addItem(task.getId()); if (task.getEndTime() != null) { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22)); } else {/*from w w w . j a va 2 s . co m*/ item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22)); } item.getItemProperty("name").setValue(task.getName()); item.getItemProperty("priority").setValue(task.getPriority()); item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime())); item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime())); if (task.getDueDate() != null) { Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET)); item.getItemProperty("dueDate").setValue(dueDateLabel); } if (task.getAssignee() != null) { Component assignee = new UserProfileLink(identityService, true, task.getAssignee()); item.getItemProperty("assignee").setValue(assignee); } }
From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java
License:Apache License
protected void addFlowImage() { 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.FLOW_INSTANCE_HEADER_DIAGRAM)); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_H3); verticalLayout.addComponent(header); StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processInstance, repositoryService, runtimeService); Embedded embedded = new Embedded("", diagram); embedded.setType(Embedded.TYPE_IMAGE); verticalLayout.addComponent(embedded); }//from w ww . java 2 s .c o m }
From source file:org.activiti.explorer.ui.flow.ProcessInstanceDetailPanel.java
License:Apache License
protected void addName() { GridLayout header = new GridLayout(3, 2); header.setWidth(100, UNITS_PERCENTAGE); header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); header.setSpacing(true);// www .jav a2s . c o m header.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.FLOW_50); header.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(processDefinition.getName() + " (" + processInstance.getId() + ")"); nameLabel.addStyleName(Reindeer.LABEL_H2); header.addComponent(nameLabel, 1, 0, 2, 0); // Add start time PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.FLOW_START_TIME), historicProcessInstance.getStartTime(), null); startTimeLabel.addStyleName(ExplorerLayout.STYLE_FLOW_HEADER_START_TIME); header.addComponent(startTimeLabel, 1, 1); header.setColumnExpandRatio(1, 1.0f); header.setColumnExpandRatio(2, 1.0f); verticalLayout.addComponent(header); }
From source file:org.activiti.explorer.ui.management.admin.AdminCompletedInstancesPanel.java
License:Apache License
protected void initPageTitle() { HorizontalLayout layout = new HorizontalLayout(); layout.setWidth(100, UNITS_PERCENTAGE); layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); layout.setSpacing(true);// w ww . j a v a2 s. c o m layout.setMargin(false, false, true, false); addDetailComponent(layout); Embedded groupImage = new Embedded(null, Images.PROCESS_50); layout.addComponent(groupImage); Label groupName = new Label(i18nManager.getMessage(Messages.ADMIN_COMPLETED_TITLE)); groupName.setSizeUndefined(); groupName.addStyleName(Reindeer.LABEL_H2); layout.addComponent(groupName); layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT); layout.setExpandRatio(groupName, 1.0f); }
From source file:org.activiti.explorer.ui.management.admin.AdminCompletedInstancesPanel.java
License:Apache License
protected void addProcessImage(ProcessDefinition processDefinition, HistoricProcessInstance processInstance) { if (currentEmbedded != null) { mainPanel.removeComponent(currentEmbedded); }/*from w w w.j av a 2 s. c o m*/ ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) .getDeployedProcessDefinition(processDefinition.getId()); // Only show when graphical notation is defined if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) { if (imageHeader == null) { imageHeader = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); imageHeader.addStyleName(ExplorerLayout.STYLE_H3); imageHeader.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); imageHeader.addStyleName(ExplorerLayout.STYLE_NO_LINE); addDetailComponent(imageHeader); } StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processDefinition, repositoryService); currentEmbedded = new Embedded(null, diagram); currentEmbedded.setType(Embedded.TYPE_IMAGE); addDetailComponent(currentEmbedded); } }
From source file:org.activiti.explorer.ui.management.admin.AdminCompletedInstancesPanel.java
License:Apache License
protected void addTaskItem(HistoricTaskInstance task, Table taskTable) { Item item = taskTable.addItem(task.getId()); if (task.getEndTime() != null) { item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_FINISHED_22)); } else {/*from w w w . java 2 s. c o m*/ item.getItemProperty("finished").setValue(new Embedded(null, Images.TASK_22)); } item.getItemProperty("name").setValue(task.getName()); item.getItemProperty("priority").setValue(task.getPriority()); item.getItemProperty("startDate").setValue(new PrettyTimeLabel(task.getStartTime(), true)); item.getItemProperty("endDate").setValue(new PrettyTimeLabel(task.getEndTime(), true)); if (task.getDueDate() != null) { Label dueDateLabel = new PrettyTimeLabel(task.getEndTime(), i18nManager.getMessage(Messages.TASK_NOT_FINISHED_YET), true); item.getItemProperty("dueDate").setValue(dueDateLabel); } if (task.getAssignee() != null) { Component taskAssigneeComponent = getTaskAssigneeComponent(task.getAssignee()); if (taskAssigneeComponent != null) { item.getItemProperty("assignee").setValue(taskAssigneeComponent); } } }