use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class OrgMemberPanel method createManagerContainer.
private WebMarkupContainer createManagerContainer() {
WebMarkupContainer managerContainer = new WebMarkupContainer(ID_CONTAINER_MANAGER);
managerContainer.setOutputMarkupId(true);
managerContainer.setOutputMarkupPlaceholderTag(true);
RepeatingView view = new RepeatingView(ID_MANAGER_TABLE);
view.setOutputMarkupId(true);
ObjectQuery managersQuery = createManagerQuery();
OperationResult searchManagersResult = new OperationResult(OPERATION_SEARCH_MANAGERS);
Collection<SelectorOptions<GetOperationOptions>> options = SelectorOptions.createCollection(FocusType.F_JPEG_PHOTO, GetOperationOptions.createRetrieve(RetrieveOption.INCLUDE));
List<PrismObject<FocusType>> managers = WebModelServiceUtils.searchObjects(FocusType.class, managersQuery, options, searchManagersResult, getPageBase());
Task task = getPageBase().createSimpleTask(OPERATION_LOAD_MANAGERS);
for (PrismObject<FocusType> manager : managers) {
ObjectWrapper<FocusType> managerWrapper = ObjectWrapperUtil.createObjectWrapper(WebComponentUtil.getEffectiveName(manager, RoleType.F_DISPLAY_NAME), "", manager, ContainerStatus.MODIFYING, task, getPageBase());
WebMarkupContainer managerMarkup = new WebMarkupContainer(view.newChildId());
AjaxLink<String> link = new AjaxLink<String>(ID_EDIT_MANAGER) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent().get(ID_MANAGER_SUMMARY);
detailsPerformed(target, summary.getModelObject());
}
};
link.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
boolean isVisible = false;
try {
isVisible = getPageBase().getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_READ_ACTION_URL, AuthorizationPhaseType.REQUEST, managerWrapper.getObject(), null, null, null);
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to check authorization for #read operation on object " + managerWrapper.getObject(), ex);
}
return isVisible;
}
});
if (manager.getCompileTimeClass().equals(UserType.class)) {
managerMarkup.add(new UserSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<UserType>>((ObjectWrapper) managerWrapper)));
} else if (manager.getCompileTimeClass().equals(RoleType.class)) {
managerMarkup.add(new RoleSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<RoleType>>((ObjectWrapper) managerWrapper)));
} else if (manager.getCompileTimeClass().equals(OrgType.class)) {
managerMarkup.add(new OrgSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<OrgType>>((ObjectWrapper) managerWrapper)));
} else if (manager.getCompileTimeClass().equals(ServiceType.class)) {
managerMarkup.add(new ServiceSummaryPanel(ID_MANAGER_SUMMARY, new Model<ObjectWrapper<ServiceType>>((ObjectWrapper) managerWrapper)));
}
link.setOutputMarkupId(true);
managerMarkup.setOutputMarkupId(true);
managerMarkup.add(link);
view.add(managerMarkup);
AjaxButton removeManager = new AjaxButton(ID_REMOVE_MANAGER) {
@Override
public void onClick(AjaxRequestTarget target) {
FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent().get(ID_MANAGER_SUMMARY);
removeManagerPerformed(summary.getModelObject(), target);
getParent().setVisible(false);
target.add(OrgMemberPanel.this);
}
};
removeManager.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
boolean isVisible = false;
try {
isVisible = getPageBase().getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_UNASSIGN_ACTION_URL, null, managerWrapper.getObject(), null, getModelObject().asPrismObject(), null);
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to check authorization for #unassign operation on object " + managerWrapper.getObject(), ex);
}
return isVisible;
}
});
removeManager.setOutputMarkupId(true);
managerMarkup.add(removeManager);
AjaxButton deleteManager = new AjaxButton(ID_DELETE_MANAGER) {
@Override
public void onClick(AjaxRequestTarget target) {
FocusSummaryPanel<FocusType> summary = (FocusSummaryPanel<FocusType>) getParent().get(ID_MANAGER_SUMMARY);
deleteManagerPerformed(summary.getModelObject(), this, target);
}
};
deleteManager.setOutputMarkupId(true);
deleteManager.add(new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
boolean isVisible = false;
try {
isVisible = getPageBase().getSecurityEnforcer().isAuthorized(AuthorizationConstants.AUTZ_UI_DELETE_ACTION_URL, null, managerWrapper.getObject(), null, null, null);
} catch (Exception ex) {
LoggingUtils.logUnexpectedException(LOGGER, "Failed to check authorization for #delete operation on object " + managerWrapper.getObject(), ex);
}
return isVisible;
}
});
managerMarkup.add(deleteManager);
}
managerContainer.add(view);
InlineMenu menupanel = new InlineMenu(ID_MANAGER_MENU, new Model<Serializable>((Serializable) createManagersHeaderInlineMenu()));
add(menupanel);
menupanel.setOutputMarkupId(true);
managerContainer.add(menupanel);
return managerContainer;
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class OrgMemberPanel method createManagersHeaderInlineMenu.
private List<InlineMenuItem> createManagersHeaderInlineMenu() {
List<InlineMenuItem> headerMenuItems = new ArrayList<>();
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.createManager"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
OrgMemberPanel.this.createFocusMemberPerformed(SchemaConstants.ORG_MANAGER, target);
}
}));
headerMenuItems.add(new InlineMenuItem());
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.addManagers"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
OrgMemberPanel.this.addMembers(SchemaConstants.ORG_MANAGER, target);
}
}));
headerMenuItems.add(new InlineMenuItem());
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.removeManagersAll"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
removeManagersPerformed(QueryScope.ALL, target);
}
}));
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.recomputeManagersAll"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
recomputeManagersPerformed(QueryScope.ALL, target);
}
}));
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.deleteManagersAll"), false, new HeaderMenuAction(this) {
private static final long serialVersionUID = 1L;
@Override
public void onClick(AjaxRequestTarget target) {
OrgMemberPanel.this.deleteMemberPerformed(QueryScope.ALL, SchemaConstants.ORG_MANAGER, target, "TreeTablePanel.menu.deleteManagersAll.confirm");
}
}));
return headerMenuItems;
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class OrgMemberPanel method createMembersHeaderInlineMenu.
@Override
protected List<InlineMenuItem> createMembersHeaderInlineMenu() {
List<InlineMenuItem> headerMenuItems = super.createMembersHeaderInlineMenu();
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.deleteMember"), false, new HeaderMenuAction(this) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteMemberPerformed(QueryScope.SELECTED, null, target, "TreeTablePanel.menu.deleteMember.confirm");
}
}));
headerMenuItems.add(new InlineMenuItem(createStringResource("TreeTablePanel.menu.deleteAllMembers"), false, new HeaderMenuAction(this) {
@Override
public void onClick(AjaxRequestTarget target) {
deleteMemberPerformed(QueryScope.ALL, null, target, "TreeTablePanel.menu.deleteAllMembers.confirm");
}
}));
return headerMenuItems;
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class PageUsers method mergePerformed.
private void mergePerformed(AjaxRequestTarget target, final UserType selectedUser) {
List<QName> supportedTypes = new ArrayList<>();
supportedTypes.add(UserType.COMPLEX_TYPE);
ObjectFilter filter = InOidFilter.createInOid(selectedUser.getOid());
ObjectFilter notFilter = NotFilter.createNot(filter);
ObjectBrowserPanel<UserType> panel = new ObjectBrowserPanel<UserType>(getMainPopupBodyId(), UserType.class, supportedTypes, false, PageUsers.this, notFilter) {
private static final long serialVersionUID = 1L;
@Override
protected void onSelectPerformed(AjaxRequestTarget target, UserType user) {
hideMainPopup(target);
mergeConfirmedPerformed(selectedUser, user, target);
}
};
panel.setOutputMarkupId(true);
showMainPopup(panel, target);
}
use of org.apache.wicket.ajax.AjaxRequestTarget in project midpoint by Evolveum.
the class PageXmlDataReview method initLayout.
private void initLayout(IModel<String> title, IModel<String> data) {
WebMarkupContainer container = new WebMarkupContainer(ID_ACE_EDITOR_CONTAINER);
container.setOutputMarkupId(true);
add(container);
AceEditorPanel aceEditorPanel = new AceEditorPanel(ID_ACE_EDITOR_PANEL, title, data);
aceEditorPanel.getEditor().setReadonly(true);
aceEditorPanel.setOutputMarkupId(true);
container.add(aceEditorPanel);
AjaxButton back = new AjaxButton(ID_BUTTON_BACK, createStringResource("PageBase.button.back")) {
@Override
public void onClick(AjaxRequestTarget target) {
redirectBack();
}
};
add(back);
}
Aggregations