List of usage examples for com.vaadin.ui TextArea setRows
public void setRows(int rows)
From source file:annis.gui.admin.PopupTwinColumnSelectMultiline.java
License:Apache License
@Override protected AbstractTextField createTextField() { TextArea text = new TextArea(); text.setRows(5); return text;/*from ww w . j av a 2s . c om*/ }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
/** * Produces a TextArea field.//from w w w . j a v a2s. co m * * @param inputPrompt * Field's prompt message. * @param caption * Field's caption. * @param rows * How much rows. * @param columns * How much columns. * @return Produced field. */ public static TextArea createTextArea(String inputPrompt, String caption, int rows, int columns) { ResourceBundle bundle = Beans.getReference(ResourceBundle.class); TextArea field = new TextArea(); field.setNullRepresentation(""); field.setRows(rows); field.setColumns(columns); setBasicProperties(field, caption); if (Strings.isResourceBundleKeyFormat(inputPrompt)) { field.setInputPrompt(bundle.getString(Strings.removeBraces(inputPrompt))); } else { field.setInputPrompt(inputPrompt); } return field; }
From source file:com.cavisson.gui.dashboard.components.controls.Forms.java
License:Apache License
public Forms() { setSpacing(true);//w w w .j av a2 s.c o m setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Montly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.etest.valo.Forms.java
License:Apache License
public Forms() { setSpacing(true);// w w w . ja v a 2s. c o m setMargin(true); Label title = new Label("Forms"); title.addStyleName("h1"); addComponent(title); final FormLayout form = new FormLayout(); form.setMargin(false); form.setWidth("800px"); form.addStyleName("light"); addComponent(form); Label section = new Label("Personal Info"); section.addStyleName("h2"); section.addStyleName("colored"); form.addComponent(section); StringGenerator sg = new StringGenerator(); TextField name = new TextField("Name"); name.setValue(sg.nextString(true) + " " + sg.nextString(true)); name.setWidth("50%"); form.addComponent(name); DateField birthday = new DateField("Birthday"); birthday.setValue(new Date(80, 0, 31)); form.addComponent(birthday); TextField username = new TextField("Username"); username.setValue(sg.nextString(false) + sg.nextString(false)); username.setRequired(true); form.addComponent(username); OptionGroup sex = new OptionGroup("Sex"); sex.addItem("Female"); sex.addItem("Male"); sex.select("Male"); sex.addStyleName("horizontal"); form.addComponent(sex); section = new Label("Contact Info"); section.addStyleName("h3"); section.addStyleName("colored"); form.addComponent(section); TextField email = new TextField("Email"); email.setValue(sg.nextString(false) + "@" + sg.nextString(false) + ".com"); email.setWidth("50%"); email.setRequired(true); form.addComponent(email); TextField location = new TextField("Location"); location.setValue(sg.nextString(true) + ", " + sg.nextString(true)); location.setWidth("50%"); location.setComponentError(new UserError("This address doesn't exist")); form.addComponent(location); TextField phone = new TextField("Phone"); phone.setWidth("50%"); form.addComponent(phone); HorizontalLayout wrap = new HorizontalLayout(); wrap.setSpacing(true); wrap.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); wrap.setCaption("Newsletter"); CheckBox newsletter = new CheckBox("Subscribe to newsletter", true); wrap.addComponent(newsletter); ComboBox period = new ComboBox(); period.setTextInputAllowed(false); period.addItem("Daily"); period.addItem("Weekly"); period.addItem("Monthly"); period.setNullSelectionAllowed(false); period.select("Weekly"); period.addStyleName("small"); period.setWidth("10em"); wrap.addComponent(period); form.addComponent(wrap); section = new Label("Additional Info"); section.addStyleName("h4"); section.addStyleName("colored"); form.addComponent(section); TextField website = new TextField("Website"); website.setInputPrompt("http://"); website.setWidth("100%"); form.addComponent(website); TextArea shortbio = new TextArea("Short Bio"); shortbio.setValue( "Quis aute iure reprehenderit in voluptate velit esse. Cras mattis iudicium purus sit amet fermentum."); shortbio.setWidth("100%"); shortbio.setRows(2); form.addComponent(shortbio); final RichTextArea bio = new RichTextArea("Bio"); bio.setWidth("100%"); bio.setValue( "<div><p><span>Integer legentibus erat a ante historiarum dapibus.</span> <span>Vivamus sagittis lacus vel augue laoreet rutrum faucibus.</span> <span>A communi observantia non est recedendum.</span> <span>Morbi fringilla convallis sapien, id pulvinar odio volutpat.</span> <span>Ab illo tempore, ab est sed immemorabili.</span> <span>Quam temere in vitiis, legem sancimus haerentia.</span></p><p><span>Morbi odio eros, volutpat ut pharetra vitae, lobortis sed nibh.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Cum sociis natoque penatibus et magnis dis parturient.</span> <span>Quam diu etiam furor iste tuus nos eludet?</span> <span>Tityre, tu patulae recubans sub tegmine fagi dolor.</span></p><p><span>Curabitur blandit tempus ardua ridiculus sed magna.</span> <span>Phasellus laoreet lorem vel dolor tempus vehicula.</span> <span>Etiam habebis sem dicantur magna mollis euismod.</span> <span>Hi omnes lingua, institutis, legibus inter se differunt.</span></p></div>"); form.addComponent(bio); form.setReadOnly(true); bio.setReadOnly(true); Button edit = new Button("Edit", new ClickListener() { @Override public void buttonClick(ClickEvent event) { boolean readOnly = form.isReadOnly(); if (readOnly) { bio.setReadOnly(false); form.setReadOnly(false); form.removeStyleName("light"); event.getButton().setCaption("Save"); event.getButton().addStyleName("primary"); } else { bio.setReadOnly(true); form.setReadOnly(true); form.addStyleName("light"); event.getButton().setCaption("Edit"); event.getButton().removeStyleName("primary"); } } }); HorizontalLayout footer = new HorizontalLayout(); footer.setMargin(new MarginInfo(true, false, true, false)); footer.setSpacing(true); footer.setDefaultComponentAlignment(Alignment.MIDDLE_LEFT); form.addComponent(footer); footer.addComponent(edit); Label lastModified = new Label("Last modified by you a minute ago"); lastModified.addStyleName("light"); footer.addComponent(lastModified); }
From source file:com.etest.view.testbank.CellCaseWindow.java
Window modifyCaseWindow(CellCase cellCase) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true);/*from www .j a v a 2 s . c om*/ v.setSpacing(true); Window sub = new Window("MODIFY"); sub.setWidth("400px"); sub.setModal(true); sub.center(); ComboBox actionDone = new ComboBox("Action: "); actionDone.setWidth("70%"); actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL); actionDone.setNullSelectionAllowed(false); actionDone.addItem("resolved"); actionDone.addItem("clarified"); actionDone.addItem("modified"); actionDone.setImmediate(true); v.addComponent(actionDone); TextArea remarks = new TextArea("Remarks: "); remarks.setWidth("100%"); remarks.setRows(3); v.addComponent(remarks); Button modify = new Button("UPDATE"); modify.setWidth("70%"); modify.setIcon(FontAwesome.EDIT); modify.addStyleName(ValoTheme.BUTTON_PRIMARY); modify.addStyleName(ValoTheme.BUTTON_SMALL); modify.addClickListener((Button.ClickEvent event) -> { if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) { Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE); return; } if (actionDone.getValue() == null) { Notification.show("Add action!", Notification.Type.WARNING_MESSAGE); return; } cellCase.setActionDone(actionDone.getValue().toString()); cellCase.setRemarks(remarks.getValue().trim()); boolean result = ccs.modifyCellCase(cellCase); if (result) { Notification.show("Case has been Modified!", Notification.Type.TRAY_NOTIFICATION); sub.close(); close(); } }); v.addComponent(modify); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.testbank.cellitem.CellItemWindow.java
Window modifyCellItemWindow(CellItem ci) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true);//from w w w . j a v a2 s . c o m v.setSpacing(true); Window sub = new Window("MODIFY"); sub.setWidth("400px"); sub.setModal(true); sub.center(); ComboBox actionDone = new ComboBox("Action: "); actionDone.setWidth("70%"); actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL); actionDone.setNullSelectionAllowed(false); actionDone.addItem("resolved"); actionDone.addItem("clarified"); actionDone.addItem("modified"); actionDone.setImmediate(true); v.addComponent(actionDone); TextArea remarks = new TextArea("Remarks: "); remarks.setWidth("100%"); remarks.setRows(3); v.addComponent(remarks); Button modify = new Button("UPDATE"); modify.setWidth("70%"); modify.setIcon(FontAwesome.EDIT); modify.addStyleName(ValoTheme.BUTTON_PRIMARY); modify.addStyleName(ValoTheme.BUTTON_SMALL); modify.addClickListener((Button.ClickEvent event) -> { if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) { Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE); return; } if (actionDone.getValue() == null) { Notification.show("Add action!", Notification.Type.WARNING_MESSAGE); return; } ci.setRemarks(remarks.getValue().trim()); ci.setActionDone(actionDone.getValue().toString()); boolean result = cis.modifyCellItem(ci); if (result) { sub.close(); close(); } }); v.addComponent(modify); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.etest.view.testbank.cellitem.CellItemWindow.java
Window modifyKeyWindow(int itemKeyId, int cellItemId, String keyValue, String optionValue, boolean isOptionKeyExist) { VerticalLayout v = new VerticalLayout(); v.setWidth("100%"); v.setMargin(true);//from ww w . ja va 2s . co m v.setSpacing(true); Window sub = new Window("MODIFY"); sub.setWidth("400px"); sub.setModal(true); sub.center(); ComboBox actionDone = new ComboBox("Action: "); actionDone.setWidth("70%"); actionDone.addStyleName(ValoTheme.COMBOBOX_SMALL); actionDone.setNullSelectionAllowed(false); actionDone.addItem("resolved"); actionDone.addItem("clarified"); actionDone.addItem("modified"); actionDone.setImmediate(true); v.addComponent(actionDone); TextArea remarks = new TextArea("Remarks: "); remarks.setWidth("100%"); remarks.setRows(3); v.addComponent(remarks); Button modify = new Button("UPDATE"); modify.setWidth("70%"); modify.setIcon(FontAwesome.EDIT); modify.addStyleName(ValoTheme.BUTTON_PRIMARY); modify.addStyleName(ValoTheme.BUTTON_SMALL); modify.addClickListener((Button.ClickEvent event) -> { if (remarks.getValue() == null || remarks.getValue().trim().isEmpty()) { Notification.show("Add remarks!", Notification.Type.WARNING_MESSAGE); return; } if (actionDone.getValue() == null) { Notification.show("Add action!", Notification.Type.WARNING_MESSAGE); return; } boolean result = k.modifyItemKey(itemKeyId, cellItemId, keyValue, optionValue, isOptionKeyExist, remarks.getValue().trim(), actionDone.getValue().toString()); if (result) { Notification.show("Key SUCCESSFULLY modified", Notification.Type.TRAY_NOTIFICATION); sub.close(); } }); v.addComponent(modify); sub.setContent(v); sub.getContent().setHeightUndefined(); return sub; }
From source file:com.jain.addon.web.bean.factory.AbstractFieldFactory.java
License:Apache License
protected Field<?> createTextField(JNIProperty property) { if (property.getType() == JPropertyType.TEXT_AREA) { TextArea field = new TextArea(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); field.setRows(5); return field; }//from w w w.j a v a 2 s .co m if (property.getType() == JPropertyType.RICH_TEXT_AREA) { RichTextArea field = new RichTextArea(); field.setNullRepresentation(""); return field; } if (property.getType() == JPropertyType.IMAGE) { JImage image = new JImage(); image.setInterruptionMessage(property.getName() + ".upload.interruption"); image.setUploadButtonCaption(property.getName() + ".upload.button.caption"); return image; } TextField field = new TextField(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); return field; }
From source file:com.jain.addon.web.bean.factory.generator.text.TextAreaFieldGenerator.java
License:Apache License
public Field<?> createField(Class<?> type, JNIProperty property) { TextArea field = new TextArea(); field.setInputPrompt(getCaption(property)); field.setNullRepresentation(""); field.setRows(5); return field; }
From source file:com.jiangyifen.ec2.ui.mgr.system.tabsheet.SystemLicence.java
/** * added by chb 20140520//from w ww.j a va 2 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; }