use of com.vaadin.ui.DateField in project Activiti by Activiti.
the class NewCasePopupWindow method initForm.
protected void initForm() {
form = new Form();
form.setValidationVisibleOnCommit(true);
form.setImmediate(true);
addComponent(form);
// name
nameField = new TextField(i18nManager.getMessage(Messages.TASK_NAME));
nameField.focus();
nameField.setRequired(true);
nameField.setRequiredError(i18nManager.getMessage(Messages.TASK_NAME_REQUIRED));
form.addField("name", nameField);
// description
descriptionArea = new TextArea(i18nManager.getMessage(Messages.TASK_DESCRIPTION));
descriptionArea.setColumns(25);
form.addField("description", descriptionArea);
// duedate
dueDateField = new DateField(i18nManager.getMessage(Messages.TASK_DUEDATE));
dueDateField.setResolution(DateField.RESOLUTION_DAY);
form.addField("duedate", dueDateField);
// priority
priorityComboBox = new PriorityComboBox(i18nManager);
form.addField("priority", priorityComboBox);
}
use of com.vaadin.ui.DateField in project Activiti by Activiti.
the class ChangeProcessSuspensionStatePopupWindow method addTimeSection.
protected void addTimeSection(boolean suspend) {
Label timeLabel = new Label(suspend ? i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DESCRIPTION) : i18nManager.getMessage(Messages.PROCESS_ACTIVATE_POPUP_TIME_DESCRIPTION));
verticalLayout.addComponent(timeLabel);
verticalLayout.addComponent(new Label(" ", Label.CONTENT_XHTML));
nowCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_NOW), true);
nowCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
nowCheckBox.setImmediate(true);
nowCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (nowCheckBox.booleanValue() == true) {
dateField.setValue(null);
dateCheckBox.setValue(false);
} else {
dateCheckBox.setValue(true);
dateField.setValue(new Date());
}
}
});
verticalLayout.addComponent(nowCheckBox);
HorizontalLayout dateLayout = new HorizontalLayout();
verticalLayout.addComponent(dateLayout);
dateCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_SUSPEND_POPUP_TIME_DATE));
dateCheckBox.addStyleName(ExplorerLayout.STYLE_PROCESS_DEFINITION_SUSPEND_CHOICE);
dateCheckBox.setImmediate(true);
dateCheckBox.addListener(new ClickListener() {
public void buttonClick(ClickEvent event) {
if (dateCheckBox.booleanValue() == true) {
dateField.setValue(new Date());
nowCheckBox.setValue(false);
} else {
dateField.setValue(null);
nowCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateCheckBox);
dateField = new DateField();
dateField.setImmediate(true);
dateField.addListener(new ValueChangeListener() {
public void valueChange(ValueChangeEvent event) {
if (dateField.getValue() != null) {
nowCheckBox.setValue(false);
dateCheckBox.setValue(true);
}
}
});
dateLayout.addComponent(dateField);
}
use of com.vaadin.ui.DateField 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.DateField in project Activiti by Activiti.
the class DueDateComponent method initDueDateField.
protected void initDueDateField() {
dueDateField = new DateField();
if (task.getDueDate() != null) {
dueDateField.setValue(task.getDueDate());
} else {
dueDateField.setValue(new Date());
}
dueDateField.setWidth(125, UNITS_PIXELS);
dueDateField.setResolution(DateField.RESOLUTION_DAY);
dueDateField.setImmediate(true);
}
Aggregations