Search in sources :

Example 6 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent in project Activiti by Activiti.

the class TaskInvolvedPeopleComponent method initAddPeopleButton.

protected void initAddPeopleButton(HorizontalLayout headerLayout) {
    addPeopleButton = new Button();
    addPeopleButton.addStyleName(ExplorerLayout.STYLE_ADD);
    headerLayout.addComponent(addPeopleButton);
    addPeopleButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow involvePeoplePopupWindow = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.PEOPLE_INVOLVE_POPUP_CAPTION), true);
            involvePeoplePopupWindow.addListener(new SubmitEventListener() {

                protected void submitted(SubmitEvent event) {
                    Collection<String> selectedUserIds = involvePeoplePopupWindow.getSelectedUserIds();
                    for (String userId : selectedUserIds) {
                        String role = involvePeoplePopupWindow.getSelectedUserRole(userId);
                        taskService.addUserIdentityLink(task.getId(), userId, role);
                    }
                    taskDetailPanel.notifyPeopleInvolvedChanged();
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
            viewManager.showPopupWindow(involvePeoplePopupWindow);
        }
    });
}
Also used : SelectUsersPopupWindow(org.activiti.explorer.ui.custom.SelectUsersPopupWindow) Button(com.vaadin.ui.Button) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) ClickEvent(com.vaadin.ui.Button.ClickEvent) ClickListener(com.vaadin.ui.Button.ClickListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 7 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent in project Activiti by Activiti.

the class TaskRelatedContentComponent method initActions.

protected void initActions() {
    HorizontalLayout actionsContainer = new HorizontalLayout();
    actionsContainer.setSizeFull();
    // Title
    Label processTitle = new Label(i18nManager.getMessage(Messages.TASK_RELATED_CONTENT));
    processTitle.addStyleName(ExplorerLayout.STYLE_H3);
    processTitle.setSizeFull();
    actionsContainer.addComponent(processTitle);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_LEFT);
    actionsContainer.setExpandRatio(processTitle, 1.0f);
    // Add content button
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    addRelatedContentButton.addListener(new com.vaadin.ui.Button.ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(com.vaadin.ui.Button.ClickEvent event) {
            CreateAttachmentPopupWindow popup = new CreateAttachmentPopupWindow();
            if (task.getProcessInstanceId() != null) {
                popup.setProcessInstanceId(task.getProcessInstanceId());
            } else {
                popup.setTaskId(task.getId());
            }
            // Add listener to update attachments when added
            popup.addListener(new SubmitEventListener() {

                private static final long serialVersionUID = 1L;

                @Override
                protected void submitted(SubmitEvent event) {
                    taskDetailPanel.notifyRelatedContentChanged();
                }

                @Override
                protected void cancelled(SubmitEvent event) {
                // No attachment was added so updating UI isn't needed.
                }
            });
            ExplorerApp.get().getViewManager().showPopupWindow(popup);
        }
    });
    actionsContainer.addComponent(addRelatedContentButton);
    actionsContainer.setComponentAlignment(processTitle, Alignment.MIDDLE_RIGHT);
    addComponent(actionsContainer);
}
Also used : Button(com.vaadin.ui.Button) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) Label(com.vaadin.ui.Label) CreateAttachmentPopupWindow(org.activiti.explorer.ui.content.CreateAttachmentPopupWindow) HorizontalLayout(com.vaadin.ui.HorizontalLayout) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 8 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent in project Activiti by Activiti.

the class ChangeOwnershipListener method buttonClick.

public void buttonClick(ClickEvent event) {
    List<String> ignoredIds = null;
    if (task.getOwner() != null) {
        ignoredIds = Arrays.asList(task.getOwner());
    }
    final SelectUsersPopupWindow involvePeoplePopupWindow = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.TASK_OWNER_TRANSFER), false, ignoredIds);
    involvePeoplePopupWindow.addListener(new SubmitEventListener() {

        private static final long serialVersionUID = 1L;

        protected void submitted(SubmitEvent event) {
            // Update owner
            String selectedUser = involvePeoplePopupWindow.getSelectedUserId();
            task.setOwner(selectedUser);
            ProcessEngines.getDefaultProcessEngine().getTaskService().setOwner(task.getId(), selectedUser);
            // Update UI
            taskDetailPanel.notifyOwnerChanged();
        }

        protected void cancelled(SubmitEvent event) {
        }
    });
    ExplorerApp.get().getViewManager().showPopupWindow(involvePeoplePopupWindow);
}
Also used : SelectUsersPopupWindow(org.activiti.explorer.ui.custom.SelectUsersPopupWindow) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 9 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent in project Activiti by Activiti.

the class ReassignAssigneeListener method buttonClick.

public void buttonClick(ClickEvent event) {
    List<String> ignoredIds = null;
    if (task.getAssignee() != null) {
        ignoredIds = Arrays.asList(task.getAssignee());
    }
    final SelectUsersPopupWindow involvePeoplePopupWindow = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.TASK_ASSIGNEE_REASSIGN), false, ignoredIds);
    involvePeoplePopupWindow.addListener(new SubmitEventListener() {

        protected void submitted(SubmitEvent event) {
            // Update assignee
            String selectedUser = involvePeoplePopupWindow.getSelectedUserId();
            String originAssignee = task.getAssignee();
            task.setAssignee(selectedUser);
            if (selectedUser != null) {
                ProcessEngines.getDefaultProcessEngine().getTaskService().setAssignee(task.getId(), selectedUser);
            } else if (originAssignee != null) {
                ProcessEngines.getDefaultProcessEngine().getTaskService().deleteUserIdentityLink(task.getId(), originAssignee, IdentityLinkType.ASSIGNEE);
            } else {
                return;
            }
            // Update UI
            taskDetailPanel.notifyAssigneeChanged();
        }

        protected void cancelled(SubmitEvent event) {
        }
    });
    ExplorerApp.get().getViewManager().showPopupWindow(involvePeoplePopupWindow);
}
Also used : SelectUsersPopupWindow(org.activiti.explorer.ui.custom.SelectUsersPopupWindow) SubmitEventListener(org.activiti.explorer.ui.event.SubmitEventListener) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Example 10 with SubmitEvent

use of org.activiti.explorer.ui.event.SubmitEvent in project Activiti by Activiti.

the class CreateAttachmentPopupWindow method saveAttachment.

protected void saveAttachment() {
    try {
        // Creation and persistence of attachment is done in editor
        Attachment attachment = currentEditor.getAttachment();
        fireEvent(new SubmitEvent(this, SubmitEvent.SUBMITTED, attachment));
        // Finally, close window
        close();
    } catch (InvalidValueException ive) {
    // Validation error, Editor UI will handle this.
    }
}
Also used : InvalidValueException(com.vaadin.data.Validator.InvalidValueException) Attachment(org.activiti.engine.task.Attachment) SubmitEvent(org.activiti.explorer.ui.event.SubmitEvent)

Aggregations

SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)12 ClickEvent (com.vaadin.ui.Button.ClickEvent)8 ClickListener (com.vaadin.ui.Button.ClickListener)8 Button (com.vaadin.ui.Button)7 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)6 SelectUsersPopupWindow (org.activiti.explorer.ui.custom.SelectUsersPopupWindow)4 Form (com.vaadin.ui.Form)2 PasswordField (com.vaadin.ui.PasswordField)2 TextField (com.vaadin.ui.TextField)2 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ValueChangeEvent (com.vaadin.data.Property.ValueChangeEvent)1 ValueChangeListener (com.vaadin.data.Property.ValueChangeListener)1 InvalidValueException (com.vaadin.data.Validator.InvalidValueException)1 CheckBox (com.vaadin.ui.CheckBox)1 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 VerticalLayout (com.vaadin.ui.VerticalLayout)1 Attachment (org.activiti.engine.task.Attachment)1 LoggedInUser (org.activiti.explorer.identity.LoggedInUser)1