use of com.evolveum.midpoint.web.component.assignment.TargetUserSelectorComponent in project midpoint by Evolveum.
the class PageAssignmentsList method initLayout.
public void initLayout() {
setOutputMarkupId(true);
Form mainForm = new Form(ID_FORM);
mainForm.setOutputMarkupId(true);
add(mainForm);
AssignmentTablePanel panel = new AssignmentTablePanel<UserType>(ID_ASSIGNMENT_TABLE_PANEL, createStringResource("FocusType.assignment"), assignmentsModel, PageAssignmentsList.this) {
@Override
protected List<InlineMenuItem> createAssignmentMenu() {
List<InlineMenuItem> items = new ArrayList<>();
InlineMenuItem item = new InlineMenuItem(createStringResource("AssignmentTablePanel.menu.unassign"), new InlineMenuItemAction() {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
deleteAssignmentPerformed(target);
}
});
items.add(item);
return items;
}
};
mainForm.add(panel);
WebMarkupContainer targetUserPanel = new TargetUserSelectorComponent(ID_TARGET_USER_PANEL, PageAssignmentsList.this);
targetUserPanel.setOutputMarkupId(true);
mainForm.add(targetUserPanel);
TextArea descriptionInput = new TextArea<String>(ID_DESCRIPTION, descriptionModel);
descriptionInput.add(new AjaxFormComponentUpdatingBehavior("blur") {
@Override
protected void onUpdate(AjaxRequestTarget target) {
getSessionStorage().getRoleCatalog().setRequestDescription(getDescriptionComponent().getValue());
}
});
mainForm.add(descriptionInput);
AjaxButton back = new AjaxButton(ID_BACK, createStringResource("PageAssignmentDetails.backButton")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
mainForm.add(back);
AjaxSubmitButton requestAssignments = new AjaxSubmitButton(ID_REQUEST_BUTTON, createStringResource("PageAssignmentsList.requestButton")) {
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
if (getSessionStorage().getRoleCatalog().getTargetUserList() == null || getSessionStorage().getRoleCatalog().getTargetUserList().size() <= 1) {
onSingleUserRequestPerformed(target);
} else {
onMultiUserRequestPerformed(target);
}
}
};
requestAssignments.add(new VisibleEnableBehaviour() {
@Override
public boolean isEnabled() {
return getSessionStorage().getRoleCatalog().isMultiUserRequest() || areConflictsResolved();
}
});
mainForm.add(requestAssignments);
AjaxSubmitButton resolveAssignments = new AjaxSubmitButton(ID_RESOLVE_CONFLICTS_BUTTON, createStringResource("PageAssignmentsList.resolveConflicts")) {
@Override
protected void onError(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
target.add(getFeedbackPanel());
}
@Override
protected void onSubmit(AjaxRequestTarget target, org.apache.wicket.markup.html.form.Form<?> form) {
PageAssignmentsList.this.navigateToNext(PageAssignmentConflicts.class);
}
};
resolveAssignments.add(new VisibleEnableBehaviour() {
@Override
public boolean isVisible() {
return !getSessionStorage().getRoleCatalog().isMultiUserRequest() && getSessionStorage().getRoleCatalog().getConflictsList() != null && getSessionStorage().getRoleCatalog().getConflictsList().size() > 0;
}
});
mainForm.add(resolveAssignments);
}
Aggregations