use of com.vaadin.ui.TextField in project opennms by OpenNMS.
the class MibObjFieldFactory method createField.
/* (non-Javadoc)
* @see com.vaadin.ui.TableFieldFactory#createField(com.vaadin.data.Container, java.lang.Object, java.lang.Object, com.vaadin.ui.Component)
*/
@Override
public Field<?> createField(Container container, Object itemId, Object propertyId, Component uiContext) {
if (propertyId.equals("oid")) {
final TextField field = new TextField();
field.setSizeFull();
field.setRequired(true);
field.setImmediate(true);
field.addValidator(new RegexpValidator("^\\.[.\\d]+$", "Invalid OID {0}"));
return field;
}
if (propertyId.equals("instance")) {
final ComboBox field = new ComboBox();
field.setSizeFull();
field.setRequired(true);
field.setImmediate(true);
field.setNullSelectionAllowed(false);
field.setNewItemsAllowed(true);
field.setNewItemHandler(new NewItemHandler() {
@Override
public void addNewItem(String newItemCaption) {
if (!field.containsId(newItemCaption)) {
field.addItem(newItemCaption);
field.setValue(newItemCaption);
}
}
});
field.addItem("0");
field.addItem("ifIndex");
for (String rt : resourceTypes) {
field.addItem(rt);
}
return field;
}
if (propertyId.equals("alias")) {
final TextField field = new TextField();
field.setSizeFull();
field.setRequired(true);
field.setImmediate(true);
field.addValidator(new StringLengthValidator("Invalid alias. It should not contain more than 19 characters.", 1, 19, false));
return field;
}
if (propertyId.equals("type")) {
final TextField field = new TextField();
field.setSizeFull();
field.setRequired(true);
field.setImmediate(true);
field.addValidator(new // Based on NumericAttributeType and StringAttributeType
RegexpValidator(// Based on NumericAttributeType and StringAttributeType
"^(?i)(counter|gauge|timeticks|integer|octetstring|string)?\\d*$", "Invalid type {0}. Valid types are: counter, gauge, timeticks, integer, octetstring, string"));
return field;
}
return null;
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class CopyModelPopupWindow method addFields.
protected void addFields() {
form = new Form();
form.setCaption(i18nManager.getMessage(Messages.PROCESS_COPY_POPUP_CAPTION));
form.getLayout().setMargin(true);
nameTextField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
nameTextField.setWidth(20, Sizeable.UNITS_EM);
nameTextField.setRequired(true);
nameTextField.setValue(modelData.getName());
form.getLayout().addComponent(nameTextField);
nameTextField.focus();
descriptionTextArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
descriptionTextArea.setRows(8);
descriptionTextArea.setWidth(20, Sizeable.UNITS_EM);
form.getLayout().addComponent(descriptionTextArea);
addComponent(form);
// Some empty space
Label emptySpace = new Label(" ", Label.CONTENT_XHTML);
addComponent(emptySpace);
}
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);
}
Aggregations