use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class SelectUsersPopupWindow method initSearchField.
protected void initSearchField() {
HorizontalLayout searchLayout = new HorizontalLayout();
searchLayout.setSpacing(true);
addComponent(searchLayout);
// textfield
searchField = new TextField();
searchField.setInputPrompt(i18nManager.getMessage(Messages.PEOPLE_SEARCH));
searchField.setWidth(180, UNITS_PIXELS);
searchField.focus();
searchField.setTextChangeEventMode(TextChangeEventMode.EAGER);
searchLayout.addComponent(searchField);
// Logic to change table according to input
searchField.addListener(new TextChangeListener() {
public void textChange(TextChangeEvent event) {
searchPeople(event.getText());
}
});
initSelectMyselfButton(searchLayout);
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class GroupDetailPanel method initGroupProperties.
protected void initGroupProperties() {
detailsGrid = new GridLayout(2, 3);
detailsGrid.setSpacing(true);
detailLayout.setMargin(true, true, true, false);
detailLayout.addComponent(detailsGrid);
// id
Label idLabel = new Label(i18nManager.getMessage(Messages.GROUP_ID) + ": ");
idLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(idLabel);
Label idValueLabel = new Label(group.getId());
detailsGrid.addComponent(idValueLabel);
// name
Label nameLabel = new Label(i18nManager.getMessage(Messages.GROUP_NAME) + ": ");
nameLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(nameLabel);
if (!editingDetails) {
Label nameValueLabel = new Label(group.getName());
detailsGrid.addComponent(nameValueLabel);
} else {
nameTextField = new TextField(null, group.getName());
detailsGrid.addComponent(nameTextField);
}
// Type
Label typeLabel = new Label(i18nManager.getMessage(Messages.GROUP_TYPE) + ": ");
typeLabel.addStyleName(ExplorerLayout.STYLE_LABEL_BOLD);
detailsGrid.addComponent(typeLabel);
if (!editingDetails) {
Label typeValueLabel = new Label(group.getType());
detailsGrid.addComponent(typeValueLabel);
} else {
typeCombobox = new ComboBox(null, Arrays.asList("assignment", "security-role"));
typeCombobox.setNullSelectionAllowed(false);
typeCombobox.setInvalidAllowed(false);
typeCombobox.select(group.getType());
detailsGrid.addComponent(typeCombobox);
}
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class NewUserPopupWindow method initInputFields.
protected void initInputFields() {
// Input fields
form.addField("id", new TextField(i18nManager.getMessage(Messages.USER_ID)));
// Set id field to required
form.getField("id").setRequired(true);
form.getField("id").setRequiredError(i18nManager.getMessage(Messages.USER_ID_REQUIRED));
form.getField("id").focus();
// Set id field to be unique
form.getField("id").addValidator(new Validator() {
public void validate(Object value) throws InvalidValueException {
if (!isValid(value)) {
throw new InvalidValueException(i18nManager.getMessage(Messages.USER_ID_UNIQUE));
}
}
public boolean isValid(Object value) {
if (value != null) {
return identityService.createUserQuery().userId(value.toString()).singleResult() == null;
}
return false;
}
});
// Password is required
form.addField("password", new PasswordField(i18nManager.getMessage(Messages.USER_PASSWORD)));
form.getField("password").setRequired(true);
form.getField("password").setRequiredError(i18nManager.getMessage(Messages.USER_PASSWORD_REQUIRED));
// Password must be at least 5 characters
StringLengthValidator passwordLengthValidator = new StringLengthValidator(i18nManager.getMessage(Messages.USER_PASSWORD_MIN_LENGTH, 5), 5, -1, false);
form.getField("password").addValidator(passwordLengthValidator);
form.addField("firstName", new TextField(i18nManager.getMessage(Messages.USER_FIRSTNAME)));
form.addField("lastName", new TextField(i18nManager.getMessage(Messages.USER_LASTNAME)));
form.addField("email", new TextField(i18nManager.getMessage(Messages.USER_EMAIL)));
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class UserDetailPanel method loadUserDetails.
protected void loadUserDetails() {
// Grid of details
GridLayout detailGrid = new GridLayout();
detailGrid.setColumns(2);
detailGrid.setSpacing(true);
detailGrid.setMargin(true, true, false, true);
userDetailsLayout.addComponent(detailGrid);
// Details
// details are non-editable
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_ID), new Label(user.getId()));
if (!editingDetails) {
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), new Label(user.getFirstName()));
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), new Label(user.getLastName()));
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), new Label(user.getEmail()));
} else {
firstNameField = new TextField(null, user.getFirstName() != null ? user.getFirstName() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_FIRSTNAME), firstNameField);
firstNameField.focus();
lastNameField = new TextField(null, user.getLastName() != null ? user.getLastName() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_LASTNAME), lastNameField);
emailField = new TextField(null, user.getEmail() != null ? user.getEmail() : "");
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_EMAIL), emailField);
passwordField = new PasswordField();
Label cautionLabel = new Label(i18nManager.getMessage(Messages.USER_RESET_PASSWORD));
cautionLabel.addStyleName(Reindeer.LABEL_SMALL);
HorizontalLayout passwordLayout = new HorizontalLayout();
passwordLayout.setSpacing(true);
passwordLayout.addComponent(passwordField);
passwordLayout.addComponent(cautionLabel);
passwordLayout.setComponentAlignment(cautionLabel, Alignment.MIDDLE_LEFT);
addUserDetail(detailGrid, i18nManager.getMessage(Messages.USER_PASSWORD), passwordLayout);
}
}
use of com.vaadin.ui.TextField in project opennms by OpenNMS.
the class NameEditForm method initFields.
private void initFields() {
nonEditableField = new TextField();
nonEditableField.setWidth(400, Unit.PIXELS);
nonEditableField.setReadOnly(true);
nonEditableField.setEnabled(false);
editableField = new TextField();
editableField.setWidth(400, Unit.PIXELS);
editableField.setRequired(true);
editableField.setRequiredError("You must provide a value.");
editableField.setValidationVisible(false);
editableField.setBuffered(false);
editableField.setImmediate(true);
editableField.addValidator(nameValidator);
editableField.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
if (!blockListenerOrValidators) {
controller.validateCurrentSelection();
}
}
});
editableField.setTextChangeTimeout(200);
editableField.addTextChangeListener(new FieldEvents.TextChangeListener() {
@Override
public void textChange(FieldEvents.TextChangeEvent event) {
editableField.setComponentError(null);
editableField.setValue(event.getText());
editableField.validate();
}
});
selectedField = new CheckBox();
selectedField.setCaption("selected");
selectedField.addValueChangeListener(new Property.ValueChangeListener() {
@Override
public void valueChange(Property.ValueChangeEvent event) {
updateEnabledState();
if (!selectedField.getValue()) {
editableField.discard();
}
if (!blockListenerOrValidators) {
try {
blockListenerOrValidators = true;
controller.fireSelectionValueChanged(getData(), getItemId(), selectedField.getValue());
} finally {
blockListenerOrValidators = false;
}
}
}
});
contentLayout.addComponent(selectedField);
contentLayout.addComponent(editableField);
contentLayout.addComponent(nonEditableField);
}
Aggregations