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;
}
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;
}
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);
}
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);
}
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);
}
}
}
}
Aggregations