List of usage examples for com.vaadin.ui TextArea setWordWrap
public void setWordWrap(boolean wordWrap)
From source file:annis.gui.AboutWindow.java
License:Apache License
public AboutWindow() { setSizeFull();// w w w . j a va2 s. co m layout = new VerticalLayout(); setContent(layout); layout.setSizeFull(); layout.setMargin(true); HorizontalLayout hLayout = new HorizontalLayout(); Embedded logoAnnis = new Embedded(); logoAnnis.setSource(new ThemeResource("images/annis-logo-128.png")); logoAnnis.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoAnnis); Embedded logoSfb = new Embedded(); logoSfb.setSource(new ThemeResource("images/sfb-logo.jpg")); logoSfb.setType(Embedded.TYPE_IMAGE); hLayout.addComponent(logoSfb); Link lnkFork = new Link(); lnkFork.setResource(new ExternalResource("https://github.com/korpling/ANNIS")); lnkFork.setIcon( new ExternalResource("https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png")); lnkFork.setTargetName("_blank"); hLayout.addComponent(lnkFork); hLayout.setComponentAlignment(logoAnnis, Alignment.MIDDLE_LEFT); hLayout.setComponentAlignment(logoSfb, Alignment.MIDDLE_RIGHT); hLayout.setComponentAlignment(lnkFork, Alignment.TOP_RIGHT); layout.addComponent(hLayout); layout.addComponent(new Label( "ANNIS is a project of the " + "<a href=\"http://www.sfb632.uni-potsdam.de/\">SFB632</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Homepage: " + "<a href=\"http://corpus-tools.org/annis/\">" + "http://corpus-tools.org/annis/</a>.", Label.CONTENT_XHTML)); layout.addComponent(new Label("Version: " + VersionInfo.getVersion())); layout.addComponent(new Label("Vaadin-Version: " + Version.getFullVersion())); TextArea txtThirdParty = new TextArea(); txtThirdParty.setSizeFull(); StringBuilder sb = new StringBuilder(); sb.append("The ANNIS team wants to thank these third party software that " + "made the ANNIS GUI possible:\n"); File thirdPartyFolder = new File(VaadinService.getCurrent().getBaseDirectory(), "THIRD-PARTY"); if (thirdPartyFolder.isDirectory()) { for (File c : thirdPartyFolder.listFiles((FileFilter) new WildcardFileFilter("*.txt"))) { if (c.isFile()) { try { sb.append(FileUtils.readFileToString(c)).append("\n"); } catch (IOException ex) { log.error("Could not read file", ex); } } } } txtThirdParty.setValue(sb.toString()); txtThirdParty.setReadOnly(true); txtThirdParty.addStyleName("shared-text"); txtThirdParty.setWordwrap(false); layout.addComponent(txtThirdParty); btClose = new Button("Close"); final AboutWindow finalThis = this; btClose.addClickListener(new OkClickListener(finalThis)); layout.addComponent(btClose); layout.setComponentAlignment(hLayout, Alignment.MIDDLE_CENTER); layout.setComponentAlignment(btClose, Alignment.MIDDLE_CENTER); layout.setExpandRatio(txtThirdParty, 1.0f); }
From source file:annis.gui.CitationWindow.java
License:Apache License
public CitationWindow(String query, Set<String> corpora, int contextLeft, int contextRight) { super("Citation"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);/*from w w w.j a v a2 s . co m*/ wLayout.setSizeFull(); String url = Helper.generateCitation(query, corpora, contextLeft, contextRight, null, 0, 10); TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ChameleonTheme.TEXTFIELD_BIG); txtCitation.addStyleName("citation"); txtCitation.setValue(url); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btOk = new Button("OK"); btOk.addListener((Button.ClickListener) this); btOk.setSizeUndefined(); wLayout.addComponent(btOk); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btOk, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("200px"); }
From source file:annis.gui.ShareQueryReferenceWindow.java
License:Apache License
public ShareQueryReferenceWindow(DisplayedResultQuery query, boolean shorten) { super("Query reference link"); VerticalLayout wLayout = new VerticalLayout(); setContent(wLayout);// w w w . ja v a 2 s. co m wLayout.setSizeFull(); wLayout.setMargin(true); Label lblInfo = new Label( "<p style=\"font-size: 18px\" >" + "<strong>Share your query:</strong> " + "1. Copy the generated link 2. Share this link with your peers. " + "</p>", ContentMode.HTML); wLayout.addComponent(lblInfo); wLayout.setExpandRatio(lblInfo, 0.0f); String shortURL = "ERROR"; if (query != null) { URI url = Helper.generateCitation(query.getQuery(), query.getCorpora(), query.getLeftContext(), query.getRightContext(), query.getSegmentation(), query.getBaseText(), query.getOffset(), query.getLimit(), query.getOrder(), query.getSelectedMatches()); if (shorten) { shortURL = Helper.shortenURL(url); } else { shortURL = url.toASCIIString(); } } TextArea txtCitation = new TextArea(); txtCitation.setWidth("100%"); txtCitation.setHeight("100%"); txtCitation.addStyleName(ValoTheme.TEXTFIELD_LARGE); txtCitation.addStyleName("shared-text"); txtCitation.setValue(shortURL); txtCitation.setWordwrap(true); txtCitation.setReadOnly(true); wLayout.addComponent(txtCitation); Button btClose = new Button("Close"); btClose.addClickListener((Button.ClickListener) this); btClose.setSizeUndefined(); wLayout.addComponent(btClose); wLayout.setExpandRatio(txtCitation, 1.0f); wLayout.setComponentAlignment(btClose, Alignment.BOTTOM_CENTER); setWidth("400px"); setHeight("300px"); }
From source file:com.esspl.datagen.ui.ResultView.java
License:Open Source License
public ResultView(final DataGenApplication dataGenApplication, ArrayList<GeneratorBean> rowList) { log.debug("ResultView constructor start"); VerticalLayout layout = (VerticalLayout) this.getContent(); layout.setMargin(false);/*from ww w . ja v a 2s . co m*/ layout.setSpacing(false); layout.setHeight("500px"); layout.setWidth("600px"); Button close = new Button("Close", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Close Button clicked"); dataGenApplication.getMainWindow().removeWindow(event.getButton().getWindow()); } }); close.setIcon(DataGenConstant.CLOSE_ICON); String dataOption = dataGenApplication.generateType.getValue().toString(); Generator genrator = null; if (dataOption.equalsIgnoreCase("xml")) { genrator = new XmlDataGenerator(); } else if (dataOption.equalsIgnoreCase("sql")) { genrator = new SqlDataGenerator(); } else if (dataOption.equalsIgnoreCase("csv")) { genrator = new CsvDataGenerator(); } if (genrator == null) { log.info("ResultView - genrator object is null"); dataGenApplication.getMainWindow().removeWindow(this); return; } //Data generated from respective command class and shown in the modal window final TextArea message = new TextArea(); message.setSizeFull(); message.setHeight("450px"); message.setWordwrap(false); message.setStyleName("noResizeTextArea"); message.setValue(genrator.generate(dataGenApplication, rowList)); layout.addComponent(message); Button copy = new Button("Copy", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Copy Button clicked"); //As on Unix environment, it gives headless exception we need to handle it try { //StringSelection stringSelection = new StringSelection(message.getValue().toString()); Transferable tText = new StringSelection(message.getValue().toString()); Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard(); clipboard.setContents(tText, null); } catch (HeadlessException e) { dataGenApplication.getMainWindow() .showNotification("Due to some problem Text could not be copied."); e.printStackTrace(); } } }); copy.setIcon(DataGenConstant.COPY_ICON); Button execute = new Button("Execute", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Execute Button clicked"); dataGenApplication.tabSheet.setSelectedTab(dataGenApplication.executor); dataGenApplication.executor.setScript(message.getValue().toString()); dataGenApplication.getMainWindow().removeWindow(event.getButton().getWindow()); } }); execute.setIcon(DataGenConstant.EXECUTOR_ICON); Button export = new Button("Export to File", new ClickListener() { public void buttonClick(ClickEvent event) { log.info("ResultView - Export to File Button clicked"); String dataOption = dataGenApplication.generateType.getValue().toString(); DataGenStreamUtil resource = null; try { if (dataOption.equalsIgnoreCase("xml")) { File tempFile = File.createTempFile("tmp", ".xml"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.xml", "text/xml", tempFile); } else if (dataOption.equalsIgnoreCase("csv")) { File tempFile = File.createTempFile("tmp", ".csv"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.csv", "text/csv", tempFile); } else if (dataOption.equalsIgnoreCase("sql")) { File tempFile = File.createTempFile("tmp", ".sql"); BufferedWriter out = new BufferedWriter(new FileWriter(tempFile)); out.write(message.getValue().toString()); out.close(); resource = new DataGenStreamUtil(dataGenApplication, "data.sql", "text/plain", tempFile); } getWindow().open(resource, "_self"); } catch (FileNotFoundException e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } catch (IOException e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } catch (Exception e) { log.info("ResultView - Export to File Error - " + e.getMessage()); e.printStackTrace(); } } }); export.setIcon(DataGenConstant.EXPORT_ICON); HorizontalLayout bttnBar = new HorizontalLayout(); if (dataOption.equalsIgnoreCase("sql")) { bttnBar.addComponent(execute); } bttnBar.addComponent(export); bttnBar.addComponent(copy); bttnBar.addComponent(close); layout.addComponent(bttnBar); layout.setComponentAlignment(bttnBar, Alignment.MIDDLE_CENTER); log.debug("ResultView constructor end"); }
From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.SystemLicence.java
/** * added by chb 20140520/*from w ww. j a v a2 s . c o m*/ * @return */ private VerticalLayout updateLicenseComponent() { VerticalLayout licenseUpdateLayout = new VerticalLayout(); final VerticalLayout textAreaPlaceHolder = new VerticalLayout(); final HorizontalLayout buttonPlaceHolder = new HorizontalLayout(); buttonPlaceHolder.setSpacing(true); // final Button updateButton = new Button("License"); updateButton.setData("show"); // final Button cancelButton = new Button("?"); // final TextArea licenseTextArea = new TextArea(); licenseTextArea.setColumns(30); licenseTextArea.setRows(5); licenseTextArea.setWordwrap(true); licenseTextArea.setInputPrompt("??"); //Layout buttonPlaceHolder.addComponent(updateButton); licenseUpdateLayout.addComponent(textAreaPlaceHolder); licenseUpdateLayout.addComponent(buttonPlaceHolder); // cancelButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { textAreaPlaceHolder.removeAllComponents(); buttonPlaceHolder.removeComponent(cancelButton); updateButton.setData("show"); updateButton.setCaption("License"); } }); updateButton.addListener(new Button.ClickListener() { @Override public void buttonClick(ClickEvent event) { if (((String) event.getButton().getData()).equals("show")) { textAreaPlaceHolder.removeAllComponents(); textAreaPlaceHolder.addComponent(licenseTextArea); buttonPlaceHolder.addComponent(cancelButton); event.getButton().setData("updateAndHide"); event.getButton().setCaption("??"); } else if (((String) event.getButton().getData()).equals("updateAndHide")) { StringReader stringReader = new StringReader( StringUtils.trimToEmpty((String) licenseTextArea.getValue())); Properties props = new Properties(); try { props.load(stringReader); } catch (IOException e) { e.printStackTrace(); } stringReader.close(); // Boolean isValidvalidateLicense(licenseTextArea.getValue()); String license_date = props.getProperty(LicenseManager.LICENSE_DATE); String license_count = props.getProperty(LicenseManager.LICENSE_COUNT); String license_localmd5 = props.getProperty(LicenseManager.LICENSE_LOCALMD5); // Boolean isMatch = regexMatchCheck(license_date, license_count, license_localmd5); if (isMatch) { Map<String, String> licenseMap = new HashMap<String, String>(); //?? // String license_count = (String)props.get(LicenseManager.LICENSE_COUNT); license_count = license_count == null ? "" : license_count; licenseMap.put(LicenseManager.LICENSE_COUNT, license_count); //? // String license_date = (String)props.get(LicenseManager.LICENSE_DATE); license_date = license_date == null ? "" : license_date; licenseMap.put(LicenseManager.LICENSE_DATE, license_date); //??? // String license_localmd5 = (String)props.get(LicenseManager.LICENSE_LOCALMD5); license_localmd5 = license_localmd5 == null ? "" : license_localmd5; licenseMap.put(LicenseManager.LICENSE_LOCALMD5, license_localmd5); //?License Map<String, String> resultMap = LicenseManager.licenseValidate(licenseMap); String validateResult = resultMap.get(LicenseManager.LICENSE_VALIDATE_RESULT); if (LicenseManager.LICENSE_VALID.equals(validateResult)) { //continue } else { NotificationUtil.showWarningNotification(SystemLicence.this, "License ?License"); return; } try { URL resourceurl = SystemLicence.class.getResource(LicenseManager.LICENSE_FILE); //System.err.println("chb: SystemLicense"+resourceurl.getPath()); OutputStream fos = new FileOutputStream(resourceurl.getPath()); props.store(fos, "license"); } catch (Exception e) { e.printStackTrace(); NotificationUtil.showWarningNotification(SystemLicence.this, "License "); return; } textAreaPlaceHolder.removeAllComponents(); buttonPlaceHolder.removeComponent(cancelButton); updateButton.setData("show"); updateButton.setCaption("License"); LicenseManager.loadLicenseFile(LicenseManager.LICENSE_FILE.substring(1)); // LicenseManager.loadLicenseFile(licenseFilename) refreshLicenseInfo(); NotificationUtil.showWarningNotification(SystemLicence.this, "License ?,?"); } else { NotificationUtil.showWarningNotification(SystemLicence.this, "License ??"); } } } /** * license ? * @param license_date * @param license_count * @param license_localmd5 * @return */ private Boolean regexMatchCheck(String license_date, String license_count, String license_localmd5) { if (StringUtils.isEmpty(license_date) || StringUtils.isEmpty(license_count) || StringUtils.isEmpty(license_localmd5)) { return false; } String date_regex = "^\\d{4}-\\d{2}-\\d{2}\\s\\d{2}:\\d{2}:\\d{2}$"; //? String count_regex = "^\\d+$"; //? String md5_32_regex = "^\\w{32}$"; //? return license_localmd5.matches(md5_32_regex) && license_date.matches(date_regex) && license_count.matches(count_regex); } }); return licenseUpdateLayout; }
From source file:com.salsaw.msalsa.PhylogeneticTreeView.java
License:Apache License
public PhylogeneticTreeView(ClustalFileMapper clustalFileMapper) throws IOException { initializeUiComponents();/*w w w . ja v a 2 s. c o m*/ // Download alignment file Button aligmentButton = new Button("Download alignment"); Resource resAlignment = new FileResource(new File(clustalFileMapper.getAlignmentFilePath())); FileDownloader fdAln = new FileDownloader(resAlignment); fdAln.extend(aligmentButton); mainLayout.addComponent(aligmentButton); mainLayout.setComponentAlignment(aligmentButton, Alignment.MIDDLE_CENTER); // Download tree file Button downloadTreeButton = new Button("Download phylogentic tree"); Resource resTree = new FileResource(new File(clustalFileMapper.getTreeFilePath())); FileDownloader fdTree = new FileDownloader(resTree); fdTree.extend(downloadTreeButton); mainLayout.addComponent(downloadTreeButton); mainLayout.setComponentAlignment(downloadTreeButton, Alignment.MIDDLE_CENTER); // Add and center with HTML div svgHTMLPhylogenticTree = new Label("<div id='svgCanvas'></div>", ContentMode.HTML); svgHTMLPhylogenticTree.setWidth("-1px"); svgHTMLPhylogenticTree.setHeight("-1px"); mainLayout.addComponent(svgHTMLPhylogenticTree); mainLayout.setComponentAlignment(svgHTMLPhylogenticTree, Alignment.MIDDLE_CENTER); // Add tab with aligment content String aligmentFileContent = new String( Files.readAllBytes(Paths.get(clustalFileMapper.getAlignmentFilePath()))); TextArea aligmentFileTextArea = new TextArea("M-SALSA Aligment"); aligmentFileTextArea.setWordwrap(false); aligmentFileTextArea.setValue(aligmentFileContent); aligmentFileTextArea.setWidth("100%"); aligmentFileTextArea.setHeight("100%"); mainLayout.addComponent(aligmentFileTextArea); mainLayout.setComponentAlignment(aligmentFileTextArea, Alignment.MIDDLE_CENTER); // Add JavaScript component to generate phylogentic tree JsPhyloSVG jsPhyloSVG = new JsPhyloSVG(getPhylogeneticTreeFileContent(clustalFileMapper)); mainLayout.addComponent(jsPhyloSVG); setCompositionRoot(mainLayout); }
From source file:de.kaiserpfalzEdv.vaadin.ui.defaultviews.editor.impl.BaseEditorImpl.java
License:Apache License
protected TextArea createTextArea(final String caption, final int tabIndex, final int rows) { TextArea result = new TextArea(presenter.translate(caption)); result.setTabIndex(tabIndex);//w ww . ja v a2s . com result.setWidth(100f, PERCENTAGE); result.setRows(rows); result.setWordwrap(true); result.setNullRepresentation(""); return result; }
From source file:net.sourceforge.javydreamercsw.validation.manager.web.notification.NotificationScreenProvider.java
License:Apache License
@Override public Component getContent() { VerticalLayout vs = new VerticalLayout(); //On top put a list of notifications BeanItemContainer<Notification> container = new BeanItemContainer<>(Notification.class); ValidationManagerUI.getInstance().getUser().getNotificationList().forEach(n -> { container.addBean(n);//from www. jav a2s .com }); // Unable to use VerticalSplitPanel as I hoped. // See: https://github.com/vaadin/framework/issues/9460 // VerticalSplitPanel vs = new VerticalSplitPanel(); // vs.setSplitPosition(25, Sizeable.Unit.PERCENTAGE); TextArea text = new TextArea(TRANSLATOR.translate("general.text")); text.setWordwrap(true); text.setReadOnly(true); text.setSizeFull(); Grid grid = new Grid(TRANSLATOR.translate("general.notifications"), container); grid.setColumns("notificationType", "author", "creationDate", "archieved"); if (container.size() > 0) { grid.setHeightMode(HeightMode.ROW); grid.setHeightByRows(container.size() > 5 ? 5 : container.size()); } GridCellFilter filter = new GridCellFilter(grid); filter.setBooleanFilter("archieved", new GridCellFilter.BooleanRepresentation(VaadinIcons.CHECK, TRANSLATOR.translate("general.yes")), new GridCellFilter.BooleanRepresentation(VaadinIcons.CLOSE, TRANSLATOR.translate("general.no"))); filter.setDateFilter("creationDate", new SimpleDateFormat(VMSettingServer.getSetting("date.format").getStringVal()), true); grid.sort("creationDate"); Column nt = grid.getColumn("notificationType"); nt.setHeaderCaption(TRANSLATOR.translate("notification.type")); nt.setConverter(new Converter<String, NotificationType>() { @Override public NotificationType convertToModel(String value, Class<? extends NotificationType> targetType, Locale locale) throws Converter.ConversionException { for (NotificationType n : new NotificationTypeJpaController( DataBaseManager.getEntityManagerFactory()).findNotificationTypeEntities()) { if (Lookup.getDefault().lookup(InternationalizationProvider.class).translate(n.getTypeName()) .equals(value)) { return n; } } return null; } @Override public String convertToPresentation(NotificationType value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException { return Lookup.getDefault().lookup(InternationalizationProvider.class) .translate(value.getTypeName()); } @Override public Class<NotificationType> getModelType() { return NotificationType.class; } @Override public Class<String> getPresentationType() { return String.class; } }); Column author = grid.getColumn("author"); author.setConverter(new UserToStringConverter()); author.setHeaderCaption(TRANSLATOR.translate("notification.author")); Column creation = grid.getColumn("creationDate"); creation.setHeaderCaption(TRANSLATOR.translate("creation.time")); Column archive = grid.getColumn("archieved"); archive.setHeaderCaption(TRANSLATOR.translate("general.archived")); archive.setConverter(new Converter<String, Boolean>() { @Override public Boolean convertToModel(String value, Class<? extends Boolean> targetType, Locale locale) throws Converter.ConversionException { return value.equals(TRANSLATOR.translate("general.yes")); } @Override public String convertToPresentation(Boolean value, Class<? extends String> targetType, Locale locale) throws Converter.ConversionException { return value ? TRANSLATOR.translate("general.yes") : TRANSLATOR.translate("general.no"); } @Override public Class<Boolean> getModelType() { return Boolean.class; } @Override public Class<String> getPresentationType() { return String.class; } }); grid.setSelectionMode(SelectionMode.SINGLE); grid.setSizeFull(); ContextMenu menu = new ContextMenu(grid, true); menu.addItem(TRANSLATOR.translate("notification.mark.unread"), (MenuItem selectedItem) -> { Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { NotificationServer ns = new NotificationServer((Notification) selected); ns.setAcknowledgeDate(null); try { ns.write2DB(); ((VMUI) UI.getCurrent()).updateScreen(); ((VMUI) UI.getCurrent()).showTab(getComponentCaption()); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } }); menu.addItem(TRANSLATOR.translate("notification.archive"), (MenuItem selectedItem) -> { Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { NotificationServer ns = new NotificationServer((Notification) selected); ns.setArchieved(true); try { ns.write2DB(); ((VMUI) UI.getCurrent()).updateScreen(); ((VMUI) UI.getCurrent()).showTab(getComponentCaption()); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } }); grid.addSelectionListener(selectionEvent -> { // Get selection from the selection model Object selected = ((SingleSelectionModel) grid.getSelectionModel()).getSelectedRow(); if (selected != null) { text.setReadOnly(false); Notification n = (Notification) selected; text.setValue(n.getContent()); text.setReadOnly(true); if (n.getAcknowledgeDate() != null) { try { //Mark as read NotificationServer ns = new NotificationServer((Notification) n); ns.setAcknowledgeDate(new Date()); ns.write2DB(); } catch (VMException ex) { LOG.log(Level.SEVERE, null, ex); } } } }); vs.addComponent(grid); vs.addComponent(text); vs.setSizeFull(); vs.setId(getComponentCaption()); return vs; }
From source file:nz.co.senanque.workflowui.FieldGroupWizard.java
License:Apache License
@SuppressWarnings("serial") public void load(final WorkflowForm form) { ProcessDefinition processDefinition = form.getProcessDefinition(); String task = processDefinition.getTask(form.getProcessInstance().getTaskId()).toString(); ProcessDefinition ownerProcessDefinition = processDefinition; while (processDefinition != null) { ownerProcessDefinition = processDefinition; processDefinition = processDefinition.getOwnerProcess(); }/* w ww .j a va2 s . c o m*/ setCaption(m_messageSourceAccessor.getMessage("form.wizard.caption", new Object[] { new Long(form.getProcessInstance().getId()), ownerProcessDefinition.getName(), form.getProcessInstance().getReference(), ownerProcessDefinition.getDescription() })); formPanel.removeAllComponents(); formPanel.addComponent((VerticalLayout) form); ProcessInstance processInstance = form.getProcessInstance(); if (!form.isReadOnly()) { PermissionManager pm = m_maduraSessionManager.getPermissionManager(); processInstance = getWorkflowClient().lockProcessInstance(form.getProcessInstance(), pm.hasPermission(FixedPermissions.TECHSUPPORT), pm.getCurrentUser()); if (processInstance == null) { com.vaadin.ui.Notification.show(m_messageSourceAccessor.getMessage("failed.to.get.lock"), m_messageSourceAccessor.getMessage("message.noop"), com.vaadin.ui.Notification.Type.HUMANIZED_MESSAGE); return; } } form.setProcessInstance(processInstance); // This is binding the process instance associated with the form to the workflow validation session. // log.debug("Binding {} to Validation engine {}",processInstance.getClass().getSimpleName(),getMaduraSessionManager().getValidationEngine().getIdentifier()); getMaduraSessionManager().getValidationSession().bind(form.getProcessInstance()); ((VerticalLayout) form).addListener(new Listener() { @Override public void componentEvent(Event event) { close(); fireEvent(event); } }); formPanel.markAsDirty(); BeanItem<ProcessInstance> beanItem = new BeanItem<ProcessInstance>(form.getProcessInstance()); m_maduraFieldGroup = m_maduraSessionManager.createMaduraFieldGroup(); Button attachments = m_maduraFieldGroup.createButton("attachments", new ClickListener() { @Override public void buttonClick(ClickEvent event) { m_attachmentsPopup.load(form.getProcessInstance().getId()); } }); Map<String, Field<?>> fields = m_maduraFieldGroup.buildAndBind(new String[] { "queueName", "bundleName", "status", "reference", "lastUpdated", "lockedBy", "comment" }, beanItem); TextArea comment = (TextArea) fields.get("comment"); comment.setRows(2); comment.setWordwrap(true); comment.setWidth("700px"); TextArea taskField = new TextArea(); taskField.setRows(2); taskField.setWordwrap(true); taskField.setWidth("700px"); taskField.setValue(task); taskField.setReadOnly(true); processPanel.removeAllComponents(); processPanel.setMargin(true); processPanel.setSpacing(true); HorizontalLayout processPanelHorizontal = new HorizontalLayout(); processPanelHorizontal.setSpacing(true); processPanel.addComponent(processPanelHorizontal); VerticalLayout processPanelColumn1 = new VerticalLayout(); VerticalLayout processPanelColumn2 = new VerticalLayout(); VerticalLayout processPanelColumn3 = new VerticalLayout(); processPanelHorizontal.addComponent(processPanelColumn1); processPanelHorizontal.addComponent(processPanelColumn2); processPanelHorizontal.addComponent(processPanelColumn3); processPanelColumn1.addComponent(fields.get("queueName")); processPanelColumn1.addComponent(fields.get("bundleName")); processPanelColumn2.addComponent(fields.get("reference")); processPanelColumn2.addComponent(fields.get("lastUpdated")); processPanelColumn3.addComponent(fields.get("lockedBy")); processPanelColumn3.addComponent(fields.get("status")); processPanel.addComponent(comment); processPanel.addComponent(taskField); m_maduraSessionManager.updateOtherFields(null); m_maduraFieldGroup.setReadOnly(form.isReadOnly()); processPanel.addComponent(attachments); processPanel.markAsDirty(); auditPanel.removeAllComponents(); m_audits.setup(form.getProcessInstance()); auditPanel.addComponent(m_audits); if (getParent() == null) { UI.getCurrent().addWindow(this); this.center(); } }
From source file:nz.co.senanque.workflowui.WorkflowUIHints.java
License:Apache License
public AbstractField<?> getTextField(MaduraPropertyWrapper property) { AbstractTextField ret = null;//from w w w . j av a 2 s . c o m if (property.isSecret()) { ret = new PasswordField(); } else { if ("comment".equals(property.getName())) { TextArea textArea = new TextArea(); textArea.setRows(5); textArea.setWordwrap(true); textArea.setWidth("400px"); ret = textArea; } else { ret = new TextField(); } } ret.setMaxLength(property.getMaxLength()); if (property.getValue() == null) { property.setValue(""); } return ret; }