use of com.vaadin.ui.Button in project Activiti by Activiti.
the class TaskTable method generateActionButtons.
protected HorizontalLayout generateActionButtons(Object taskItemId) {
HorizontalLayout actionButtons = new HorizontalLayout();
FormDefinition form = taskFormModel.getForm(taskItemId);
Button formButton = new Button(form == null ? i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_CREATE) : i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_FORM_EDIT));
formButton.addListener(new ShowFormClickListener(taskFormModel, taskItemId));
formButton.setData(taskItemId);
actionButtons.addComponent(formButton);
Button deleteTaskButton = new Button("-");
deleteTaskButton.setData(taskItemId);
deleteTaskButton.addListener(new DeleteTaskClickListener(this));
actionButtons.addComponent(deleteTaskButton);
Button addTaskButton = new Button("+");
addTaskButton.setData(taskItemId);
addTaskButton.addListener(new AddTaskClickListener(this));
actionButtons.addComponent(addTaskButton);
return actionButtons;
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class ChangePasswordPopupWindow method initChangePasswordButton.
protected void initChangePasswordButton() {
errorLabel = new Label(" ", Label.CONTENT_XHTML);
errorLabel.addStyleName(Reindeer.LABEL_SMALL);
errorLabel.addStyleName(ExplorerLayout.STYLE_LABEL_RED);
layout.addComponent(errorLabel);
Button changePasswordButton = new Button(i18nManager.getMessage(Messages.PASSWORD_CHANGE));
layout.addComponent(changePasswordButton);
layout.setComponentAlignment(changePasswordButton, Alignment.MIDDLE_CENTER);
changePasswordButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
handlePasswordChange();
}
});
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class ProfilePanel method initEditProfileButton.
protected Button initEditProfileButton() {
Button editProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_EDIT));
editProfileButton.setIcon(Images.EDIT);
editProfileButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
editable = true;
initUi();
}
});
return editProfileButton;
}
use of com.vaadin.ui.Button in project Activiti by Activiti.
the class ProfilePanel method initSaveProfileButton.
protected Button initSaveProfileButton() {
Button saveProfileButton = new Button(i18nManager.getMessage(Messages.PROFILE_SAVE));
saveProfileButton.setIcon(Images.SAVE);
saveProfileButton.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
user.setFirstName((String) firstNameField.getValue());
user.setLastName((String) lastNameField.getValue());
user.setEmail((String) emailField.getValue());
identityService.saveUser(user);
identityService.setUserInfo(user.getId(), Constants.USER_INFO_JOB_TITLE, jobTitleField.getValue().toString());
if (birthDateField.getValue() != null && !"".equals(birthDateField.getValue().toString())) {
identityService.setUserInfo(user.getId(), Constants.USER_INFO_BIRTH_DATE, new SimpleDateFormat(Constants.DEFAULT_DATE_FORMAT).format(birthDateField.getValue()));
}
identityService.setUserInfo(user.getId(), Constants.USER_INFO_LOCATION, locationField.getValue().toString());
identityService.setUserInfo(user.getId(), Constants.USER_INFO_PHONE, phoneField.getValue().toString());
identityService.setUserInfo(user.getId(), Constants.USER_INFO_TWITTER, twitterField.getValue().toString());
identityService.setUserInfo(user.getId(), Constants.USER_INFO_SKYPE, skypeField.getValue().toString());
// UI
editable = false;
loadProfileData();
initUi();
}
});
return saveProfileButton;
}
use of com.vaadin.ui.Button 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);
}
}
Aggregations