use of org.activiti.explorer.ui.custom.PrettyTimeLabel in project Activiti by Activiti.
the class HistoricTaskDetailPanel method initHeader.
protected void initHeader() {
GridLayout taskDetails = new GridLayout(5, 2);
taskDetails.setWidth(100, UNITS_PERCENTAGE);
taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
taskDetails.setSpacing(true);
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);
}
use of org.activiti.explorer.ui.custom.PrettyTimeLabel in project Activiti by Activiti.
the class TaskDetailPanel method initCreateTime.
protected void initCreateTime(HorizontalLayout propertiesLayout) {
PrettyTimeLabel createLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.TASK_CREATED_SHORT), task.getCreateTime(), "", true);
createLabel.addStyleName(ExplorerLayout.STYLE_TASK_HEADER_CREATE_TIME);
propertiesLayout.addComponent(createLabel);
}
use of org.activiti.explorer.ui.custom.PrettyTimeLabel in project Activiti by Activiti.
the class JobDetailPanel method addHeader.
protected void addHeader() {
GridLayout jobDetails = new GridLayout(3, 2);
jobDetails.setWidth(100, UNITS_PERCENTAGE);
jobDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
jobDetails.setSpacing(true);
jobDetails.setMargin(false, false, true, false);
// Add image
Embedded image = new Embedded(null, Images.JOB_50);
jobDetails.addComponent(image, 0, 0, 0, 1);
// Add job name
Label nameLabel = new Label(getJobLabel(job));
nameLabel.addStyleName(Reindeer.LABEL_H2);
jobDetails.addComponent(nameLabel, 1, 0, 2, 0);
// Add due date
PrettyTimeLabel dueDateLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.JOB_DUEDATE), job.getDuedate(), i18nManager.getMessage(Messages.JOB_NO_DUEDATE), false);
dueDateLabel.addStyleName(ExplorerLayout.STYLE_JOB_HEADER_DUE_DATE);
jobDetails.addComponent(dueDateLabel, 1, 1);
jobDetails.setColumnExpandRatio(1, 1.0f);
jobDetails.setColumnExpandRatio(2, 1.0f);
addDetailComponent(jobDetails);
}
use of org.activiti.explorer.ui.custom.PrettyTimeLabel in project Activiti by Activiti.
the class DeploymentDetailPanel method addDeploymentName.
protected void addDeploymentName() {
GridLayout taskDetails = new GridLayout(3, 2);
taskDetails.setWidth(100, UNITS_PERCENTAGE);
taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
taskDetails.setSpacing(true);
taskDetails.setMargin(false, false, true, false);
// Add image
Embedded image = new Embedded(null, Images.DEPLOYMENT_50);
taskDetails.addComponent(image, 0, 0, 0, 1);
// Add deployment name
Label nameLabel = new Label();
if (deployment.getName() != null) {
nameLabel.setValue(deployment.getName());
} else {
nameLabel.setValue(i18nManager.getMessage(Messages.DEPLOYMENT_NO_NAME));
}
nameLabel.addStyleName(Reindeer.LABEL_H2);
taskDetails.addComponent(nameLabel, 1, 0, 2, 0);
// Add deploy time
PrettyTimeLabel deployTimeLabel = new PrettyTimeLabel(i18nManager.getMessage(Messages.DEPLOYMENT_DEPLOY_TIME), deployment.getDeploymentTime(), null, true);
deployTimeLabel.addStyleName(ExplorerLayout.STYLE_DEPLOYMENT_HEADER_DEPLOY_TIME);
taskDetails.addComponent(deployTimeLabel, 1, 1);
taskDetails.setColumnExpandRatio(1, 1.0f);
taskDetails.setColumnExpandRatio(2, 1.0f);
addDetailComponent(taskDetails);
}
use of org.activiti.explorer.ui.custom.PrettyTimeLabel in project Activiti by Activiti.
the class AdminRunningInstancesPanel 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);
}
}
}
Aggregations