List of usage examples for com.vaadin.ui Panel setContent
@Override public void setContent(Component content)
From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java
License:Apache License
@Override public Component getContent() { Panel form = new Panel(TRANSLATOR.translate("step.detail")); if (getExecutionStep().getExecutionStart() == null) { //Set the start date. getExecutionStep().setExecutionStart(new Date()); }/*ww w .ja v a 2 s .c o m*/ FormLayout layout = new FormLayout(); form.setContent(layout); form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(getExecutionStep().getStep().getClass()); binder.setItemDataSource(getExecutionStep().getStep()); TextArea text = new TextArea(TRANSLATOR.translate("general.text")); text.setConverter(new ByteToStringConverter()); binder.bind(text, "text"); text.setSizeFull(); layout.addComponent(text); Field notes = binder.buildAndBind(TRANSLATOR.translate("general.notes"), "notes", TextArea.class); notes.setSizeFull(); layout.addComponent(notes); if (getExecutionStep().getExecutionStart() != null) { start = new DateField(TRANSLATOR.translate("start.date")); start.setResolution(Resolution.SECOND); start.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); start.setValue(getExecutionStep().getExecutionStart()); start.setReadOnly(true); layout.addComponent(start); } if (getExecutionStep().getExecutionEnd() != null) { end = new DateField(TRANSLATOR.translate("end.date")); end.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); end.setResolution(Resolution.SECOND); end.setValue(getExecutionStep().getExecutionEnd()); end.setReadOnly(true); layout.addComponent(end); } binder.setReadOnly(true); //Space to record result if (getExecutionStep().getResultId() != null) { result.setValue(getExecutionStep().getResultId().getResultName()); } layout.addComponent(result); if (reviewer) {//Space to record review if (getExecutionStep().getReviewResultId() != null) { review.setValue(getExecutionStep().getReviewResultId().getReviewName()); } layout.addComponent(review); } //Add Reviewer name if (getExecutionStep().getReviewer() != null) { TextField reviewerField = new TextField(TRANSLATOR.translate("general.reviewer")); reviewerField.setValue(getExecutionStep().getReviewer().getFirstName() + " " + getExecutionStep().getReviewer().getLastName()); reviewerField.setReadOnly(true); layout.addComponent(reviewerField); } if (getExecutionStep().getReviewDate() != null) { reviewDate = new DateField(TRANSLATOR.translate("review.date")); reviewDate.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); reviewDate.setResolution(Resolution.SECOND); reviewDate.setValue(getExecutionStep().getReviewDate()); reviewDate.setReadOnly(true); layout.addComponent(reviewDate); } if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { TextArea expectedResult = new TextArea(TRANSLATOR.translate("expected.result")); expectedResult.setConverter(new ByteToStringConverter()); binder.bind(expectedResult, "expectedResult"); expectedResult.setSizeFull(); layout.addComponent(expectedResult); } //Add the fields fields.clear(); getExecutionStep().getStep().getDataEntryList().forEach(de -> { switch (de.getDataEntryType().getId()) { case 1://String TextField tf = new TextField(TRANSLATOR.translate(de.getEntryName())); tf.setRequired(true); tf.setData(de.getEntryName()); if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { //Add expected result DataEntryProperty stringCase = DataEntryServer.getProperty(de, "property.match.case"); DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result"); if (r != null && !r.getPropertyValue().equals("null")) { String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue(); tf.setRequiredError(error); tf.setRequired(DataEntryServer.getProperty(de, "property.required").getPropertyValue() .equals("true")); tf.addValidator((Object val) -> { //We have an expected result and a match case requirement if (stringCase != null && stringCase.getPropertyValue().equals("true") ? !((String) val).equals(r.getPropertyValue()) : !((String) val).equalsIgnoreCase(r.getPropertyValue())) { throw new InvalidValueException(error); } }); } } fields.add(tf); //Set value if already recorded updateValue(tf); layout.addComponent(tf); break; case 2://Numeric NumberField field = new NumberField(TRANSLATOR.translate(de.getEntryName())); field.setSigned(true); field.setUseGrouping(true); field.setGroupingSeparator(','); field.setDecimalSeparator('.'); field.setConverter(new StringToDoubleConverter()); field.setRequired( DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true")); field.setData(de.getEntryName()); Double min = null, max = null; for (DataEntryProperty prop : de.getDataEntryPropertyList()) { String value = prop.getPropertyValue(); if (prop.getPropertyName().equals("property.max")) { try { max = Double.parseDouble(value); } catch (NumberFormatException ex) { //Leave as null } } else if (prop.getPropertyName().equals("property.min")) { try { min = Double.parseDouble(value); } catch (NumberFormatException ex) { //Leave as null } } } //Add expected result if (VMSettingServer.getSetting("show.expected.result").getBoolVal() && (min != null || max != null)) { String error = TRANSLATOR.translate("error.out.of.range") + " " + (min == null ? " " : (TRANSLATOR.translate("property.min") + ": " + min)) + " " + (max == null ? "" : (TRANSLATOR.translate("property.max") + ": " + max)); field.setRequiredError(error); field.addValidator(new DoubleRangeValidator(error, min, max)); } fields.add(field); //Set value if already recorded updateValue(field); layout.addComponent(field); break; case 3://Boolean CheckBox cb = new CheckBox(TRANSLATOR.translate(de.getEntryName())); cb.setData(de.getEntryName()); cb.setRequired( DataEntryServer.getProperty(de, "property.required").getPropertyValue().equals("true")); if (VMSettingServer.getSetting("show.expected.result").getBoolVal()) { DataEntryProperty r = DataEntryServer.getProperty(de, "property.expected.result"); if (r != null) { //Add expected result String error = TRANSLATOR.translate("expected.result") + ": " + r.getPropertyValue(); cb.addValidator((Object val) -> { if (!val.toString().equals(r.getPropertyValue())) { throw new InvalidValueException(error); } }); } } fields.add(cb); //Set value if already recorded updateValue(cb); layout.addComponent(cb); break; case 4://Attachment Label l = new Label(TRANSLATOR.translate(de.getEntryName())); layout.addComponent(l); break; default: LOG.log(Level.SEVERE, "Unexpected field type: {0}", de.getDataEntryType().getId()); } }); //Add the Attachments HorizontalLayout attachments = new HorizontalLayout(); attachments.setCaption(TRANSLATOR.translate("general.attachment")); HorizontalLayout comments = new HorizontalLayout(); comments.setCaption(TRANSLATOR.translate("general.comments")); HorizontalLayout issues = new HorizontalLayout(); issues.setCaption(TRANSLATOR.translate("general.issue")); int commentCounter = 0; int issueCounter = 0; for (ExecutionStepHasIssue ei : getExecutionStep().getExecutionStepHasIssueList()) { issueCounter++; Button a = new Button("Issue #" + issueCounter); a.setIcon(VaadinIcons.BUG); a.addClickListener((Button.ClickEvent event) -> { displayIssue(new IssueServer(ei.getIssue())); }); a.setEnabled(!step.getLocked()); issues.addComponent(a); } for (ExecutionStepHasAttachment attachment : getExecutionStep().getExecutionStepHasAttachmentList()) { switch (attachment.getAttachment().getAttachmentType().getType()) { case "comment": { //Comments go in a different section commentCounter++; Button a = new Button("Comment #" + commentCounter); a.setIcon(VaadinIcons.CLIPBOARD_TEXT); a.addClickListener((Button.ClickEvent event) -> { if (!step.getLocked()) { //Prompt if user wants this removed MessageBox mb = getDeletionPrompt(attachment); mb.open(); } else { displayComment(new AttachmentServer(attachment.getAttachment().getAttachmentPK())); } }); a.setEnabled(!step.getLocked()); comments.addComponent(a); break; } default: { Button a = new Button(attachment.getAttachment().getFileName()); a.setEnabled(!step.getLocked()); a.setIcon(VaadinIcons.PAPERCLIP); a.addClickListener((Button.ClickEvent event) -> { if (!step.getLocked()) { //Prompt if user wants this removed MessageBox mb = getDeletionPrompt(attachment); mb.open(); } else { displayAttachment(new AttachmentServer(attachment.getAttachment().getAttachmentPK())); } }); attachments.addComponent(a); break; } } } if (attachments.getComponentCount() > 0) { layout.addComponent(attachments); } if (comments.getComponentCount() > 0) { layout.addComponent(comments); } if (issues.getComponentCount() > 0) { layout.addComponent(issues); } //Add the menu HorizontalLayout hl = new HorizontalLayout(); attach = new Button(TRANSLATOR.translate("add.attachment")); attach.setIcon(VaadinIcons.PAPERCLIP); attach.addClickListener((Button.ClickEvent event) -> { //Show dialog to upload file. Window dialog = new VMWindow(TRANSLATOR.translate("attach.file")); VerticalLayout vl = new VerticalLayout(); MultiFileUpload multiFileUpload = new MultiFileUpload() { @Override protected void handleFile(File file, String fileName, String mimeType, long length) { try { LOG.log(Level.FINE, "Received file {1} at: {0}", new Object[] { file.getAbsolutePath(), fileName }); //Process the file //Create the attachment AttachmentServer a = new AttachmentServer(); a.addFile(file, fileName); //Overwrite the default file name set in addFile. It'll be a temporary file name a.setFileName(fileName); a.write2DB(); //Now add it to this Execution Step if (getExecutionStep().getExecutionStepHasAttachmentList() == null) { getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>()); } getExecutionStep().addAttachment(a); getExecutionStep().write2DB(); w.updateCurrentStep(); } catch (Exception ex) { LOG.log(Level.SEVERE, "Error creating attachment!", ex); } } }; multiFileUpload.setCaption(TRANSLATOR.translate("select.files.attach")); vl.addComponent(multiFileUpload); dialog.setContent(vl); dialog.setHeight(25, Sizeable.Unit.PERCENTAGE); dialog.setWidth(25, Sizeable.Unit.PERCENTAGE); ValidationManagerUI.getInstance().addWindow(dialog); }); hl.addComponent(attach); bug = new Button(TRANSLATOR.translate("create.issue")); bug.setIcon(VaadinIcons.BUG); bug.addClickListener((Button.ClickEvent event) -> { displayIssue(new IssueServer()); }); hl.addComponent(bug); comment = new Button(TRANSLATOR.translate("add.comment")); comment.setIcon(VaadinIcons.CLIPBOARD_TEXT); comment.addClickListener((Button.ClickEvent event) -> { AttachmentServer as = new AttachmentServer(); //Get comment type AttachmentType type = AttachmentTypeServer.getTypeForExtension("comment"); as.setAttachmentType(type); displayComment(as); }); hl.addComponent(comment); step.update(); attach.setEnabled(!step.getLocked()); bug.setEnabled(!step.getLocked()); comment.setEnabled(!step.getLocked()); result.setEnabled(!step.getLocked()); layout.addComponent(hl); return layout; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java
License:Apache License
private void displayIssue(IssueServer is) { Panel form = new Panel(TRANSLATOR.translate("general.issue")); FormLayout layout = new FormLayout(); form.setContent(layout); if (is.getIssuePK() == null) { //Set creation date is.setCreationTime(new Date()); }/*from w ww. j a v a 2 s . c o m*/ BeanFieldGroup binder = new BeanFieldGroup(is.getClass()); binder.setItemDataSource(is); Field title = binder.buildAndBind(TRANSLATOR.translate("general.summary"), "title", TextField.class); title.setSizeFull(); layout.addComponent(title); Field desc = binder.buildAndBind(TRANSLATOR.translate("general.description"), "description", TextArea.class); desc.setSizeFull(); layout.addComponent(desc); DateField creation = (DateField) binder.buildAndBind(TRANSLATOR.translate("creation.time"), "creationTime", DateField.class); creation.setReadOnly(true); creation.setDateFormat(VMSettingServer.getSetting("date.format").getStringVal()); creation.setResolution(Resolution.SECOND); layout.addComponent(creation); //Add the result layout.addComponent(issueType); if (is.getIssueType() != null) { issueType.setValue(is.getIssueType().getTypeName()); } //Lock if being created issueType.setReadOnly(is.getIssueType() == null); MessageBox mb = MessageBox.create(); mb.setData(is); mb.asModal(true).withMessage(layout).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> { try { //Create the attachment IssueServer issue = (IssueServer) mb.getData(); issue.setDescription(((TextArea) desc).getValue().trim()); issue.setIssueType((IssueType) issueType.getValue()); issue.setCreationTime(creation.getValue()); issue.setTitle((String) title.getValue()); boolean toAdd = issue.getIssuePK() == null; issue.write2DB(); if (toAdd) { //Now add it to this Execution Step if (getExecutionStep().getExecutionStepHasIssueList() == null) { getExecutionStep().setExecutionStepHasIssueList(new ArrayList<>()); } getExecutionStep().addIssue(issue, ValidationManagerUI.getInstance().getUser()); getExecutionStep().write2DB(); } w.updateCurrentStep(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable()) .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE)); mb.getWindow().setCaption(TRANSLATOR.translate("issue.detail")); mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON); ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> { //Enable if there is a description change. mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty()); }); ((TextField) title).addTextChangeListener((TextChangeEvent event1) -> { //Enable if there is a title change. mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty()); }); mb.open(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.execution.ExecutionWizardStep.java
License:Apache License
private void displayComment(AttachmentServer as) { Panel form = new Panel(TRANSLATOR.translate("general.comment")); FormLayout layout = new FormLayout(); form.setContent(layout); BeanFieldGroup binder = new BeanFieldGroup(as.getClass()); binder.setItemDataSource(as);/*from ww w . j a v a2 s .com*/ Field desc = binder.buildAndBind(TRANSLATOR.translate("general.text"), "textValue", TextArea.class); desc.setSizeFull(); layout.addComponent(desc); MessageBox mb = MessageBox.create(); mb.setData(as); mb.asModal(true).withMessage(desc).withButtonAlignment(Alignment.MIDDLE_CENTER).withOkButton(() -> { try { //Create the attachment AttachmentServer a = (AttachmentServer) mb.getData(); a.setTextValue(((TextArea) desc).getValue().trim()); boolean toAdd = a.getAttachmentPK() == null; a.write2DB(); if (toAdd) { //Now add it to this Execution Step if (getExecutionStep().getExecutionStepHasAttachmentList() == null) { getExecutionStep().setExecutionStepHasAttachmentList(new ArrayList<>()); } getExecutionStep().addAttachment(a); getExecutionStep().write2DB(); } w.updateCurrentStep(); } catch (Exception ex) { LOG.log(Level.SEVERE, null, ex); } }, ButtonOption.focus(), ButtonOption.icon(VaadinIcons.CHECK), ButtonOption.disable()) .withCancelButton(ButtonOption.icon(VaadinIcons.CLOSE)); mb.getWindow().setCaption(TRANSLATOR.translate("enter.comment")); mb.getWindow().setIcon(ValidationManagerUI.SMALL_APP_ICON); ((TextArea) desc).addTextChangeListener((TextChangeEvent event1) -> { //Enable only when there is a comment. mb.getButton(ButtonType.OK).setEnabled(!step.getLocked() && !event1.getText().trim().isEmpty()); }); mb.open(); }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.template.TemplateScreenProvider.java
License:Apache License
@Override public Component getContent() { Panel p = new Panel(); hs.setSplitPosition(30, Sizeable.Unit.PERCENTAGE); hs.setFirstComponent(getLeftComponent()); hs.setSecondComponent(getRightComponent()); hs.setSizeFull();/* w w w . j a v a 2s. co m*/ p.setContent(hs); p.setId(getComponentCaption()); return p; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.template.TemplateScreenProvider.java
License:Apache License
private Component getLeftComponent() { Panel p = new Panel(); VerticalLayout layout = new VerticalLayout(); templates.setNullSelectionAllowed(true); templates.setWidth(100, Sizeable.Unit.PERCENTAGE); BeanItemContainer<Template> container = new BeanItemContainer<>(Template.class, new TemplateJpaController(DataBaseManager.getEntityManagerFactory()).findTemplateEntities()); templates.setContainerDataSource(container); templates.getItemIds().forEach(id -> { Template temp = ((Template) id); templates.setItemCaption(id, TRANSLATOR.translate(temp.getTemplateName())); });// w w w.java 2 s. c om templates.addValueChangeListener(event -> { hs.setSecondComponent(getRightComponent()); }); templates.setNullSelectionAllowed(false); templates.setWidth(100, Sizeable.Unit.PERCENTAGE); layout.addComponent(templates); HorizontalLayout hl = new HorizontalLayout(); Button create = new Button(TRANSLATOR.translate("general.add")); create.addClickListener(listener -> { displayTemplateCreateWizard(); }); hl.addComponent(create); Button copy = new Button(TRANSLATOR.translate("general.copy")); copy.addClickListener(listener -> { displayTemplateCopyWizard(); }); hl.addComponent(copy); Button delete = new Button(TRANSLATOR.translate("general.delete")); delete.addClickListener(listener -> { displayTemplateDeleteWizard(); }); hl.addComponent(delete); templates.addValueChangeListener(listener -> { if (templates.getValue() != null) { Template t = (Template) templates.getValue(); delete.setEnabled(t.getId() >= 1_000); copy.setEnabled(t.getTemplateNodeList().size() > 0); } }); layout.addComponent(hl); layout.setSizeFull(); p.setContent(layout); p.setSizeFull(); return p; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.wizard.plan.DetailStep.java
License:Apache License
@Override public Component getContent() { Panel form = new Panel("execution.detail"); FormLayout layout = new FormLayout(); form.setContent(layout); form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class); binder.setItemDataSource(tce);//from w w w . ja va 2 s . co m TextArea name = new TextArea("general.name"); name.setConverter(new ByteToStringConverter()); binder.bind(name, "name"); layout.addComponent(name); TextArea scope = new TextArea("general.scope"); scope.setConverter(new ByteToStringConverter()); binder.bind(scope, "scope"); layout.addComponent(scope); if (tce.getId() != null) { TextArea conclusion = new TextArea("general.conclusion"); conclusion.setConverter(new ByteToStringConverter()); binder.bind(conclusion, "conclusion"); layout.addComponent(conclusion); conclusion.setSizeFull(); layout.addComponent(conclusion); } binder.setBuffered(false); binder.bindMemberFields(form); form.setSizeFull(); return form; }
From source file:nl.kpmg.lcm.ui.component.DefinedLabel.java
License:Apache License
public DefinedLabel(String title, String content, String tooltip) { // A layout structure used for composition Panel panel = new Panel(); panel.setStyleName("v-panel-borderless"); panel.setWidth("100%"); VerticalLayout panelContent = new VerticalLayout(); panelContent.setMargin(true); // Very useful panelContent.setWidth("100%"); panel.setContent(panelContent); // Compose from multiple components Label titleLabel = new Label(title); titleLabel.setStyleName("v-label-h4"); panelContent.addComponent(titleLabel); Label contentLabel = new Label(content); panelContent.addComponent(contentLabel); // The composition root MUST be set setCompositionRoot(panel);/* ww w . java 2 s. c o m*/ }
From source file:nl.kpmg.lcm.ui.view.administration.TasksPanel.java
License:Apache License
public TasksPanel() { Panel panel = new Panel(); VerticalLayout root = new VerticalLayout(); Panel schedulePanel = new Panel(); VerticalLayout schedulePanelLayout = new VerticalLayout(); scheduleTable = new Table(); scheduleTable.setWidth("100%"); scheduleTable.setHeight("300px"); scheduleTable.addContainerProperty("Name", String.class, null); scheduleTable.addContainerProperty("Cron", String.class, null); scheduleTable.addContainerProperty("Job", String.class, null); scheduleTable.addContainerProperty("Target", String.class, null); Label scheduleLabel = new Label("Schedule"); scheduleLabel.setStyleName("v-label-h2"); schedulePanelLayout.addComponent(scheduleLabel); schedulePanelLayout.addComponent(scheduleTable); schedulePanel.setContent(schedulePanelLayout); Panel tasksPanel = new Panel(); VerticalLayout tasksPanelLayout = new VerticalLayout(); tasksTable = new Table(); tasksTable.setWidth("100%"); tasksTable.addContainerProperty("Job", String.class, null); tasksTable.addContainerProperty("Target", String.class, null); tasksTable.addContainerProperty("Start", Date.class, null); tasksTable.addContainerProperty("End", Date.class, null); tasksTable.addContainerProperty("Status", String.class, null); Label tasksLabel = new Label("Tasks"); tasksLabel.setStyleName("v-label-h2"); tasksPanelLayout.addComponent(tasksLabel); tasksPanelLayout.addComponent(tasksTable); tasksPanel.setContent(tasksPanelLayout); root.addComponent(schedulePanel);/*from w w w.j a v a2s . c om*/ root.addComponent(tasksPanel); root.setSpacing(true); root.setMargin(true); root.setWidth("100%"); panel.setContent(root); setCompositionRoot(panel); }
From source file:org.activiti.editor.ui.EditorProcessDefinitionInfoComponent.java
License:Apache License
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); }/* w w w .jav a 2 s . c om*/ return inStream; } }; } if (streamSource != null) { Embedded embedded = new Embedded(null, new ImageStreamSource(streamSource, ExplorerApp.get())); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars 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); }
From source file:org.activiti.explorer.ui.management.process.ProcessInstanceDetailPanel.java
License:Apache License
protected void addProcessImage() { ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) ((RepositoryServiceImpl) repositoryService) .getDeployedProcessDefinition(processDefinition.getId()); // Only show when graphical notation is defined if (processDefinitionEntity != null && processDefinitionEntity.isGraphicalNotationDefined()) { StreamResource diagram = new ProcessDefinitionImageStreamResourceBuilder() .buildStreamResource(processInstance, repositoryService, runtimeService); if (diagram != null) { Label header = new Label(i18nManager.getMessage(Messages.PROCESS_HEADER_DIAGRAM)); header.addStyleName(ExplorerLayout.STYLE_H3); header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK); header.addStyleName(ExplorerLayout.STYLE_NO_LINE); panelLayout.addComponent(header); Embedded embedded = new Embedded(null, diagram); embedded.setType(Embedded.TYPE_IMAGE); embedded.setSizeUndefined(); Panel imagePanel = new Panel(); // using panel for scrollbars imagePanel.setScrollable(true); imagePanel.addStyleName(Reindeer.PANEL_LIGHT); imagePanel.setWidth(100, UNITS_PERCENTAGE); imagePanel.setHeight(400, UNITS_PIXELS); HorizontalLayout panelLayoutT = new HorizontalLayout(); panelLayoutT.setSizeUndefined(); imagePanel.setContent(panelLayoutT); imagePanel.addComponent(embedded); panelLayout.addComponent(imagePanel); }// w ww .j av a 2 s . c om } }