Search in sources :

Example 6 with SubmitEventListener

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

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