List of usage examples for com.vaadin.ui Embedded Embedded
public Embedded(String caption, Resource source)
From source file:org.activiti.explorer.ui.reports.SavedReportDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout details = new GridLayout(2, 2); details.setWidth(100, UNITS_PERCENTAGE); details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); details.setSpacing(true);//www . ja v a2 s . c o m details.setMargin(false, false, true, false); details.setColumnExpandRatio(1, 1.0f); detailPanelLayout.addComponent(details); // Image Embedded image = new Embedded(null, Images.REPORT_50); details.addComponent(image, 0, 0, 0, 1); // Name Label nameLabel = new Label(SavedReportListItem.getReportDisplayName(historicProcessInstance)); nameLabel.addStyleName(Reindeer.LABEL_H2); details.addComponent(nameLabel, 1, 0); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); details.addComponent(propertiesLayout); // Created Time String createLabel = i18nManager.getMessage(Messages.REPORTING_CREATE_TIME, new HumanTime(i18nManager).format(historicProcessInstance.getEndTime())); Label versionLabel = new Label(createLabel); versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME); propertiesLayout.addComponent(versionLabel); }
From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(5, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);// ww w . j a v a 2s .c o m taskDetails.setMargin(false, false, true, false); // Add image Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(historicTask.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0, 4, 0); // Add due date PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_DUEDATE_SHORT), historicTask.getDueDate(), i18nManager.getMessage(Messages.TASK_DUEDATE_UNKNOWN), false); dueDateLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_DUEDATE); taskDetails.addComponent(dueDateLabel, 1, 1); // Add priority Integer lowMedHighPriority = convertPriority(historicTask.getPriority()); Label priorityLabel = new Label(); switch (lowMedHighPriority) { case 1: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_LOW)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_LOW); break; case 2: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_MEDIUM)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_MEDIUM); break; case 3: default: priorityLabel.setValue(i18nManager.getMessage(Messages.TASK_PRIORITY_HIGH)); priorityLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_PRIORITY_HIGH); } taskDetails.addComponent(priorityLabel, 2, 1); // Add create date PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT), historicTask.getStartTime(), "", true); createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME); taskDetails.addComponent(createLabel, 3, 1); // Add label to fill excess space Label spacer = new Label(); spacer.setContentMode(Label.CONTENT_XHTML); spacer.setValue(" "); spacer.setSizeUndefined(); taskDetails.addComponent(spacer); taskDetails.setColumnExpandRatio(1, 1.0f); taskDetails.setColumnExpandRatio(2, 1.0f); taskDetails.setColumnExpandRatio(3, 1.0f); taskDetails.setColumnExpandRatio(4, 1.0f); centralLayout.addComponent(taskDetails); }
From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) { for (final HistoricTaskInstance subTask : subTasks) { // icon//from w w w . ja v a2s .c o m Embedded icon = new Embedded(null, Images.TASK_22); icon.setWidth(22, UNITS_PIXELS); icon.setWidth(22, UNITS_PIXELS); subTaskGrid.addComponent(icon); // Link to subtask Button subTaskLink = new Button(subTask.getName()); subTaskLink.addStyleName(Reindeer.BUTTON_LINK); subTaskLink.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { ExplorerApp.get().getViewManager().showTaskPage(subTask.getId()); } }); subTaskGrid.addComponent(subTaskLink); subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT); } }
From source file:org.activiti.explorer.ui.task.HistoricTaskDetailPanel.java
License:Apache License
protected void populateRelatedContent(Table table, List<Attachment> attachments) { if (!attachments.isEmpty()) { table.setVisible(true);//from w w w . jav a 2s . c om } for (Attachment attachment : attachments) { AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment); Item attachmentItem = table.addItem(attachment.getId()); // Simple renderer that just shows a popup window with the attachment RelatedContentComponent relatedContentComponent = new RelatedContentComponent() { public void showAttachmentDetail(Attachment attachment) { AttachmentDetailPopupWindow popup = new AttachmentDetailPopupWindow(attachment); ExplorerApp.get().getViewManager().showPopupWindow(popup); } }; attachmentItem.getItemProperty("name") .setValue(renderer.getOverviewComponent(attachment, relatedContentComponent)); attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment))); } table.setPageLength(table.size()); }
From source file:org.activiti.explorer.ui.task.SubTaskComponent.java
License:Apache License
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) { if (!subTasks.isEmpty()) { for (final HistoricTaskInstance subTask : subTasks) { // icon Embedded icon = null;/*from w ww .j a v a 2 s .c o m*/ if (subTask.getEndTime() != null) { icon = new Embedded(null, Images.TASK_FINISHED_22); } else { icon = new Embedded(null, Images.TASK_22); } icon.setWidth(22, UNITS_PIXELS); icon.setWidth(22, UNITS_PIXELS); subTaskLayout.addComponent(icon); // Link to subtask Button subTaskLink = new Button(subTask.getName()); subTaskLink.addStyleName(Reindeer.BUTTON_LINK); subTaskLink.addListener(new ClickListener() { public void buttonClick(ClickEvent event) { ExplorerApp.get().getViewManager().showTaskPage(subTask.getId()); } }); subTaskLayout.addComponent(subTaskLink); subTaskLayout.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT); if (subTask.getEndTime() == null) { // Delete icon only appears when task is not finished yet Embedded deleteIcon = new Embedded(null, Images.DELETE); deleteIcon.addStyleName(ExplorerLayout.STYLE_CLICKABLE); deleteIcon.addListener(new DeleteSubTaskClickListener(subTask, this)); subTaskLayout.addComponent(deleteIcon); subTaskLayout.setComponentAlignment(deleteIcon, Alignment.MIDDLE_RIGHT); } else { // Next line of grid subTaskLayout.newLine(); } } } else { Label noSubTasksLabel = new Label(i18nManager.getMessage(Messages.TASK_NO_SUBTASKS)); noSubTasksLabel.setSizeUndefined(); noSubTasksLabel.addStyleName(Reindeer.LABEL_SMALL); subTaskLayout.addComponent(noSubTasksLabel); } }
From source file:org.activiti.explorer.ui.task.TaskDetailPanel.java
License:Apache License
protected void initHeader() { GridLayout taskDetails = new GridLayout(2, 2); taskDetails.setWidth(100, UNITS_PERCENTAGE); taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK); taskDetails.setSpacing(true);//ww w. ja v a 2 s. com taskDetails.setMargin(false, false, true, false); taskDetails.setColumnExpandRatio(1, 1.0f); centralLayout.addComponent(taskDetails); // Add image Embedded image = new Embedded(null, Images.TASK_50); taskDetails.addComponent(image, 0, 0, 0, 1); // Add task name Label nameLabel = new Label(task.getName()); nameLabel.addStyleName(Reindeer.LABEL_H2); taskDetails.addComponent(nameLabel, 1, 0); taskDetails.setComponentAlignment(nameLabel, Alignment.MIDDLE_LEFT); // Properties HorizontalLayout propertiesLayout = new HorizontalLayout(); propertiesLayout.setSpacing(true); taskDetails.addComponent(propertiesLayout); propertiesLayout.addComponent(new DueDateComponent(task, i18nManager, taskService)); propertiesLayout.addComponent(new PriorityComponent(task, i18nManager, taskService)); initCreateTime(propertiesLayout); }
From source file:org.activiti.explorer.ui.task.TaskEventsPanel.java
License:Apache License
protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) { final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId()); Embedded authorPicture = null;/* ww w. ja v a2 s . c o m*/ 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()); authorPicture = new Embedded(null, imageresource); } else { authorPicture = new Embedded(null, Images.USER_50); } authorPicture.setType(Embedded.TYPE_IMAGE); authorPicture.setHeight("48px"); authorPicture.setWidth("48px"); authorPicture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); eventGrid.addComponent(authorPicture); }
From source file:org.activiti.explorer.ui.task.TaskRelatedContentComponent.java
License:Apache License
protected void addAttachmentsToTable(List<Attachment> attachments) { for (Attachment attachment : attachments) { AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment); Item attachmentItem = table.addItem(attachment.getId()); attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, this)); attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment))); Embedded deleteButton = new Embedded(null, Images.DELETE); deleteButton.addStyleName(ExplorerLayout.STYLE_CLICKABLE); deleteButton.addListener((ClickListener) new DeleteClickedListener(attachment)); attachmentItem.getItemProperty("delete").setValue(deleteButton); }//from w w w . j av a 2 s. com if (!table.getItemIds().isEmpty()) { table.setVisible(true); } table.setPageLength(table.size()); }
From source file:org.activiti.explorer.ui.task.UserDetailsComponent.java
License:Apache License
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(); }/*from w w w. j a v a 2 s. c om*/ }, user.getId(), ExplorerApp.get()); } } Embedded picture = new Embedded(null, pictureResource); picture.setType(Embedded.TYPE_IMAGE); picture.addStyleName(ExplorerLayout.STYLE_TASK_EVENT_PICTURE); if (user != null) { // Only set fixed height and width when user has image, otherwise icon's dimensions will be used picture.setHeight("32px"); picture.setWidth("32px"); } addComponent(picture); // Add profile popup listener if (user != null) { picture.addStyleName(ExplorerLayout.STYLE_CLICKABLE); picture.addListener(new com.vaadin.event.MouseEvents.ClickListener() { public void click(ClickEvent event) { viewManager.showProfilePopup(user.getId()); } }); } }
From source file:org.activiti.kickstart.ui.popup.ProcessImagePopupWindow.java
License:Apache License
protected void initUi() { setModal(true);/* w ww . j av a 2 s .c om*/ setHeight("80%"); setWidth("80%"); center(); setCaption(TITLE); StreamResource.StreamSource streamSource = null; if (processDefinitionId != null) { streamSource = new StreamSource() { private static final long serialVersionUID = -8875067466181823014L; public InputStream getStream() { return adhocWorkflowService.getProcessImage(processDefinitionId); } }; } else if (adhocWorkflow != null) { final ProcessDiagramGenerator converter = new ProcessDiagramGenerator(adhocWorkflow); streamSource = new StreamSource() { private static final long serialVersionUID = 239500411112658830L; public InputStream getStream() { return converter.execute(); } }; } // resource must have unique id! StreamResource imageresource = new StreamResource(streamSource, UUID.randomUUID() + ".png", viewManager.getApplication()); Panel panel = new Panel(); panel.setContent(new HorizontalLayout()); panel.setStyleName(Reindeer.PANEL_LIGHT); panel.setHeight("95%"); Embedded embedded = new Embedded("", imageresource); embedded.setType(Embedded.TYPE_IMAGE); panel.addComponent(embedded); addComponent(panel); }