Search in sources :

Example 1 with DynRealmWrapper

use of org.apache.syncope.client.console.wizards.DynRealmWrapper in project syncope by apache.

the class DynRealmDirectoryPanel method getActions.

@Override
public ActionsPanel<DynRealmTO> getActions(final IModel<DynRealmTO> model) {
    final ActionsPanel<DynRealmTO> panel = super.getActions(model);
    panel.add(new ActionLink<DynRealmTO>() {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
            modal.header(new StringResourceModel("any.edit", model));
            modal.setContent(new DynRealmModalPanel(new DynRealmWrapper(model.getObject()), false, modal, pageRef));
            modal.show(true);
            target.add(modal);
        }
    }, ActionLink.ActionType.EDIT, StandardEntitlement.DYNREALM_UPDATE);
    panel.add(new ActionLink<DynRealmTO>() {

        private static final long serialVersionUID = 3766262567901552032L;

        @Override
        public void onClick(final AjaxRequestTarget target, final DynRealmTO ignore) {
            try {
                restClient.delete(model.getObject().getKey());
                SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                target.add(container);
            } catch (SyncopeClientException e) {
                LOG.error("While deleting dynamic realm {}", model.getObject().getKey(), e);
                SyncopeConsoleSession.get().error(StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
            }
            ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
        }
    }, ActionLink.ActionType.DELETE, StandardEntitlement.DYNREALM_DELETE, true);
    return panel;
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) DynRealmWrapper(org.apache.syncope.client.console.wizards.DynRealmWrapper) SyncopeClientException(org.apache.syncope.common.lib.SyncopeClientException) DynRealmTO(org.apache.syncope.common.lib.to.DynRealmTO) BasePage(org.apache.syncope.client.console.pages.BasePage) StringResourceModel(org.apache.wicket.model.StringResourceModel)

Aggregations

BasePage (org.apache.syncope.client.console.pages.BasePage)1 DynRealmWrapper (org.apache.syncope.client.console.wizards.DynRealmWrapper)1 SyncopeClientException (org.apache.syncope.common.lib.SyncopeClientException)1 DynRealmTO (org.apache.syncope.common.lib.to.DynRealmTO)1 AjaxRequestTarget (org.apache.wicket.ajax.AjaxRequestTarget)1 StringResourceModel (org.apache.wicket.model.StringResourceModel)1