Search in sources :

Example 1 with DateField

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);
}
Also used : Form(com.vaadin.ui.Form) TextArea(com.vaadin.ui.TextArea) TextField(com.vaadin.ui.TextField) DateField(com.vaadin.ui.DateField)

Example 2 with DateField

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("&nbsp", 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);
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) Label(com.vaadin.ui.Label) DateField(com.vaadin.ui.DateField) ClickListener(com.vaadin.ui.Button.ClickListener) Date(java.util.Date) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 3 with 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);
    }
}
Also used : GridLayout(com.vaadin.ui.GridLayout) Button(com.vaadin.ui.Button) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField) DateField(com.vaadin.ui.DateField) SimpleDateFormat(java.text.SimpleDateFormat) HorizontalLayout(com.vaadin.ui.HorizontalLayout)

Example 4 with DateField

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);
}
Also used : DateField(com.vaadin.ui.DateField) Date(java.util.Date)

Aggregations

DateField (com.vaadin.ui.DateField)4 HorizontalLayout (com.vaadin.ui.HorizontalLayout)2 Label (com.vaadin.ui.Label)2 TextField (com.vaadin.ui.TextField)2 Date (java.util.Date)2 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)1 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)1 Button (com.vaadin.ui.Button)1 ClickEvent (com.vaadin.ui.Button.ClickEvent)1 ClickListener (com.vaadin.ui.Button.ClickListener)1 CheckBox (com.vaadin.ui.CheckBox)1 Form (com.vaadin.ui.Form)1 GridLayout (com.vaadin.ui.GridLayout)1 TextArea (com.vaadin.ui.TextArea)1 SimpleDateFormat (java.text.SimpleDateFormat)1