List of usage examples for com.vaadin.ui Panel addStyleName
@Override public void addStyleName(String style)
From source file:it.vige.greenarea.bpm.custom.ui.LoginPanel.java
License:Apache License
private void addInputField() { VerticalLayout layout = new VerticalLayout(); layout.setSpacing(true);//from ww w .j a v a 2 s. c o m layout.setWidth(100, UNITS_PERCENTAGE); loginPanel.addComponent(layout); Panel textFieldPanel = new Panel(); // Hack: actionHandlers can only be // attached to panels or windows textFieldPanel.addStyleName(PANEL_LIGHT); textFieldPanel.setContent(new VerticalLayout()); textFieldPanel.setWidth(100, UNITS_PERCENTAGE); layout.addComponent(textFieldPanel); layout.setExpandRatio(textFieldPanel, 1.0f); Label labelUserName = new Label(i18nManager.getMessage(USER_NAME_TITLE)); labelUserName.addStyleName(LABEL_SMALL); userNameInputField = new TextField(); userNameInputField.setWidth(100, UNITS_PERCENTAGE); Label labelPassword = new Label(i18nManager.getMessage(PASSWORD_TITLE)); labelPassword.addStyleName(LABEL_SMALL); passwordInputField = new PasswordField(); passwordInputField.setWidth(100, UNITS_PERCENTAGE); textFieldPanel.addComponent(labelUserName); textFieldPanel.addComponent(userNameInputField); textFieldPanel.addComponent(labelPassword); textFieldPanel.addComponent(passwordInputField); // Hack to catch keyboard 'enter' textFieldPanel.addActionHandler(new Handler() { private static final long serialVersionUID = 6928598745792215505L; public void handleAction(Action action, Object sender, Object target) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } public Action[] getActions(Object target, Object sender) { return new Action[] { new ShortcutAction("enter", ENTER, null) }; } }); Button loginButton = new Button(i18nManager.getMessage(LOGIN)); layout.addComponent(loginButton); layout.setComponentAlignment(loginButton, MIDDLE_LEFT); loginButton.addListener(new ClickListener() { private static final long serialVersionUID = 7781253151592188006L; public void buttonClick(ClickEvent event) { login(userNameInputField.getValue().toString(), passwordInputField.getValue().toString()); } }); }
From source file:jp.primecloud.auto.ui.MainView.java
License:Open Source License
@Override public void attach() { setSizeFull();/*ww w . j a va 2 s . c o m*/ addStyleName("mycloud-panel"); setMargin(false); setSpacing(false); // ??? topBar = new TopBar(this); addComponent(topBar); // ??? CssLayout topLayout = new CssLayout(); topLayout.setWidth("100%"); topLayout.setHeight("28px"); topLayout.addStyleName("mycloud-name"); topLayout.setMargin(true); addComponent(topLayout); // myCloud?? myCloudField = new TextField(); myCloudField.setWidth("80%"); myCloudField.addStyleName("mycloud-label"); myCloudField.setEnabled(false); myCloudField.setReadOnly(true); topLayout.addComponent(myCloudField); // Reload reloadButton = new Button(ViewProperties.getCaption("button.reload")); reloadButton.setDescription(ViewProperties.getCaption("description.reload")); reloadButton.addStyleName("sync-button"); reloadButton.addStyleName("borderless"); reloadButton.setIcon(Icons.SYNC.resource()); reloadButton.setEnabled(false); reloadButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { refresh(); } }); topLayout.addComponent(reloadButton); // myCloud VerticalLayout mainLayout = new VerticalLayout(); mainLayout.setSizeFull(); mainLayout.setSpacing(false); mainLayout.setMargin(false); Panel mainPanel = new Panel(mainLayout); mainPanel.setSizeFull(); mainPanel.addStyleName(Reindeer.PANEL_LIGHT); addComponent(mainPanel); setExpandRatio(mainPanel, 100); // tab = new TabSheet(); tab.setSizeFull(); tab.setEnabled(false); tab.addStyleName(Reindeer.TABSHEET_BORDERLESS); mainLayout.addComponent(tab); mainLayout.setExpandRatio(tab, 100); // String enableService = Config.getProperty("ui.enableService"); if (enableService == null || BooleanUtils.toBoolean(enableService)) { servicePanel = new ServicePanel(this); tab.addTab(servicePanel, ViewProperties.getCaption("tab.service"), Icons.SERVICETAB.resource()); } // ? serverPanel = new ServerPanel(this); tab.addTab(serverPanel, ViewProperties.getCaption("tab.server"), Icons.SERVERTAB.resource()); // ? String enableLoadBalancer = Config.getProperty("ui.enableLoadBalancer"); if (enableLoadBalancer == null || BooleanUtils.toBoolean(enableLoadBalancer)) { loadBalancerPanel = new LoadBalancerPanel(this); tab.addTab(loadBalancerPanel, ViewProperties.getCaption("tab.loadbalancer"), Icons.LOADBALANCER_TAB.resource()); } // ??????? tab.addListener(new SelectedTabChangeListener() { @Override public void selectedTabChange(SelectedTabChangeEvent event) { MainView.this.selectedTabChange(event); } }); // ? Refresher timer = new Refresher(); timer.setRefreshInterval(15 * 1000); //(msec) timer.addListener(new Refresher.RefreshListener() { @Override public void refresh(Refresher source) { if (needsRefresh()) { refreshTableOnly(); } } }); mainLayout.addComponent(timer); // ? showLogin(); }
From source file:module.contents.presentationTier.component.PageView.java
License:Open Source License
@Override public void attach() { super.attach(); final Panel layout = new Panel(); final SpacingHandler content = (SpacingHandler) layout.getContent(); content.setSpacing(true);//from ww w .j av a2 s . co m final MarginHandler marginHandler = (MarginHandler) layout.getContent(); marginHandler.setMargin(new MarginInfo(false)); setCompositionRoot(layout); layout.setHeight(500, UNITS_PIXELS); layout.addStyleName(BennuTheme.PANEL_LIGHT); final Label title = new Label("<h2>" + page.getTitle().getContent() + "</h2>", Label.CONTENT_XHTML); title.setSizeFull(); layout.addComponent(title); final PageIndex pageIndex = new PageIndex(); layout.addComponent(pageIndex); final PageContent pageContent = new PageContent(); layout.addComponent(pageContent); if (scrolledSection != null) { scrollIntoSection(scrolledSection.getExternalId()); } /* * renderPageMenuArea(horizontalSplitPanel); * renderPageContent(horizontalSplitPanel); */ }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getSotisFrontPage() { GridSystemLayout layout = new GridSystemLayout(12); Label title = new Label( "O <strong>SOTIS</strong> o Repositrio Institucional do Instituto Superior Tcnico.", Label.CONTENT_XHTML); title.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("title", 12, title); Label description = new Label( "Aqui poder encontrar artigos publicados em <a href=\"\">Revistas</a>, <a href=\"\">Conferncias</a>, <a href=\"\">Livros</a>, <a href=\"\">Manuais</a> e <a href=\"\">Outros</a>, categorizados por <a href=\"\">Unidades de Investigao</a> e <a href=\"\">Unidades Acadmicas</a>.", Label.CONTENT_XHTML); description.addStyleName(BennuTheme.LABEL_BIG); layout.setCell("description", 12, description); VerticalLayout searchPanel = new VerticalLayout(); layout.setCell("search", 2, 8, 2, searchPanel); searchPanel.addStyleName("big"); searchPanel.addStyleName("inset"); searchPanel.setMargin(true);// w w w . j a v a 2s . c om searchPanel.setSpacing(true); HorizontalLayout searchForm = new HorizontalLayout(); searchPanel.addComponent(searchForm); searchForm.setSpacing(true); searchForm.setWidth("100%"); TextField searchText = new TextField(); searchForm.addComponent(searchText); searchText.setInputPrompt("Introduza o termo a pesquisar"); searchText.setWidth("100%"); Button searchSubmit = new Button("Pesquisar"); searchForm.addComponent(searchSubmit); searchSubmit.addStyleName(BennuTheme.BUTTON_DEFAULT); searchForm.setExpandRatio(searchText, 1f); Link advanced = new Link("advanced search", null); searchPanel.addComponent(advanced); Panel browseByType = new Panel("Publicaes por Tipo"); browseByType.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("type", 4, browseByType); Panel browseByDept = new Panel("Publicaes por Departamento"); browseByDept.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("dept", 4, browseByDept); Panel contacts = new Panel("Contactos"); contacts.addStyleName(BennuTheme.PANEL_LIGHT); layout.setCell("contacts", 4, contacts); return layout; }
From source file:module.pandabox.presentation.PandaBox.java
License:Open Source License
private Layout getPanelPreviews() { Layout grid = getPreviewLayout("Panels"); Panel panel = new DemoPanel("Panel"); panel.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(panel);/*from w ww . j a v a 2s .c om*/ panel = new DemoPanel(); grid.addComponent(panel); panel = new DemoPanel("Borderless Panel"); panel.setStyleName(BennuTheme.PANEL_BORDERLESS); grid.addComponent(panel); panel = new DemoPanel(); panel.setStyleName(BennuTheme.PANEL_BORDERLESS); grid.addComponent(panel); panel = new DemoPanel("Light panel"); panel.setStyleName(BennuTheme.PANEL_LIGHT); panel.setIcon(new ThemeResource("../runo/icons/16/document.png")); grid.addComponent(panel); panel = new DemoPanel(); panel.setStyleName(BennuTheme.PANEL_LIGHT); grid.addComponent(panel); panel = new DemoPanel("Borderless Light"); panel.addStyleName(BennuTheme.PANEL_BORDERLESS); panel.addStyleName(BennuTheme.PANEL_LIGHT); grid.addComponent(panel); panel = new DemoPanel(); panel.addStyleName(BennuTheme.PANEL_BORDERLESS); panel.addStyleName(BennuTheme.PANEL_LIGHT); grid.addComponent(panel); return grid; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.admin.AdminScreenProvider.java
License:Apache License
private Component displaySetting(VmSetting s, boolean edit) { Panel form = new Panel(TRANSLATOR.translate("setting.detail")); FormLayout layout = new FormLayout(); form.setContent(layout);//from w ww . j av a 2 s. com form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(s.getClass()); binder.setItemDataSource(s); Field<?> id = (TextField) binder.buildAndBind(TRANSLATOR.translate("general.setting"), "setting"); layout.addComponent(id); Field bool = binder.buildAndBind(TRANSLATOR.translate("bool.value"), "boolVal"); bool.setSizeFull(); layout.addComponent(bool); Field integerVal = binder.buildAndBind(TRANSLATOR.translate("int.value"), "intVal"); integerVal.setSizeFull(); layout.addComponent(integerVal); Field longVal = binder.buildAndBind(TRANSLATOR.translate("long.val"), "longVal"); longVal.setSizeFull(); layout.addComponent(longVal); Field stringVal = binder.buildAndBind(TRANSLATOR.translate("string.val"), "stringVal", TextArea.class); stringVal.setSizeFull(); layout.addComponent(stringVal); Button cancel = new Button(TRANSLATOR.translate("general.cancel")); cancel.addClickListener((Button.ClickEvent event) -> { binder.discard(); }); //Editing existing one Button update = new Button(TRANSLATOR.translate("general.update")); update.addClickListener((Button.ClickEvent event) -> { try { binder.commit(); displaySetting(s); } catch (FieldGroup.CommitException ex) { LOG.log(Level.SEVERE, null, ex); Notification.show(TRANSLATOR.translate("general.error.record.update"), ex.getLocalizedMessage(), Notification.Type.ERROR_MESSAGE); } }); boolean blocked = !s.getSetting().startsWith("version."); if (blocked) { HorizontalLayout hl = new HorizontalLayout(); hl.addComponent(update); hl.addComponent(cancel); layout.addComponent(hl); } binder.setBuffered(true); binder.setReadOnly(edit); binder.bindMemberFields(form); //The version settigns are not modifiable from the GUI binder.setEnabled(blocked); //Id is always blocked. id.setEnabled(false); form.setSizeFull(); return form; }
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()); }/*from w ww .j a va2 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.wizard.plan.DetailStep.java
License:Apache License
@Override public Component getContent() { Panel form = new Panel("execution.detail"); FormLayout layout = new FormLayout(); form.setContent(layout);//from www .j a v a 2 s. co m form.addStyleName(ValoTheme.FORMLAYOUT_LIGHT); BeanFieldGroup binder = new BeanFieldGroup(TestCaseExecution.class); binder.setItemDataSource(tce); 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: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); }/*from w w w . j a v a 2s . co m*/ 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); }/*from w ww . j av a 2s .c o m*/ } }