use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class AccountSelectionPopup method initAlfrescoComponent.
protected void initAlfrescoComponent() {
alfrescoForm = new Form();
alfrescoForm.setDescription(i18nManager.getMessage(Messages.ALFRESCO_DESCRIPTION));
final TextField alfrescoServer = new TextField(i18nManager.getMessage(Messages.ALFRESCO_SERVER));
alfrescoForm.getLayout().addComponent(alfrescoServer);
final TextField alfrescoUserName = new TextField(i18nManager.getMessage(Messages.ALFRESCO_USERNAME));
alfrescoForm.getLayout().addComponent(alfrescoUserName);
final PasswordField alfrescoPassword = new PasswordField(i18nManager.getMessage(Messages.ALFRESCO_PASSWORD));
alfrescoForm.getLayout().addComponent(alfrescoPassword);
// Matching listener
alfrescoClickListener = new ClickListener() {
public void buttonClick(ClickEvent event) {
Map<String, Object> accountDetails = createAccountDetails("alfresco", alfrescoUserName.getValue().toString(), alfrescoPassword.getValue().toString(), "server", alfrescoServer.getValue().toString());
fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
}
};
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class ProfilePanel method initAboutSection.
protected void initAboutSection() {
// Header
HorizontalLayout header = new HorizontalLayout();
header.setWidth(100, UNITS_PERCENTAGE);
header.addStyleName(ExplorerLayout.STYLE_DETAIL_BLOCK);
infoPanelLayout.addComponent(header);
Label aboutLabel = createProfileHeader(infoPanelLayout, i18nManager.getMessage(Messages.PROFILE_ABOUT));
header.addComponent(aboutLabel);
header.setExpandRatio(aboutLabel, 1.0f);
// only show edit/save buttons if current user matches
if (isCurrentLoggedInUser) {
Button actionButton = null;
if (!editable) {
actionButton = initEditProfileButton();
} else {
actionButton = initSaveProfileButton();
}
header.addComponent(actionButton);
header.setComponentAlignment(actionButton, Alignment.MIDDLE_RIGHT);
}
// 'About' fields
GridLayout aboutLayout = createInfoSectionLayout(2, 4);
// Name
if (!editable && (isDefined(user.getFirstName()) || isDefined(user.getLastName()))) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_NAME), user.getFirstName() + " " + user.getLastName());
} else if (editable) {
firstNameField = new TextField();
firstNameField.focus();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_FIRST_NAME), firstNameField, user.getFirstName());
lastNameField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LAST_NAME), lastNameField, user.getLastName());
}
// Job title
if (!editable && isDefined(jobTitle)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitle);
} else if (editable) {
jobTitleField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_JOBTITLE), jobTitleField, jobTitle);
}
// Birthdate
if (!editable && isDefined(birthDate)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDate);
} else if (editable) {
birthDateField = new DateField();
birthDateField.setDateFormat(Constants.DEFAULT_DATE_FORMAT);
birthDateField.setResolution(DateField.RESOLUTION_DAY);
try {
birthDateField.setValue(new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).parse(birthDate));
}// do nothing
catch (Exception e) {
}
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_BIRTHDATE), birthDateField, null);
}
// Location
if (!editable && isDefined(location)) {
addProfileEntry(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), location);
} else if (editable) {
locationField = new TextField();
addProfileInputField(aboutLayout, i18nManager.getMessage(Messages.PROFILE_LOCATION), locationField, location);
}
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class TaskEventsPanel method addInputField.
protected void addInputField() {
HorizontalLayout layout = new HorizontalLayout();
layout.setSpacing(true);
layout.setWidth(100, UNITS_PERCENTAGE);
addComponent(layout);
// Hack: actionHandlers can only be attached to panels or windows
Panel textFieldPanel = new Panel();
textFieldPanel.addStyleName(Reindeer.PANEL_LIGHT);
textFieldPanel.setContent(new VerticalLayout());
textFieldPanel.setWidth(100, UNITS_PERCENTAGE);
layout.addComponent(textFieldPanel);
layout.setExpandRatio(textFieldPanel, 1.0f);
commentInputField = new TextField();
commentInputField.setWidth(100, UNITS_PERCENTAGE);
textFieldPanel.addComponent(commentInputField);
// Hack to catch keyboard 'enter'
textFieldPanel.addActionHandler(new Handler() {
public void handleAction(Action action, Object sender, Object target) {
addNewComment(commentInputField.getValue().toString());
}
public Action[] getActions(Object target, Object sender) {
return new Action[] { new ShortcutAction("enter", ShortcutAction.KeyCode.ENTER, null) };
}
});
addCommentButton = new Button(i18nManager.getMessage(Messages.TASK_ADD_COMMENT));
layout.addComponent(addCommentButton);
layout.setComponentAlignment(addCommentButton, Alignment.MIDDLE_LEFT);
addCommentButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
addNewComment(commentInputField.getValue().toString());
}
});
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class StringFormPropertyRenderer method getPropertyField.
@Override
public Field getPropertyField(FormProperty formProperty) {
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());
}
return textField;
}
use of com.vaadin.ui.TextField in project Activiti by Activiti.
the class NewGroupPopupWindow method initInputFields.
protected void initInputFields() {
// Input fields
form.addField("id", new TextField(i18nManager.getMessage(Messages.GROUP_ID)));
// Set id field to required
form.getField("id").setRequired(true);
form.getField("id").setRequiredError(i18nManager.getMessage(Messages.GROUP_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.GROUP_ID_UNIQUE));
}
}
public boolean isValid(Object value) {
if (value != null) {
return identityService.createGroupQuery().groupId(value.toString()).singleResult() == null;
}
return false;
}
});
form.addField("name", new TextField(i18nManager.getMessage(Messages.GROUP_NAME)));
ComboBox typeComboBox = new ComboBox(i18nManager.getMessage(Messages.GROUP_TYPE), Arrays.asList("assignment", "security-role"));
typeComboBox.select("assignment");
form.addField("type", typeComboBox);
}
Aggregations