Package com.vaadin.ui

Examples of com.vaadin.ui.Field


    if ("nationalite".equals(propertyId)) {
      nationalite.setInputPrompt("Nationalité");
      return nationalite;
    }

    Field f = super.createField(item, propertyId, uiContext);

    if ("phone".equals(propertyId)) {
      TextField txt = (TextField) f;
      txt.setCaption("Téléphone");
      txt.setInputPrompt("(+111) xxx-xxx-xxx");
View Full Code Here


import com.vaadin.ui.TextField;

public class VFormFactory extends DefaultFieldFactory {

  public Field createField(Item item, Object propertyId, Component uiContext) {
    Field f = super.createField(item, propertyId, uiContext);
   
    TextField tf = (TextField) f;
        tf.setRequired(true);
        tf.setRequiredError("Please enter a string");
        tf.setWidth("300px");
        tf.addValidator(new StringLengthValidator("Input must have 3-25 characters", 3, 25, false));
        f.setCaption("Tell Me");
       
    return f;
  }
View Full Code Here

            return;
        }

        Layout layout = parentForm.getLayout();

        Field oldField = fields.get(propertyId);
        if (oldField != null) {
            layout.removeComponent(oldField);
        }

        fields.put(propertyId, field);
View Full Code Here

        private AddressField addressField;

        @Override
        public Field createField(Item item, Object propertyId,
                Component uiContext) {
            Field f = super.createField(item, propertyId, uiContext);
            if ("address".equals(propertyId)) {
                // create a custom field for the Address object
                if (addressField == null) {
                    Form form = (embeddedAddress && uiContext instanceof Form) ? (Form) uiContext
                            : null;
View Full Code Here

            teamForm.setFormFieldFactory(new DefaultFieldFactory() {
                @Override
                public Field createField(Item item, Object propertyId,
                        Component uiContext) {
                    Field field = null;
                    if ("manager".equals(propertyId)) {
                        // The Team bean has a Person instance, whereas the
                        // value of a ComboBox here is an identifier.
                        ComboBox select = new ComboBox("manager",
                                getPersonContainer());
                        select.setItemCaptionPropertyId("firstName");
                        field = new BeanFieldWrapper<Person>(select,
                                Person.class, getPersonContainer(), "lastName");
                    } else if ("members".equals(propertyId)) {
                        // The Team bean has a Set of Person, whereas the value
                        // of a TwinColSelect here is a set of identifiers.
                        // Therefore, we need to convert between the two sets.
                        TwinColSelect select = new TwinColSelect(null,
                                getPersonContainer());
                        select.setMultiSelect(true);
                        select.setItemCaptionPropertyId("firstName");
                        field = new BeanSetFieldWrapper<Person>(select,
                                Person.class, getPersonContainer(), "lastName");
                        field.setCaption(createCaptionByPropertyId(propertyId));
                    } else {
                        field = super.createField(item, propertyId, uiContext);
                        if (field instanceof TextField) {
                            // show null as an empty string
                            ((TextField) field).setNullRepresentation("");
View Full Code Here

   * @see com.vaadin.ui.FormFieldFactory#createField(com.vaadin.data.Item, java.lang.Object, com.vaadin.ui.Component)
   */
  @SuppressWarnings("unchecked")
  @Override
  public Field createField(Item item, Object propertyId, Component uiContext) {
    Field field = null;

    if (fields.containsKey(propertyId)) {
      return fields.get(propertyId);
    }

View Full Code Here

   * @param prompt Prompt
   * @param caption Caption
   * @return Deduced field or Null if not deduced.
   */
  private Field findFieldByType(java.lang.reflect.Field objectField, String prompt, String caption) {
    Field field = null;

    // Check primitive wrapper classes.
    if (String.class.equals(objectField.getType()) || Long.class.equals(objectField.getType())
        || Integer.class.equals(objectField.getType()) || Double.class.equals(objectField.getType())
        || Short.class.equals(objectField.getType()) || Float.class.equals(objectField.getType())) {
View Full Code Here

   * @param prompt Prompt.
   * @param caption Caption.
   * @return Deduced Field.
   */
  private Field findFieldByAnnotation(java.lang.reflect.Field objectField, String prompt, String caption) {
    Field field = null;

    if (objectField.isAnnotationPresent(TextArea.class)) {
      final int rows = objectField.getAnnotation(TextArea.class).rows();
      final int columns = objectField.getAnnotation(TextArea.class).columns();
      field = FieldFactory.createTextArea(prompt, caption, rows, columns);
View Full Code Here

    // Clear current components in the grid
    if(formProperties != null) {
      for(FormProperty formProperty : formProperties) {
        FormPropertyRenderer renderer = getRenderer(formProperty);
      
        Field editorComponent = renderer.getPropertyField(formProperty);
        if(editorComponent != null) {
          // Get label for editor component.
          form.addField(formProperty.getId(), editorComponent);
        }
      }
View Full Code Here

    Map<String, String> formPropertyValues = new HashMap<String, String>();
   
    // Get values from fields defined for each form property
    for(FormProperty formProperty : formProperties) {
      if(formProperty.isWritable()) {
        Field field = form.getField(formProperty.getId());
        FormPropertyRenderer renderer = getRenderer(formProperty);
        String fieldValue = renderer.getFieldValue(formProperty, field);
       
        formPropertyValues.put(formProperty.getId(), fieldValue);
      }
View Full Code Here

TOP

Related Classes of com.vaadin.ui.Field

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.