List of usage examples for com.vaadin.ui TextField setValue
@Override public void setValue(String value)
From source file:ac.uk.icl.dell.vaadin.glycanbuilder.VaadinGlycanCanvas.java
License:Open Source License
@Override public void recieveSelectionUpdate(double x, double y, double width, double height, boolean mouseMoved) { final Residue selectedResidue = theCanvas.getCurrentResidue(); theCanvas.selectIntersectingRectangles(x, y, width, height, mouseMoved); if (theCanvas.getCurrentResidue() != null && selectedResidue == theCanvas.getCurrentResidue() && selectedResidue.isRepetition()) { final Window window = new Window("Repeatition options"); WeeLayout layout = new WeeLayout(org.vaadin.weelayout.WeeLayout.Direction.VERTICAL); final TextField minRep = new TextField("Minimum"); final TextField maxRep = new TextField("Maximum"); NativeButton okBut = new NativeButton("Ok"); NativeButton cancelBut = new NativeButton("Cancel"); minRep.setImmediate(true);// w ww .ja va 2 s.com maxRep.setImmediate(true); minRep.setValue(String.valueOf(selectedResidue.getMinRepetitions())); maxRep.setValue(String.valueOf(selectedResidue.getMaxRepetitions())); okBut.addListener(new ClickListener() { private static final long serialVersionUID = -408364885359729326L; @Override public void buttonClick(ClickEvent event) { String minRepNum = (String) minRep.getValue(); String maxRepNum = (String) maxRep.getValue(); boolean valid = true; try { Integer.parseInt(minRepNum); Integer.parseInt(maxRepNum); } catch (NumberFormatException ex) { valid = false; } if (valid) { selectedResidue.setMinRepetitions((String) minRep.getValue()); selectedResidue.setMaxRepetitions((String) maxRep.getValue()); theCanvas.documentUpdated(); } getWindow().removeWindow(window); } }); cancelBut.addListener(new ClickListener() { private static final long serialVersionUID = -657746118918366530L; @Override public void buttonClick(ClickEvent event) { getWindow().removeWindow(window); } }); layout.addComponent(minRep, Alignment.TOP_CENTER); layout.addComponent(maxRep, Alignment.MIDDLE_CENTER); WeeLayout buttonLayout = new WeeLayout(Direction.HORIZONTAL); buttonLayout.addComponent(okBut, Alignment.TOP_CENTER); buttonLayout.addComponent(cancelBut, Alignment.TOP_CENTER); layout.addComponent(buttonLayout, Alignment.BOTTOM_CENTER); window.center(); window.getContent().addComponent(layout); window.getContent().setSizeUndefined(); window.setSizeUndefined(); getWindow().addWindow(window); } }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
@SuppressWarnings("serial") public static Field createCPFField(String prompt, String caption) { final TextField listenedField = createTextField(prompt, caption); listenedField.setImmediate(true);//from w w w . j ava2s .com listenedField.addListener(new ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (listenedField.getValue() != null) { try { listenedField.setValue( TextUtil.format(listenedField.getValue().toString(), "999.999.999-99", true)); } catch (RuntimeException re) { // Notthing to be done! } } } }); return listenedField; }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
public static Field createPhoneField(String prompt, String caption) { final TextField listenedField = createTextField(prompt, caption); listenedField.setImmediate(true);/* w ww . j a va 2 s. com*/ listenedField.addListener(new ValueChangeListener() { private static final long serialVersionUID = 1L; @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (listenedField.getValue() != null) { try { listenedField .setValue(TextUtil.format(listenedField.getValue().toString(), "9999-9999", true)); } catch (RuntimeException re) { // Notthing to be done! } } } }); return listenedField; }
From source file:br.gov.frameworkdemoiselle.vaadin.util.FieldFactory.java
License:Open Source License
@SuppressWarnings("serial") public static Field createFormattedField(String prompt, String caption, final String formato, final boolean direcao) { final TextField listenedField = createTextField(prompt, caption); listenedField.setImmediate(true);//from w w w. ja v a2 s . c o m listenedField.addListener(new ValueChangeListener() { @Override public void valueChange(com.vaadin.data.Property.ValueChangeEvent event) { if (listenedField.getValue() != null) { try { listenedField .setValue(TextUtil.format(listenedField.getValue().toString(), formato, direcao)); } catch (RuntimeException re) { // Notthing to be done! } } } }); return listenedField; }
From source file:cirad.cgh.vcf2fasta.view.Vcf2fastaForm.java
License:Open Source License
private TextField getTextField(String caption, String bindName, String defaultValue, int columns) { TextField textField = new TextField(caption); textField.setImmediate(true);/*from w w w. ja v a 2 s. co m*/ fieldGroup.bind(textField, bindName); textField.setValidationVisible(false); textField.setNullRepresentation(""); textField.setNullSettingAllowed(true); textField.setColumns(columns); textField.setValue(defaultValue); return textField; }
From source file:co.edu.icesi.academ.client.perfiles.propietario.FactoresDeImpacto.java
License:Open Source License
public void cargarRoles(final List<RolBO> roles, List<TemaBO> temas, List<FactorDeImpactoBO> factoresDeImpacto, EvaluacionBO evaluacionBO) {/*from www . j a v a 2 s. com*/ initTable(); // Guarda los roles obtenidos en la consulta rolesActuales = roles; // Guarda los temas obtenidos en la consulta temasActuales = temas; // Guarda el identificador de la evaluacion actual idEvaluacion = evaluacionBO.getId(); int columns = 0; // Adiciona una columna por cada rol for (RolBO rolBO : roles) { table_1.addContainerProperty(rolBO.getNombre(), TextField.class, null); table_1.setColumnAlignment(rolBO.getNombre(), Align.CENTER); columns++; } // Agrega la columna TOTAL table_1.addContainerProperty("Total", Label.class, null); table_1.setColumnAlignment("Total", Align.CENTER); // Recorre todos los temas y por cada uno, adiciona los respectivos // valores a cada columna for (TemaBO temaBO : temas) { ArrayList<Object> item = new ArrayList<>(); item.add(temaBO.getId()); item.add(temaBO.getNombre()); int total = 0; for (int i = 0; i < columns; i++) { final TextField tf = new TextField(); // Carga el valor del factor de impacto FactorDeImpactoBO factor = new FactorDeImpactoBO(); factor.setEvaluacion(evaluacionBO.getId()); factor.setRol(roles.get(i).getNombre()); factor.setTema(temaBO.getId()); int index = getFactorDeImpactoIndex(factoresDeImpacto, factor); if (index != -1) { tf.setValue("" + (int) factoresDeImpacto.get(index).getFactorDeImpacto()); total += factoresDeImpacto.get(index).getFactorDeImpacto(); } tf.setColumns(3); tf.setData(temaBO); tf.setId(temaBO.getId() + "-" + i); // Adiciona listener para recalcular el total de la fila cada // vez que se cambie un factor de impacto tf.addTextChangeListener(new TextChangeListener() { private static final long serialVersionUID = 1L; @Override public void textChange(TextChangeEvent event) { // TODO Auto-generated method stub TemaBO tema = (TemaBO) tf.getData(); int tfId = Integer.parseInt(tf.getId().split("-")[1]); int total = 0; // Obtiene el valor de todos los factores de impacto de // la fila y los suma for (int j = 0; j < roles.size(); j++) { try { if (j != tfId) total += Integer.parseInt(table_1.getItem(tema) .getItemProperty(roles.get(j).getNombre()).getValue().toString()); else total += Integer.parseInt(event.getText()); } catch (Exception e) { total += 0; } } Label l = getLabelColor(total); table_1.getItem(tema).getItemProperty("Total").setValue(l); } }); item.add(tf); } item.add(getLabelColor(total)); table_1.addItem(item.toArray(), temaBO); } }
From source file:com.bellkenz.modules.PersonalInformation.java
public ComponentContainer personalInformation() { employeeInformationDAO = new EmployeeInformationDAO(getEmployeeId()); employeePersonalInformation = new EmployeePersonalInformation(); GridLayout glayout = new GridLayout(5, 9); glayout.setSpacing(true);/* w w w.j av a2 s . c o m*/ glayout.setMargin(true); final Panel imagePanel = new Panel(); imagePanel.setStyleName("light"); AbstractLayout panelLayout = (AbstractLayout) imagePanel.getContent(); panelLayout.setMargin(false); imagePanel.setSizeFull(); employeeImage = new Embedded(null, new ThemeResource("../myTheme/images/ronnie.jpg")); employeeImage.setImmediate(true); employeeImage.setWidth(90, Sizeable.UNITS_PIXELS); employeeImage.setHeight(90, Sizeable.UNITS_PIXELS); employeeImage.setStyleName("logo-img"); imagePanel.addComponent(employeeImage); glayout.addComponent(employeeImage, 0, 0, 0, 1); glayout.setComponentAlignment(imagePanel, Alignment.MIDDLE_CENTER); firstname = createTextField("Firstname: "); glayout.addComponent(firstname, 1, 0, 2, 0); final TextField middlename = createTextField("Middlename: "); glayout.addComponent(middlename, 3, 0); final TextField lastname = createTextField("Lastname: "); glayout.addComponent(lastname, 4, 0); final TextField houseNo = createTextField("No: "); houseNo.setWidth("40px"); glayout.addComponent(houseNo, 1, 1); final TextField street = createTextField("Street: "); street.setWidth("118"); glayout.addComponent(street, 2, 1); final TextField city = createTextField("City: "); glayout.addComponent(city, 3, 1); final TextField zipCode = createTextField("Zip Code:"); glayout.addComponent(zipCode, 4, 1); final TextField nickname = createTextField("Nickname: "); nickname.setWidth("90px"); glayout.addComponent(nickname, 0, 2); final TextField permanentAddress = createTextField("Permanent/Provincial Address: "); permanentAddress.setWidth("533px"); glayout.addComponent(permanentAddress, 1, 2, 4, 2); Button uploadPicture = new Button("Upload..."); uploadPicture.setWidth("100%"); uploadPicture.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (employeeId == null) { getWindow().showNotification("You did not select and Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window uploadImage = new UploadImage(imagePanel, employeeImage, employeeId); uploadImage.setWidth("450px"); if (uploadImage.getParent() == null) { getWindow().addWindow(uploadImage); } uploadImage.setModal(true); uploadImage.center(); } }); glayout.addComponent(uploadPicture, 0, 3); final TextField landline = createTextField("Landline #: "); glayout.addComponent(landline, 1, 3, 2, 3); final TextField mobileNo = createTextField("Mobile #: "); glayout.addComponent(mobileNo, 3, 3); final TextField age = createTextField("Age: "); glayout.addComponent(age, 4, 3); final TextField emailAddress = createTextField("Email Address: "); glayout.addComponent(emailAddress, 1, 4, 2, 4); final PopupDateField dob = (PopupDateField) createDateField("Date of Birth: "); glayout.addComponent(dob, 3, 4); final TextField height = createTextField("Height: "); glayout.addComponent(height, 4, 4); final ComboBox civilStatus = new ComboBox("Civil Status: "); civilStatus.setWidth("100%"); dropDownBoxList.populateCivilStatusList(civilStatus); glayout.addComponent(civilStatus, 1, 5, 2, 5); final ComboBox gender = new ComboBox("Gender: "); gender.setWidth("100%"); dropDownBoxList.populateGenderList(gender); glayout.addComponent(gender, 3, 5); final TextField weight = createTextField("Weigth: "); glayout.addComponent(weight, 4, 5); final TextField driversLicenseNo = createTextField("Drivers License: "); glayout.addComponent(driversLicenseNo, 1, 6, 2, 6); final TextField restrictionCode = createTextField("Restriction Code: "); glayout.addComponent(restrictionCode, 3, 6); final TextField religion = createTextField("Religion: "); glayout.addComponent(religion, 4, 6); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); glayout.addComponent(division, 1, 7, 2, 7); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); glayout.addComponent(department, 3, 7); final TextField position = createTextField("Position: "); glayout.addComponent(position, 4, 7); //glayout.setComponentAlignment(position, Alignment.BOTTOM_LEFT); Button transferButton = new Button("Transfer Employee"); transferButton.setWidth("100%"); transferButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (getEmployeeId() == null) { getWindow().showNotification("You did not select an Employee!", Window.Notification.TYPE_WARNING_MESSAGE); return; } Window subWindow = transferEmployee(getEmployeeId(), division, department, position); if (subWindow.getParent() == null) { getWindow().addWindow(subWindow); } subWindow.setModal(true); subWindow.center(); } }); glayout.addComponent(transferButton, 1, 8, 2, 8); glayout.setComponentAlignment(transferButton, Alignment.BOTTOM_CENTER); if (employeeId != null) { epiList = employeeInformationDAO.employeePersonalInformation(); for (EmployeePersonalInformation epi : epiList) { final byte[] image = epi.getImage(); if (image != null) { StreamResource.StreamSource imageSource = new StreamResource.StreamSource() { @Override public InputStream getStream() { return new ByteArrayInputStream(image); } }; StreamResource imageResource = new StreamResource(imageSource, epi.getFirstname() + ".jpg", getApplication()); imageResource.setCacheTime(0); employeeImage.setSource(imageResource); } firstname.setValue(epi.getFirstname()); middlename.setValue(epi.getMiddlename()); lastname.setValue(epi.getLastname()); houseNo.setValue(epi.getHouseNumber()); street.setValue(epi.getStreet()); city.setValue(epi.getStreet()); zipCode.setValue(epi.getZipCode()); nickname.setValue(epi.getNickname()); permanentAddress.setValue(epi.getPermanentAddress()); landline.setValue(epi.getLandlineNumber()); mobileNo.setValue(epi.getMobileNumber()); age.setValue(epi.getAge()); emailAddress.setValue(epi.getEmailAddress()); if (epi.getDob() != null) { dob.setValue(conUtil.parsingDate(epi.getDob())); } else { dob.setValue(null); } height.setValue(epi.getHeight()); if (epi.getCivilStatus() != null) { Object civilStatusId = civilStatus.addItem(); civilStatus.setItemCaption(civilStatusId, epi.getCivilStatus()); civilStatus.setValue(civilStatusId); } if (epi.getGender() != null) { Object genderId = gender.addItem(); gender.setItemCaption(genderId, epi.getGender()); gender.setValue(genderId); } weight.setValue(epi.getWeight()); driversLicenseNo.setValue(epi.getDriversLicense()); restrictionCode.setValue(epi.getRestrictionCode()); religion.setValue(epi.getReligion()); position.setValue(epi.getPosition()); Object divisionObjectId = division.addItem(); division.setItemCaption(divisionObjectId, epi.getDivision()); division.setValue(divisionObjectId); Object departmentObjectId = department.addItem(); department.setItemCaption(departmentObjectId, epi.getDepartment()); department.setValue(departmentObjectId); } } firstname.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { employeePersonalInformation.setFirstname(event.getProperty().getValue().toString()); } }); firstname.setImmediate(true); setInformation(employeePersonalInformation); return glayout; }
From source file:com.bellkenz.modules.PersonalInformation.java
public Window transferEmployee(final String employeeId, final ComboBox div, final ComboBox dept, final TextField post) { VerticalLayout vlayout = new VerticalLayout(); vlayout.setMargin(true);/*w w w . java2s . co m*/ vlayout.setSpacing(true); final Window subWindow = new Window("Transfer Employee", vlayout); subWindow.setWidth("200px"); final ComboBox division = new ComboBox("Division: "); division.setWidth("100%"); dropDownBoxList.populateBranchComboBox(division); subWindow.addComponent(division); final ComboBox department = dropDownBoxList.populateDepartment(new ComboBox()); department.setWidth("100%"); division.addListener(new Property.ValueChangeListener() { @Override public void valueChange(Property.ValueChangeEvent event) { if (division.getValue() == null) { } else { divisionId = branchDAO.getBranchId(division.getValue().toString()); } } }); subWindow.addComponent(department); final TextField position = createTextField("Position: "); position.setWidth("100%"); subWindow.addComponent(position); final PopupDateField entryDate = (PopupDateField) createDateField("Date of Entry: "); subWindow.addComponent(entryDate); Button updateButton = new Button("UPDATE"); updateButton.setWidth("100%"); updateButton.addListener(new Button.ClickListener() { @Override public void buttonClick(Button.ClickEvent event) { if (division.getValue() == null) { getWindow().showNotification("Select Division!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (department.getValue() == null) { getWindow().showNotification("Select Department!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (position.getValue() == null || position.getValue().toString().trim().isEmpty()) { getWindow().showNotification("Enter Position!", Window.Notification.TYPE_WARNING_MESSAGE); return; } if (entryDate.getValue() == null) { getWindow().showNotification("Select Entry Date!", Window.Notification.TYPE_WARNING_MESSAGE); return; } List<EmployeePositionHistory> ephList = new ArrayList<EmployeePositionHistory>(); EmployeePositionHistory eph = new EmployeePositionHistory(); eph.setBranch(division.getValue().toString()); eph.setDepartment(department.getValue().toString()); eph.setPosition(position.getValue().toString().trim().toLowerCase()); eph.setEntryDate(conUtil.convertDateFormat(entryDate.getValue().toString())); ephList.add(eph); Integer deptId = departmentDAO.getDepartmentId(divisionId, department.getValue().toString()); Boolean result = employeeInformationDAO.transferEmployee(ephList, deptId); if (result) { Object divObjectId = div.addItem(); div.setItemCaption(divObjectId, division.getValue().toString()); div.setValue(divObjectId); Object deptObjectId = dept.addItem(); dept.setItemCaption(deptObjectId, department.getValue().toString()); dept.setValue(deptObjectId); post.setValue(position.getValue().toString().trim().toLowerCase()); (subWindow.getParent()).removeWindow(subWindow); } else { getWindow().showNotification("Cannot Transfer employee", Window.Notification.TYPE_ERROR_MESSAGE); } } }); subWindow.addComponent(updateButton); return subWindow; }
From source file:com.cavisson.gui.dashboard.components.controls.Forms.java
License:Apache License
public Forms() { setSpacing(true);//from ww w . j a va 2 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.cavisson.gui.dashboard.components.controls.TextFields.java
License:Apache License
public TextFields() { setMargin(true);//from www . j a v a 2 s . c o m Label h1 = new Label("Text Fields"); h1.addStyleName("h1"); addComponent(h1); HorizontalLayout row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TextField tf = new TextField("Normal"); tf.setInputPrompt("First name"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Custom color"); tf.setInputPrompt("Email"); tf.addStyleName("color1"); row.addComponent(tf); tf = new TextField("User Color"); tf.setInputPrompt("Gender"); tf.addStyleName("color2"); row.addComponent(tf); tf = new TextField("Themed"); tf.setInputPrompt("Age"); tf.addStyleName("color3"); row.addComponent(tf); tf = new TextField("Error"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); row.addComponent(tf); tf = new TextField("Error, borderless"); tf.setValue("Somethings wrong"); tf.setComponentError(new UserError("Fix it, now!")); tf.addStyleName("borderless"); row.addComponent(tf); tf = new TextField("Read-only"); tf.setInputPrompt("Nationality"); tf.setValue("Finnish"); tf.setReadOnly(true); row.addComponent(tf); tf = new TextField("Small"); tf.setValue("Field value"); tf.addStyleName("small"); row.addComponent(tf); tf = new TextField("Large"); tf.setValue("Field value"); tf.addStyleName("large"); tf.setIcon(testIcon.get(true)); row.addComponent(tf); tf = new TextField("Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Large, Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("large"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Small, Icon inside"); tf.setInputPrompt("Ooh, an icon"); tf.addStyleName("small"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("16px supported by default"); tf.setInputPrompt("Image icon"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); tf = new TextField(); tf.setValue("Font, no caption"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField(); tf.setValue("Image, no caption"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get(true, 16)); row.addComponent(tf); CssLayout group = new CssLayout(); group.addStyleName("v-component-group"); row.addComponent(group); tf = new TextField(); tf.setInputPrompt("Grouped with a button"); tf.addStyleName("inline-icon"); tf.setIcon(testIcon.get()); tf.setWidth("260px"); group.addComponent(tf); Button button = new Button("Do It"); // button.addStyleName("primary"); group.addComponent(button); tf = new TextField("Borderless"); tf.setInputPrompt("Write here"); tf.addStyleName("inline-icon"); tf.addStyleName("borderless"); tf.setIcon(testIcon.get()); row.addComponent(tf); tf = new TextField("Right-aligned"); tf.setValue("1,234"); tf.addStyleName("align-right"); row.addComponent(tf); tf = new TextField("Centered"); tf.setInputPrompt("Guess what?"); tf.addStyleName("align-center"); row.addComponent(tf); PasswordField pwf = new PasswordField("Password"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, right-aligned"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.addStyleName("align-right"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); pwf = new PasswordField("Password, centered"); pwf.setInputPrompt("Secret words"); pwf.addStyleName("inline-icon"); pwf.addStyleName("align-center"); pwf.setIcon(FontAwesome.LOCK); row.addComponent(pwf); tf = new TextField("Tiny"); tf.setValue("Field value"); tf.addStyleName("tiny"); row.addComponent(tf); tf = new TextField("Huge"); tf.setValue("Field value"); tf.addStyleName("huge"); row.addComponent(tf); h1 = new Label("Text Areas"); h1.addStyleName("h1"); addComponent(h1); row = new HorizontalLayout(); row.addStyleName("wrapping"); row.setSpacing(true); addComponent(row); TextArea ta = new TextArea("Normal"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Inline icon"); ta.setInputPrompt("Inline icon not really working"); ta.addStyleName("inline-icon"); ta.setIcon(testIcon.get()); row.addComponent(ta); ta = new TextArea("Custom color"); ta.addStyleName("color1"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Custom color, read-only"); ta.addStyleName("color2"); ta.setValue("Field value, spanning multiple lines of text"); ta.setReadOnly(true); row.addComponent(ta); ta = new TextArea("Custom color"); ta.addStyleName("color3"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Small"); ta.addStyleName("small"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Large"); ta.addStyleName("large"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Borderless"); ta.addStyleName("borderless"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Right-aligned"); ta.addStyleName("align-right"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Centered"); ta.addStyleName("align-center"); ta.setValue("Field value, spanning multiple lines of text"); row.addComponent(ta); ta = new TextArea("Tiny"); ta.addStyleName("tiny"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); ta = new TextArea("Huge"); ta.addStyleName("huge"); ta.setInputPrompt("Write your comment"); row.addComponent(ta); RichTextArea rta = new RichTextArea(); rta.setValue("<b>Some</b> <i>rich</i> content"); row.addComponent(rta); rta = new RichTextArea("Read-only"); rta.setValue("<b>Some</b> <i>rich</i> content"); rta.setReadOnly(true); row.addComponent(rta); }