use of org.activiti.explorer.ui.custom.SelectUsersPopupWindow 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) {
}
});
}
});
}
use of org.activiti.explorer.ui.custom.SelectUsersPopupWindow 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);
}
});
}
use of org.activiti.explorer.ui.custom.SelectUsersPopupWindow 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);
}
use of org.activiti.explorer.ui.custom.SelectUsersPopupWindow 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);
}
Aggregations