Search in sources :

Example 1 with SubmitEventListener

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

the class GroupDetailPanel method initAddMembersButton.

protected void initAddMembersButton(HorizontalLayout membersHeader) {
    Button addButton = new Button();
    addButton.addStyleName(ExplorerLayout.STYLE_ADD);
    membersHeader.addComponent(addButton);
    membersHeader.setComponentAlignment(addButton, Alignment.MIDDLE_RIGHT);
    addButton.addListener(new ClickListener() {

        public void buttonClick(ClickEvent event) {
            final SelectUsersPopupWindow selectUsersPopup = new SelectUsersPopupWindow(i18nManager.getMessage(Messages.GROUP_SELECT_MEMBERS, group.getId()), true, false, getCurrentMembers());
            ExplorerApp.get().getViewManager().showPopupWindow(selectUsersPopup);
            // Listen to submit events (that contain the selected users)
            selectUsersPopup.addListener(new SubmitEventListener() {

                protected void submitted(SubmitEvent event) {
                    Collection<String> userIds = selectUsersPopup.getSelectedUserIds();
                    if (!userIds.isEmpty()) {
                        for (String userId : userIds) {
                            identityService.createMembership(userId, group.getId());
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
        }
    });
}
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 2 with SubmitEventListener

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

the class UserDetailPanel method initAddGroupsButton.

protected void initAddGroupsButton(HorizontalLayout groupHeader) {
    Button addRelatedContentButton = new Button();
    addRelatedContentButton.addStyleName(ExplorerLayout.STYLE_ADD);
    groupHeader.addComponent(addRelatedContentButton);
    groupHeader.setComponentAlignment(addRelatedContentButton, Alignment.MIDDLE_RIGHT);
    addRelatedContentButton.addListener(new ClickListener() {

        private static final long serialVersionUID = 1L;

        public void buttonClick(ClickEvent event) {
            final GroupSelectionPopupWindow selectionPopup = new GroupSelectionPopupWindow(identityService, user.getId());
            selectionPopup.addListener(new SubmitEventListener() {

                private static final long serialVersionUID = 1L;

                protected void submitted(SubmitEvent event) {
                    Set<String> selectedGroups = selectionPopup.getSelectedGroupIds();
                    if (!selectedGroups.isEmpty()) {
                        for (String groupId : selectedGroups) {
                            identityService.createMembership(user.getId(), groupId);
                        }
                        notifyMembershipChanged();
                    }
                }

                protected void cancelled(SubmitEvent event) {
                }
            });
            ExplorerApp.get().getViewManager().showPopupWindow(selectionPopup);
        }
    });
}
Also used : 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 3 with SubmitEventListener

use of org.activiti.explorer.ui.event.SubmitEventListener 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 4 with SubmitEventListener

use of org.activiti.explorer.ui.event.SubmitEventListener 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 5 with SubmitEventListener

use of org.activiti.explorer.ui.event.SubmitEventListener 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)

Aggregations

SubmitEvent (org.activiti.explorer.ui.event.SubmitEvent)6 SubmitEventListener (org.activiti.explorer.ui.event.SubmitEventListener)6 Button (com.vaadin.ui.Button)4 SelectUsersPopupWindow (org.activiti.explorer.ui.custom.SelectUsersPopupWindow)4 ClickEvent (com.vaadin.ui.Button.ClickEvent)3 ClickListener (com.vaadin.ui.Button.ClickListener)3 HorizontalLayout (com.vaadin.ui.HorizontalLayout)1 Label (com.vaadin.ui.Label)1 CreateAttachmentPopupWindow (org.activiti.explorer.ui.content.CreateAttachmentPopupWindow)1