Search in sources :

Example 86 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class DoubleFormPropertyRenderer method getPropertyField.

@Override
public Field getPropertyField(FormProperty formProperty) {
    final TextField textField = new TextField(getPropertyLabel(formProperty));
    textField.setRequired(formProperty.isRequired());
    textField.setEnabled(formProperty.isWritable());
    textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
    if (formProperty.getValue() != null) {
        textField.setValue(formProperty.getValue());
    }
    // Add validation of numeric value
    textField.addValidator(new DoubleValidator("Value must be a double"));
    textField.setImmediate(true);
    return textField;
}
Also used : DoubleValidator(org.activiti.explorer.ui.validator.DoubleValidator) TextField(com.vaadin.ui.TextField)

Example 87 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class LongFormPropertyRenderer method getPropertyField.

@Override
public Field getPropertyField(FormProperty formProperty) {
    final TextField textField = new TextField(getPropertyLabel(formProperty));
    textField.setRequired(formProperty.isRequired());
    textField.setEnabled(formProperty.isWritable());
    textField.setRequiredError(getMessage(Messages.FORM_FIELD_REQUIRED, getPropertyLabel(formProperty)));
    if (formProperty.getValue() != null) {
        textField.setValue(formProperty.getValue());
    }
    // Add validation of numeric value
    textField.addValidator(new LongValidator("Value must be a long"));
    textField.setImmediate(true);
    return textField;
}
Also used : TextField(com.vaadin.ui.TextField) LongValidator(org.activiti.explorer.ui.validator.LongValidator)

Example 88 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class TaskListHeader method initInputField.

protected void initInputField() {
    // Csslayout is used to style inputtext as rounded
    CssLayout csslayout = new CssLayout();
    csslayout.setHeight(24, UNITS_PIXELS);
    csslayout.setWidth(100, UNITS_PERCENTAGE);
    layout.addComponent(csslayout);
    inputField = new TextField();
    inputField.setWidth(100, UNITS_PERCENTAGE);
    inputField.addStyleName(ExplorerLayout.STYLE_SEARCHBOX);
    inputField.setInputPrompt(i18nManager.getMessage(Messages.TASK_CREATE_NEW));
    inputField.focus();
    csslayout.addComponent(inputField);
    layout.setComponentAlignment(csslayout, Alignment.MIDDLE_LEFT);
    layout.setExpandRatio(csslayout, 1.0f);
}
Also used : CssLayout(com.vaadin.ui.CssLayout) TextField(com.vaadin.ui.TextField)

Example 89 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class UrlAttachmentEditorComponent method initUrl.

protected void initUrl() {
    TextField urlField = new TextField(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_URL_URL));
    urlField.focus();
    urlField.setRequired(true);
    urlField.setRequiredError(i18nManager.getMessage(Messages.RELATED_CONTENT_TYPE_URL_URL_REQUIRED));
    urlField.setWidth(100, UNITS_PERCENTAGE);
    // URL isn't mutable once attachment is created
    if (attachment != null) {
        urlField.setEnabled(false);
    }
    addField("url", urlField);
}
Also used : TextField(com.vaadin.ui.TextField)

Example 90 with TextField

use of com.vaadin.ui.TextField in project cia by Hack23.

the class FormFactoryImpl method createDisplayPropertyConverters.

/**
 * Creates the display property converters.
 *
 * @param <T>
 *            the generic type
 * @param displayProperties
 *            the display properties
 * @param formContent
 *            the form content
 * @param binder
 *            the binder
 * @param propertyDescriptors
 *            the property descriptors
 */
private static <T extends Serializable> void createDisplayPropertyConverters(final List<String> displayProperties, final FormLayout formContent, final Binder<T> binder, final PropertyDescriptor[] propertyDescriptors) {
    for (final String property : displayProperties) {
        final Class<?> typeOfProperty = getTypeOfProperty(propertyDescriptors, property);
        if (typeOfProperty != null) {
            final AbstractField<?> field = new TextField();
            field.setReadOnly(true);
            field.setCaption(property);
            field.setWidth(ContentSize.FULL_SIZE);
            formContent.addComponent(field);
            final Converter converter = getConverterForType(typeOfProperty);
            if (converter != null) {
                binder.forField(field).withConverter(converter).bind(property);
            } else if (String.class.equals(typeOfProperty)) {
                binder.forField(field).bind(property);
            } else {
                LOGGER.warn("No fieldtype for property: {}, type: {}", property, typeOfProperty);
            }
        }
    }
}
Also used : TextField(com.vaadin.ui.TextField) StringToBooleanConverter(com.vaadin.data.converter.StringToBooleanConverter) Converter(com.vaadin.data.Converter) StringToDateConverter(com.vaadin.data.converter.StringToDateConverter) StringToDoubleConverter(com.vaadin.data.converter.StringToDoubleConverter) StringToBigIntegerConverter(com.vaadin.data.converter.StringToBigIntegerConverter) StringToLongConverter(com.vaadin.data.converter.StringToLongConverter) StringToBigDecimalConverter(com.vaadin.data.converter.StringToBigDecimalConverter) StringToFloatConverter(com.vaadin.data.converter.StringToFloatConverter) StringToIntegerConverter(com.vaadin.data.converter.StringToIntegerConverter)

Aggregations

TextField (com.vaadin.ui.TextField)142 HorizontalLayout (com.vaadin.ui.HorizontalLayout)45 Button (com.vaadin.ui.Button)40 Label (com.vaadin.ui.Label)37 VerticalLayout (com.vaadin.ui.VerticalLayout)26 Test (org.junit.Test)22 ComboBox (com.vaadin.ui.ComboBox)16 ArrayList (java.util.ArrayList)14 CheckBox (com.vaadin.ui.CheckBox)10 DateField (com.vaadin.ui.DateField)9 PasswordField (com.vaadin.ui.PasswordField)9 TextArea (com.vaadin.ui.TextArea)9 Property (com.vaadin.data.Property)8 Grid (com.vaadin.ui.Grid)8 GridLayout (com.vaadin.ui.GridLayout)7 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)6 StringToIntegerConverter (com.vaadin.data.converter.StringToIntegerConverter)6 MarginInfo (com.vaadin.shared.ui.MarginInfo)6 Panel (com.vaadin.ui.Panel)6 SplitTextField (au.com.vaadinutils.crud.splitFields.SplitTextField)5