Search in sources :

Example 6 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class TaskTable method addTaskRow.

protected Object addTaskRow(Object previousTaskItemId, String taskName, String taskAssignee, String taskGroups, String taskDescription, Boolean startWithPrevious) {
    Object newItemId = null;
    if (previousTaskItemId == null) {
        // add at the end of list
        newItemId = addItem();
    } else {
        newItemId = addItemAfter(previousTaskItemId);
    }
    Item newItem = getItem(newItemId);
    // name
    newItem.getItemProperty(ID_NAME).setValue(taskName == null ? "my task" : taskName);
    // assignee
    ComboBox assigneeComboBox = new ComboBox();
    assigneeComboBox.setNullSelectionAllowed(true);
    try {
        for (User user : ProcessEngines.getDefaultProcessEngine().getIdentityService().createUserQuery().orderByUserFirstName().asc().list()) {
            assigneeComboBox.addItem(user.getId());
            assigneeComboBox.setItemCaption(user.getId(), user.getFirstName() + " " + user.getLastName());
        }
    } catch (Exception e) {
    // Don't do anything. Will be an empty dropdown.
    }
    if (taskAssignee != null) {
        assigneeComboBox.select(taskAssignee);
    }
    newItem.getItemProperty(ID_ASSIGNEE).setValue(assigneeComboBox);
    // groups
    ComboBox groupComboBox = new ComboBox();
    groupComboBox.setNullSelectionAllowed(true);
    try {
        for (Group group : ProcessEngines.getDefaultProcessEngine().getIdentityService().createGroupQuery().orderByGroupName().asc().list()) {
            groupComboBox.addItem(group.getId());
            groupComboBox.setItemCaption(group.getId(), group.getName());
        }
    } catch (Exception e) {
    // Don't do anything. Will be an empty dropdown.
    }
    if (taskGroups != null) {
        groupComboBox.select(taskGroups);
    }
    newItem.getItemProperty(ID_GROUPS).setValue(groupComboBox);
    // description
    TextField descriptionTextField = new TextField();
    descriptionTextField.setColumns(16);
    descriptionTextField.setRows(1);
    if (taskDescription != null) {
        descriptionTextField.setValue(taskDescription);
    }
    newItem.getItemProperty(ID_DESCRIPTION).setValue(descriptionTextField);
    // concurrency
    CheckBox startWithPreviousCheckBox = new CheckBox(i18nManager.getMessage(Messages.PROCESS_EDITOR_TASK_START_WITH_PREVIOUS));
    startWithPreviousCheckBox.setValue(startWithPrevious == null ? false : startWithPrevious);
    newItem.getItemProperty(ID_START_WITH_PREVIOUS).setValue(startWithPreviousCheckBox);
    // actions
    newItem.getItemProperty(ID_ACTIONS).setValue(generateActionButtons(newItemId));
    return newItemId;
}
Also used : Item(com.vaadin.data.Item) Group(org.activiti.engine.identity.Group) User(org.activiti.engine.identity.User) ComboBox(com.vaadin.ui.ComboBox) CheckBox(com.vaadin.ui.CheckBox) TextField(com.vaadin.ui.TextField)

Example 7 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class AccountSelectionPopup method initImapComponent.

protected void initImapComponent() {
    imapForm = new Form();
    imapForm.setDescription(i18nManager.getMessage(Messages.IMAP_DESCRIPTION));
    final TextField imapServer = new TextField(i18nManager.getMessage(Messages.IMAP_SERVER));
    imapForm.getLayout().addComponent(imapServer);
    final TextField imapPort = new TextField(i18nManager.getMessage(Messages.IMAP_PORT));
    imapPort.setWidth(30, UNITS_PIXELS);
    // Default imap port (non-ssl)
    imapPort.setValue(143);
    imapForm.getLayout().addComponent(imapPort);
    final CheckBox useSSL = new CheckBox(i18nManager.getMessage(Messages.IMAP_SSL));
    useSSL.setValue(false);
    useSSL.setImmediate(true);
    imapForm.getLayout().addComponent(useSSL);
    useSSL.addListener(new ValueChangeListener() {

        public void valueChange(ValueChangeEvent event) {
            imapPort.setValue(((Boolean) useSSL.getValue()) ? 993 : 143);
        }
    });
    final TextField imapUserName = new TextField(i18nManager.getMessage(Messages.IMAP_USERNAME));
    imapForm.getLayout().addComponent(imapUserName);
    final PasswordField imapPassword = new PasswordField(i18nManager.getMessage(Messages.IMAP_PASSWORD));
    imapForm.getLayout().addComponent(imapPassword);
    // Matching listener
    imapClickListener = new ClickListener() {

        public void buttonClick(ClickEvent event) {
            Map<String, Object> accountDetails = createAccountDetails("imap", imapUserName.getValue().toString(), imapPassword.getValue().toString(), "server", imapServer.getValue().toString(), "port", imapPort.getValue().toString(), "ssl", imapPort.getValue().toString());
            fireEvent(new SubmitEvent(AccountSelectionPopup.this, SubmitEvent.SUBMITTED, accountDetails));
        }
    };
}
Also used : ValueChangeEvent(com.vaadin.data.Property.ValueChangeEvent) ValueChangeListener(com.vaadin.data.Property.ValueChangeListener) Form(com.vaadin.ui.Form) CheckBox(com.vaadin.ui.CheckBox) ClickEvent(com.vaadin.ui.Button.ClickEvent) TextField(com.vaadin.ui.TextField) PasswordField(com.vaadin.ui.PasswordField) HashMap(java.util.HashMap) Map(java.util.Map) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 8 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class NewModelPopupWindow method addFields.

protected void addFields() {
    formLayout = new GridLayout(2, 3);
    formLayout.setSpacing(true);
    formLayout.addComponent(new Label(i18nManager.getMessage(Messages.TASK_NAME)));
    nameTextField = new TextField();
    nameTextField.setWidth(25, Sizeable.UNITS_EM);
    nameTextField.focus();
    formLayout.addComponent(nameTextField);
    formLayout.addComponent(new Label(i18nManager.getMessage(Messages.TASK_DESCRIPTION)));
    descriptionTextArea = new TextArea();
    descriptionTextArea.setRows(8);
    descriptionTextArea.setWidth(25, Sizeable.UNITS_EM);
    descriptionTextArea.addStyleName(ExplorerLayout.STYLE_TEXTAREA_NO_RESIZE);
    formLayout.addComponent(descriptionTextArea);
    Label editorLabel = new Label(i18nManager.getMessage(Messages.PROCESS_EDITOR_CHOICE));
    formLayout.addComponent(editorLabel);
    formLayout.setComponentAlignment(editorLabel, Alignment.MIDDLE_LEFT);
    selectEditorComponent = new SelectEditorComponent();
    formLayout.addComponent(selectEditorComponent);
    addComponent(formLayout);
    // Some empty space
    Label emptySpace = new Label("&nbsp;", Label.CONTENT_XHTML);
    addComponent(emptySpace);
}
Also used : GridLayout(com.vaadin.ui.GridLayout) TextArea(com.vaadin.ui.TextArea) Label(com.vaadin.ui.Label) TextField(com.vaadin.ui.TextField)

Example 9 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class FileAttachmentEditorComponent method initName.

protected void initName() {
    TextField nameField = new TextField(i18nManager.getMessage(Messages.RELATED_CONTENT_NAME));
    nameField.focus();
    nameField.setRequired(true);
    nameField.setRequiredError(i18nManager.getMessage(Messages.RELATED_CONTENT_NAME_REQUIRED));
    nameField.setWidth(100, UNITS_PERCENTAGE);
    form.addField("name", nameField);
}
Also used : TextField(com.vaadin.ui.TextField)

Example 10 with TextField

use of com.vaadin.ui.TextField in project Activiti by Activiti.

the class UrlAttachmentEditorComponent method initName.

protected void initName() {
    TextField nameField = new TextField(i18nManager.getMessage(Messages.RELATED_CONTENT_NAME));
    nameField.setWidth(100, UNITS_PERCENTAGE);
    addField("name", nameField);
}
Also used : TextField(com.vaadin.ui.TextField)

Aggregations

TextField (com.vaadin.ui.TextField)79 Test (org.junit.Test)22 Button (com.vaadin.ui.Button)15 Label (com.vaadin.ui.Label)15 HorizontalLayout (com.vaadin.ui.HorizontalLayout)12 VerticalLayout (com.vaadin.ui.VerticalLayout)10 ClickListener (com.vaadin.ui.Button.ClickListener)7 ComboBox (com.vaadin.ui.ComboBox)7 GridLayout (com.vaadin.ui.GridLayout)7 SplitTextField (au.com.vaadinutils.crud.splitFields.SplitTextField)6 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)6 ClickEvent (com.vaadin.ui.Button.ClickEvent)6 PasswordField (com.vaadin.ui.PasswordField)6 CheckBox (com.vaadin.ui.CheckBox)4 Form (com.vaadin.ui.Form)4 TextArea (com.vaadin.ui.TextArea)4 Date (java.util.Date)4 HashMap (java.util.HashMap)4 Property (com.vaadin.data.Property)3 Validator (com.vaadin.data.Validator)3