use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class ProfilePanel method initPicture.
protected void initPicture() {
StreamResource imageresource = new StreamResource(new StreamSource() {
private static final long serialVersionUID = 1L;
public InputStream getStream() {
return picture.getInputStream();
}
}, user.getId(), ExplorerApp.get());
imageresource.setCacheTime(0);
Embedded picture = new Embedded(null, imageresource);
picture.setType(Embedded.TYPE_IMAGE);
picture.setHeight(200, UNITS_PIXELS);
picture.setWidth(200, UNITS_PIXELS);
picture.addStyleName(ExplorerLayout.STYLE_PROFILE_PICTURE);
imageLayout.addComponent(picture);
imageLayout.setWidth(picture.getWidth() + 5, picture.getWidthUnits());
// Change picture button
if (isCurrentLoggedInUser) {
Upload changePictureButton = initChangePictureButton();
imageLayout.addComponent(changePictureButton);
imageLayout.setComponentAlignment(changePictureButton, Alignment.MIDDLE_CENTER);
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class ReportDetailPanel 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.REPORT_50);
details.addComponent(image, 0, 0, 0, 1);
// Name
Label nameLabel = new Label(getReportDisplayName());
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);
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class HistoricTaskDetailPanel method populateSubTasks.
protected void populateSubTasks(List<HistoricTaskInstance> subTasks) {
for (final HistoricTaskInstance subTask : subTasks) {
// icon
Embedded icon = new Embedded(null, Images.TASK_22);
icon.setWidth(22, UNITS_PIXELS);
icon.setWidth(22, UNITS_PIXELS);
subTaskGrid.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());
}
});
subTaskGrid.addComponent(subTaskLink);
subTaskGrid.setComponentAlignment(subTaskLink, Alignment.MIDDLE_LEFT);
}
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class HistoricTaskDetailPanel method populateRelatedContent.
protected void populateRelatedContent(Table table, List<Attachment> attachments) {
if (!attachments.isEmpty()) {
table.setVisible(true);
}
for (Attachment attachment : attachments) {
AttachmentRenderer renderer = attachmentRendererManager.getRenderer(attachment);
Item attachmentItem = table.addItem(attachment.getId());
// Simple renderer that just shows a popup window with the attachment
RelatedContentComponent relatedContentComponent = new RelatedContentComponent() {
public void showAttachmentDetail(Attachment attachment) {
AttachmentDetailPopupWindow popup = new AttachmentDetailPopupWindow(attachment);
ExplorerApp.get().getViewManager().showPopupWindow(popup);
}
};
attachmentItem.getItemProperty("name").setValue(renderer.getOverviewComponent(attachment, relatedContentComponent));
attachmentItem.getItemProperty("type").setValue(new Embedded(null, renderer.getImage(attachment)));
}
table.setPageLength(table.size());
}
use of com.vaadin.ui.Embedded in project Activiti by Activiti.
the class EditorProcessDefinitionInfoComponent method initImage.
protected void initImage() {
processImageContainer = new VerticalLayout();
Label processTitle = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM));
processTitle.addStyleName(ExplorerLayout.STYLE_H3);
processImageContainer.addComponent(processTitle);
StreamSource streamSource = null;
final byte[] editorSourceExtra = repositoryService.getModelEditorSourceExtra(modelData.getId());
if (editorSourceExtra != null) {
streamSource = new StreamSource() {
private static final long serialVersionUID = 1L;
public InputStream getStream() {
InputStream inStream = null;
try {
inStream = new ByteArrayInputStream(editorSourceExtra);
} catch (Exception e) {
LOGGER.warn("Error reading PNG in StreamSource", e);
}
return inStream;
}
};
}
if (streamSource != null) {
Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get()));
embedded.setType(Embedded.TYPE_IMAGE);
embedded.setSizeUndefined();
// using panel for scrollbars
Panel imagePanel = new Panel();
imagePanel.addStyleName(Reindeer.PANEL_LIGHT);
imagePanel.setWidth(100, UNITS_PERCENTAGE);
imagePanel.setHeight(700, UNITS_PIXELS);
HorizontalLayout panelLayout = new HorizontalLayout();
panelLayout.setSizeUndefined();
imagePanel.setContent(panelLayout);
imagePanel.addComponent(embedded);
processImageContainer.addComponent(imagePanel);
} else {
Label noImageAvailable = new Label(i18nManager.getMessage(Messages.PROCESS_NO_DIAGRAM));
processImageContainer.addComponent(noImageAvailable);
}
addComponent(processImageContainer);
}
Aggregations