use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class EditorProcessDefinitionDetailPanel 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(modelData.getName());
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, modelData.getVersion());
Label versionLabel = new Label(versionString);
versionLabel.addStyleName(ExplorerLayout.STYLE_PROCESS_HEADER_VERSION);
propertiesLayout.addComponent(versionLabel);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class CreateAttachmentPopupWindow method initTable.
protected void initTable() {
attachmentTypes = new Table();
attachmentTypes.setSizeUndefined();
attachmentTypes.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
attachmentTypes.setSelectable(true);
attachmentTypes.setImmediate(true);
attachmentTypes.setNullSelectionAllowed(false);
attachmentTypes.setWidth(200, UNITS_PIXELS);
attachmentTypes.setHeight(100, UNITS_PERCENTAGE);
attachmentTypes.setCellStyleGenerator(new CellStyleGenerator() {
private static final long serialVersionUID = 1L;
public String getStyle(Object itemId, Object propertyId) {
if ("name".equals(propertyId)) {
return ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST_LAST_COLUMN;
}
return null;
}
});
attachmentTypes.addStyleName(ExplorerLayout.STYLE_RELATED_CONTENT_CREATE_LIST);
attachmentTypes.addContainerProperty("type", Embedded.class, null);
attachmentTypes.setColumnWidth("type", 16);
attachmentTypes.addContainerProperty("name", String.class, null);
// Add all possible attachment types
for (AttachmentEditor editor : attachmentRendererManager.getAttachmentEditors()) {
String name = editor.getTitle(i18nManager);
Embedded image = null;
Resource resource = editor.getImage();
if (resource != null) {
image = new Embedded(null, resource);
}
Item item = attachmentTypes.addItem(editor.getName());
item.getItemProperty("type").setValue(image);
item.getItemProperty("name").setValue(name);
}
// Add listener to show editor component
attachmentTypes.addListener(new ValueChangeListener() {
private static final long serialVersionUID = 1L;
public void valueChange(ValueChangeEvent event) {
String type = (String) event.getProperty().getValue();
selectType(type);
}
});
layout.addComponent(attachmentTypes);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class UserProfileLink method initPicture.
protected void initPicture(IdentityService identityService, boolean renderPicture, final String userName) {
if (renderPicture) {
Picture picture = identityService.getUserPicture(userName);
if (picture != null) {
Resource imageResource = new StreamResource(new InputStreamStreamSource(picture.getInputStream()), userName + picture.getMimeType(), ExplorerApp.get());
Embedded image = new Embedded(null, imageResource);
image.addStyleName(ExplorerLayout.STYLE_CLICKABLE);
image.setType(Embedded.TYPE_IMAGE);
image.setHeight(30, Embedded.UNITS_PIXELS);
image.setWidth(30, Embedded.UNITS_PIXELS);
image.addListener(new MouseEvents.ClickListener() {
private static final long serialVersionUID = 7341560240277898495L;
public void click(MouseEvents.ClickEvent event) {
viewManager.showProfilePopup(userName);
}
});
addComponent(image);
setComponentAlignment(image, Alignment.MIDDLE_LEFT);
} else {
// TODO: what when no image is available?
}
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class SelectUsersPopupWindow method initSelectedUsersTable.
protected void initSelectedUsersTable() {
selectedUsersTable = new Table();
selectedUsersTable.setColumnHeaderMode(Table.COLUMN_HEADER_MODE_HIDDEN);
selectedUsersTable.setEditable(false);
selectedUsersTable.setSortDisabled(true);
// Icon column
selectedUsersTable.addGeneratedColumn("icon", new ThemeImageColumnGenerator(Images.USER_ADD));
selectedUsersTable.setColumnWidth("icon", 16);
// Name column
selectedUsersTable.addContainerProperty("userName", String.class, null);
// Role column
if (showRoles) {
selectedUsersTable.addContainerProperty("role", ComboBox.class, null);
}
// Delete icon column
selectedUsersTable.addGeneratedColumn("delete", new ThemeImageColumnGenerator(Images.DELETE, new com.vaadin.event.MouseEvents.ClickListener() {
public void click(com.vaadin.event.MouseEvents.ClickEvent event) {
Object itemId = ((Embedded) event.getSource()).getData();
// Add to left table (if possible)
String searchFieldValue = (String) searchField.getValue();
if (searchFieldValue != null && searchFieldValue.length() >= 2) {
String userName = (String) selectedUsersTable.getItem(itemId).getItemProperty("userName").getValue();
if (matchesSearchField(userName)) {
Item item = matchingUsersTable.addItem(itemId);
item.getItemProperty("userName").setValue(userName);
}
}
// Delete from right table
selectedUsersTable.removeItem(itemId);
}
}));
selectedUsersTable.setColumnWidth("icon", 16);
if (showRoles) {
selectedUsersTable.setWidth(420, UNITS_PIXELS);
} else {
selectedUsersTable.setWidth(300, UNITS_PIXELS);
}
selectedUsersTable.setHeight(200, UNITS_PIXELS);
userSelectionLayout.addComponent(selectedUsersTable);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class ImageAttachmentRenderer method getDetailComponent.
@Override
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);
// Image
TaskService taskService = ProcessEngines.getDefaultProcessEngine().getTaskService();
String mimeType = extractMineType(attachment.getType());
InputStream imageStream = ImageUtil.resizeImage(taskService.getAttachmentContent(attachment.getId()), mimeType, 900, 550);
Resource resource = new StreamResource(new InputStreamStreamSource(imageStream), attachment.getName() + extractExtention(attachment.getType()), ExplorerApp.get());
Embedded image = new Embedded(null, resource);
verticalLayout.addComponent(image);
// Linke
HorizontalLayout LinkLayout = new HorizontalLayout();
LinkLayout.setSpacing(true);
verticalLayout.addComponent(LinkLayout);
verticalLayout.setComponentAlignment(LinkLayout, Alignment.MIDDLE_CENTER);
Label fullSizeLabel = new Label(ExplorerApp.get().getI18nManager().getMessage(Messages.RELATED_CONTENT_SHOW_FULL_SIZE));
LinkLayout.addComponent(fullSizeLabel);
Link link = null;
if (attachment.getUrl() != null) {
link = new Link(attachment.getUrl(), new ExternalResource(attachment.getUrl()));
} else {
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);
}
link.setIcon(Images.RELATED_CONTENT_PICTURE);
link.setTargetName(ExplorerLayout.LINK_TARGET_BLANK);
LinkLayout.addComponent(link);
return verticalLayout;
}
Aggregations