use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class TaskDetailPanel method initHeader.
protected void initHeader() {
GridLayout taskDetails = new GridLayout(2, 2);
taskDetails.setWidth(100, UNITS_PERCENTAGE);
taskDetails.addStyleName(ExplorerLayout.STYLE_TITLE_BLOCK);
taskDetails.setSpacing(true);
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);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class TaskEventsPanel method addTaskEventPicture.
protected void addTaskEventPicture(final org.activiti.engine.task.Event taskEvent, GridLayout eventGrid) {
final Picture userPicture = identityService.getUserPicture(taskEvent.getUserId());
Embedded authorPicture = null;
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);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class UserDetailsComponent method addUserPicture.
protected void addUserPicture() {
// default icon
Resource pictureResource = Images.USER_32;
if (user != null) {
final Picture userPicture = identityService.getUserPicture(user.getId());
if (userPicture != null) {
pictureResource = new StreamResource(new StreamSource() {
public InputStream getStream() {
return userPicture.getInputStream();
}
}, 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());
}
});
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class ThemeImageColumnGenerator method generateCell.
public Component generateCell(Table source, Object itemId, Object columnId) {
Embedded embedded = new Embedded(null, image);
if (clickListener != null) {
embedded.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
embedded.setData(itemId);
embedded.addListener(clickListener);
}
return embedded;
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class TaskRelatedContentComponent method addAttachmentsToTable.
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);
}
if (!table.getItemIds().isEmpty()) {
table.setVisible(true);
}
table.setPageLength(table.size());
}
Aggregations