use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class UrlAttachmentRenderer method getDetailComponent.
public Component getDetailComponent(Attachment attachment) {
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSpacing(true);
verticalLayout.setMargin(true);
verticalLayout.addComponent(new Label(attachment.getDescription()));
HorizontalLayout linkLayout = new HorizontalLayout();
linkLayout.setSpacing(true);
verticalLayout.addComponent(linkLayout);
// Icon
linkLayout.addComponent(new Embedded(null, Images.RELATED_CONTENT_URL));
// Link
Link link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
linkLayout.addComponent(link);
return verticalLayout;
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class GenericAttachmentRenderer method getDetailComponent.
public Component getDetailComponent(Attachment attachment) {
VerticalLayout verticalLayout = new VerticalLayout();
verticalLayout.setSizeUndefined();
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;
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class AdminCompletedInstancesPanel method addTaskItem.
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 {
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);
}
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class AdminCompletedInstancesPanel method addProcessImage.
protected void addProcessImage(ProcessDefinition processDefinition, HistoricProcessInstance processInstance) {
if (currentEmbedded != null) {
mainPanel.removeComponent(currentEmbedded);
}
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);
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class AdminDatabaseSettingsPanel method initPageTitle.
protected void initPageTitle() {
HorizontalLayout layout = new HorizontalLayout();
layout.setWidth(100, UNITS_PERCENTAGE);
layout.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
layout.setSpacing(true);
layout.setMargin(false, false, true, false);
addDetailComponent(layout);
Embedded databaseImage = new Embedded(null, Images.DATABASE_50);
layout.addComponent(databaseImage);
Label groupName = new Label(i18nManager.getMessage(Messages.DATABASE_TITLE));
groupName.setSizeUndefined();
groupName.addStyleName(Reindeer.LABEL_H2);
layout.addComponent(groupName);
layout.setComponentAlignment(groupName, Alignment.MIDDLE_LEFT);
layout.setExpandRatio(groupName, 1.0f);
}
Aggregations