use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class SubTaskComponent method populateSubTasks.
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
if (!subTasks.isEmpty()) {
for (final HistoricTaskInstance subTask : subTasks) {
// icon
Embedded icon = null;
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);
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class ProcessInstanceDetailPanel 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 ProcessInstanceDetailPanel method addHeader.
protected void addHeader() {
GridLayout header = new GridLayout(3, 2);
header.setWidth(100, UNITS_PERCENTAGE);
header.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
header.setSpacing(true);
header.setMargin(false, false, true, false);
// Add image
Embedded image = new Embedded(null, Images.PROCESS_50);
header.addComponent(image, 0, 0, 0, 1);
// Add task name
Label nameLabel = new Label(getProcessDisplayName(processDefinition, processInstance));
nameLabel.addStyleName(Reindeer.LABEL_H2);
header.addComponent(nameLabel, 1, 0, 2, 0);
// Add start time
PrettyTimeLabel startTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_START_TIME), historicProcessInstance.getStartTime(), null, true);
startTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_START_TIME);
header.addComponent(startTimeLabel, 1, 1);
header.setColumnExpandRatio(1, 1.0f);
header.setColumnExpandRatio(2, 1.0f);
panelLayout.addComponent(header);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class SimpleTableEditor method showDiagram.
protected void showDiagram() {
StreamResource.StreamSource streamSource = new StreamSource() {
private static final long serialVersionUID = 6993112534181068935L;
public InputStream getStream() {
WorkflowDefinitionConversion workflowDefinitionConversion = ExplorerApp.get().getWorkflowDefinitionConversionFactory().createWorkflowDefinitionConversion(createWorkflow());
final ProcessEngineImpl defaultProcessEngine = (ProcessEngineImpl) ProcessEngines.getDefaultProcessEngine();
final ProcessEngineConfiguration processEngineConfiguration = defaultProcessEngine.getProcessEngineConfiguration();
final ProcessDiagramGenerator diagramGenerator = processEngineConfiguration.getProcessDiagramGenerator();
return diagramGenerator.generateDiagram(workflowDefinitionConversion.getBpmnModel(), "png", processEngineConfiguration.getActivityFontName(), processEngineConfiguration.getLabelFontName(), processEngineConfiguration.getAnnotationFontName(), processEngineConfiguration.getClassLoader());
}
};
// resource must have unique id (or cache-crap can happen)!
StreamResource imageresource = new StreamResource(streamSource, UUID.randomUUID() + ".png", ExplorerApp.get());
Embedded diagram = new Embedded("", imageresource);
diagram.setType(Embedded.TYPE_IMAGE);
diagram.setSizeUndefined();
// using panel for scrollbars
imagePanel = new Panel();
imagePanel.setScrollable(true);
imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
imagePanel.setWidth(100, UNITS_PERCENTAGE);
imagePanel.setHeight("100%");
mainLayout.addComponent(imagePanel);
HorizontalLayout panelLayout = new HorizontalLayout();
panelLayout.setSizeUndefined();
imagePanel.setContent(panelLayout);
imagePanel.addComponent(diagram);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class AbstractProcessDefinitionDetailPanel method initHeader.
protected void initHeader() {
GridLayout details = new GridLayout(2, 2);
details.setWidth(100, UNITS_PERCENTAGE);
details.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
details.setSpacing(true);
details.setMargin(false, false, true, false);
details.setColumnExpandRatio(1, 1.0f);
detailPanelLayout.addComponent(details);
// Image
Embedded image = new Embedded(null, Images.PROCESS_50);
details.addComponent(image, 0, 0, 0, 1);
// Name
Label nameLabel = new Label(getProcessDisplayName(processDefinition));
nameLabel.addStyleName(Reindeer.LABEL_H2);
details.addComponent(nameLabel, 1, 0);
// Properties
HorizontalLayout propertiesLayout = new HorizontalLayout();
propertiesLayout.setSpacing(true);
details.addComponent(propertiesLayout);
// Version
String versionString = i18nManager.getMessage(Messages.PROCESS_VERSION, processDefinition.getVersion());
Label versionLabel = new Label(versionString);
versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
propertiesLayout.addComponent(versionLabel);
// Add deploy time
PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.PROCESS_DEPLOY_TIME), deployment.getDeploymentTime(), null, true);
deployTimeLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_DEPLOY_TIME);
propertiesLayout.addComponent(deployTimeLabel);
}
Aggregations