Example usage for org.apache.wicket.markup.html WebMarkupContainer setEnabled

List of usage examples for org.apache.wicket.markup.html WebMarkupContainer setEnabled

Introduction

In this page you can find the example usage for org.apache.wicket.markup.html WebMarkupContainer setEnabled.

Prototype

public final Component setEnabled(final boolean enabled) 

Source Link

Document

Sets whether this component is enabled.

Usage

From source file:au.org.theark.study.web.component.managestudy.form.SearchForm.java

License:Open Source License

@SuppressWarnings("unchecked")
protected void onNew(AjaxRequestTarget target) {
    containerForm.setModelObject(new StudyModelVO());
    Collection<ArkModule> availableArkModules = new ArrayList<ArkModule>();
    availableArkModules = iArkCommonService.getEntityList(ArkModule.class);
    // Hide Admin and Reporting modules from "Available" view
    availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN));
    //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING));

    containerForm.getModelObject().setAvailableArkModules(availableArkModules);// ArkModule from database not LDAP.

    Collection<ArkModule> selectedArkModules = new ArrayList<ArkModule>();
    selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_STUDY));
    selectedArkModules.add(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_SUBJECT));
    containerForm.getModelObject().setSelectedArkModules(selectedArkModules);

    // Hide Summary details on new
    studyCrudContainerVO.getSummaryContainer().setVisible(false);
    target.add(studyCrudContainerVO.getSummaryContainer());

    // Show upload item for new Study
    studyCrudContainerVO.getStudyLogoMarkup().setVisible(true);
    studyCrudContainerVO.getStudyLogoUploadContainer().setVisible(true);

    StudyHelper studyHelper = new StudyHelper();
    studyHelper.setStudyLogo(containerForm.getModelObject().getStudy(), target,
            studyCrudContainerVO.getStudyNameMarkup(), studyCrudContainerVO.getStudyLogoMarkup());

    target.add(studyCrudContainerVO.getStudyLogoMarkup());
    target.add(studyCrudContainerVO.getStudyLogoUploadContainer());

    // Clear context items
    ContextHelper contextHelper = new ContextHelper();
    contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup());
    studyNameTxtFld.setEnabled(true);//from   w w w .j  a v a  2  s.  c o  m

    // Default boolean selections
    containerForm.getModelObject().getStudy().setAutoGenerateSubjectUid(false);
    containerForm.getModelObject().getStudy().setAutoConsent(false);

    // TODO: Suggest moving some of this "onNew" code into DetailPanel/DetailForm's onBeforeRender(..)
    // Disable SubjectUID pattern fields by default for New study
    WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer();
    DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel");
    DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm");
    WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer();
    WebMarkupContainer autoBiocollectionContainer = detailForm.getAutoBiocollectionUidContainer();
    WebMarkupContainer autoBiospecimenContainer = detailForm.getAutoBiospecimenUidContainer();
    WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer();

    // Example auto-generated SubjectUID to "AAA-0000000001" on new
    containerForm.getModelObject().setSubjectUidExample(Constants.SUBJECTUID_EXAMPLE);
    Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl();
    subjectUidExampleLbl.setDefaultModelObject(containerForm.getModelObject().getSubjectUidExample());
    target.add(subjectUidExampleLbl);

    autoSubjectUidcontainer.setEnabled(true);
    autoBiocollectionContainer.setEnabled(true);
    autoBiospecimenContainer.setEnabled(true);
    subjectUidcontainer.setEnabled(false);
    target.add(subjectUidcontainer);

    preProcessDetailPanel(target);
}

From source file:au.org.theark.study.web.component.managestudy.SearchResultListPanel.java

License:Open Source License

private AjaxLink<Study> buildLink(final Study study, final WebMarkupContainer searchResultsContainer) {
    ArkBusyAjaxLink<Study> link = new ArkBusyAjaxLink<Study>("studyName") {

        private static final long serialVersionUID = 1L;

        @SuppressWarnings("unchecked")
        @Override/*from   w  w w  . jav  a 2s  . c o m*/
        public void onClick(AjaxRequestTarget target) {
            Subject currentUser = SecurityUtils.getSubject();

            // Place the selected study in session context for the user
            SecurityUtils.getSubject().getSession().setAttribute(au.org.theark.core.Constants.STUDY_CONTEXT_ID,
                    study.getId());
            SecurityUtils.getSubject().getSession()
                    .removeAttribute(au.org.theark.core.Constants.PERSON_CONTEXT_ID);
            SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.PERSON_TYPE);
            // Clear out any Subject UID placed in session via LIMS
            SecurityUtils.getSubject().getSession().removeAttribute(au.org.theark.core.Constants.SUBJECTUID);

            // Force clearing of Cache to re-load roles for the user for the study
            arkLdapRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals());
            aafRealm.clearCachedAuthorizationInfo(currentUser.getPrincipals());

            Study searchStudy = iArkCommonService.getStudy(study.getId());
            /**************
             * this is code which must not be commented out...was to be utilized to deal with data from WAGER ... 
            //TODO ASAP Dont leave this nasty hack here
            iArkCommonService.convertLimsBiospecimenCustomDataValuesToKeysForThisStudy(searchStudy);~~~
            //TODO ASAP Dont leave this nasty hack here
            iArkCommonService.convertLimsBiocollectionCustomDataValuesToKeysForThisStudy(searchStudy);~~~
            ************/

            Study parentStudy = searchStudy.getParentStudy();

            // Check if the study has been linked to a Main Study and if so get a reference to the main study.
            // studyContainerForm.getModelObject().setLinkedToStudy(linkedToStudy)

            studyContainerForm.getModelObject().setStudy(searchStudy);
            studyContainerForm.getModelObject()
                    .setSubjectUidExample(iArkCommonService.getSubjectUidExample(searchStudy));

            WebMarkupContainer wmc = (WebMarkupContainer) studyCrudContainerVO.getDetailPanelContainer();
            DetailPanel detailsPanel = (DetailPanel) wmc.get("detailPanel");
            DetailForm detailForm = (DetailForm) detailsPanel.get("detailForm");

            // All SubjectUID generator fields grouped within a container(s)
            WebMarkupContainer autoSubjectUidcontainer = detailForm.getAutoSubjectUidContainer();
            WebMarkupContainer autoBiocollectionUidcontainer = detailForm.getAutoBiocollectionUidContainer();
            WebMarkupContainer autoBiospecimenUidcontainer = detailForm.getAutoBiospecimenUidContainer();
            WebMarkupContainer subjectUidcontainer = detailForm.getSubjectUidContainer();

            // Disable all SubjectUID generation fields if subjects exist or is a child study
            if (iArkCommonService.studyHasSubjects(searchStudy) || parentStudy != null) {
                autoSubjectUidcontainer.setEnabled(false);
                subjectUidcontainer.setEnabled(false);
            } else {
                autoSubjectUidcontainer.setEnabled(true);
                if (studyContainerForm.getModelObject().getStudy().getAutoGenerateSubjectUid()) {
                    subjectUidcontainer.setEnabled(true);
                } else {
                    subjectUidcontainer.setEnabled(false);
                }
            }

            // Enable bioSpecimenUidContainer if there are no biospecimens created as yet
            WebMarkupContainer biospecimenUidContainer = detailForm.getBiospecimenUidContainer();
            if (iArkCommonService.studyHasBiospecimen(studyContainerForm.getModelObject().getStudy())) {
                biospecimenUidContainer.setEnabled(false);
                autoBiospecimenUidcontainer.setEnabled(false);
            } else {
                biospecimenUidContainer.setEnabled(parentStudy == null);
                autoBiospecimenUidcontainer.setEnabled(parentStudy == null);
            }

            WebMarkupContainer bioCollectionUidContainer = detailForm.getBioCollectionUidContainer();
            if (iArkCommonService.studyHasBioCollection(studyContainerForm.getModelObject().getStudy())) {
                bioCollectionUidContainer.setEnabled(false);
                autoBiocollectionUidcontainer.setEnabled(false);
            } else {
                bioCollectionUidContainer.setEnabled(parentStudy == null);
                autoBiocollectionUidcontainer.setEnabled(parentStudy == null);
            }

            // Get the Source Modules from database
            Collection<ArkModule> availableArkModules = iArkCommonService.getEntityList(ArkModule.class);
            // Hide Admin and Reporting modules from "Available" view
            availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_ADMIN));
            //availableArkModules.remove(iArkCommonService.getArkModuleByName(ModuleConstants.ARK_MODULE_REPORTING));

            // Get the Modules for the Study from database
            Collection<ArkModule> arkModulesLinkedToStudy = iArkCommonService
                    .getArkModulesLinkedWithStudy(searchStudy);

            studyContainerForm.getModelObject().setAvailableArkModules(availableArkModules);
            studyContainerForm.getModelObject().setSelectedArkModules(arkModulesLinkedToStudy);

            // Store module names linked to study in session
            for (Iterator iterator = arkModulesLinkedToStudy.iterator(); iterator.hasNext();) {
                ArkModule arkModule = (ArkModule) iterator.next();
                SecurityUtils.getSubject().getSession().setAttribute(arkModule.getName(), arkModule.getName());
            }
            studyCrudContainerVO.getSummaryContainer().setVisible(true);

            // Set Study Logo
            studyHelper = new StudyHelper();
            studyHelper.setStudyLogo(searchStudy, target, studyCrudContainerVO.getStudyNameMarkup(),
                    studyCrudContainerVO.getStudyLogoMarkup());

            // Set Context items
            ContextHelper contextHelper = new ContextHelper();
            contextHelper.resetContextLabel(target, studyCrudContainerVO.getArkContextMarkup());
            contextHelper.setStudyContextLabel(target, searchStudy.getName(),
                    studyCrudContainerVO.getArkContextMarkup());

            target.add(studyCrudContainerVO.getSummaryContainer());
            ArkCRUDHelper.preProcessDetailPanelOnSearchResults(target, studyCrudContainerVO);

            // Example auto-generated SubjectUID
            Label subjectUidExampleLbl = detailForm.getSubjectUidExampleLbl();

            // Get the Biospecimen UID Pattern if present for the given study
            BiospecimenUidTemplate biospecimentUidTemplate = null;
            // Get the BioCollection UID pattern if present
            BioCollectionUidTemplate bioCollectionUidTemplate = null;

            if (parentStudy == null || searchStudy == parentStudy) {
                subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(searchStudy));
                biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(searchStudy);
                bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(searchStudy);
            } else {
                // Disable parent study drop down
                detailForm.getLinkedToStudyDDContainer().setEnabled(false);
                subjectUidExampleLbl.setDefaultModelObject(iArkCommonService.getSubjectUidExample(parentStudy));
                biospecimentUidTemplate = iArkCommonService.getBiospecimenUidTemplate(parentStudy);
                bioCollectionUidTemplate = iArkCommonService.getBioCollectionUidTemplate(parentStudy);
            }

            if (biospecimentUidTemplate != null) {
                studyContainerForm.getModelObject().setBiospecimenUidTemplate(biospecimentUidTemplate);
            }

            if (bioCollectionUidTemplate != null) {
                studyContainerForm.getModelObject().setBioCollectionUidTemplate(bioCollectionUidTemplate);
            }
            target.add(subjectUidExampleLbl);

            boolean isChildStudy = (parentStudy != null && parentStudy != searchStudy);
            detailForm.getSubjectFileUploadContainer().setVisible(isChildStudy);
            detailForm.getSubjectFileUploadContainer().setEnabled(isChildStudy);

            long totalSubjects = iArkCommonService.getCountOfSubjects(searchStudy);
            long totalSubjectsOfParent = iArkCommonService.getCountOfSubjects(searchStudy.getParentStudy());

            studyContainerForm.getModelObject().setTotalSubjects(totalSubjects);
            studyContainerForm.getModelObject().setTotalSubjectsOfParent(totalSubjectsOfParent);

            // Refresh base container form to remove any feedBack messages
            target.add(autoSubjectUidcontainer);
            target.add(subjectUidcontainer);
            target.add(autoBiocollectionUidcontainer);
            target.add(bioCollectionUidContainer);
            target.add(autoBiospecimenUidcontainer);
            target.add(biospecimenUidContainer);
            target.add(studyContainerForm);
            target.add(moduleTabbedPanel);
        }
    };

    // Add the label for the link
    Label studyNameLinkLabel = new Label("studyNameLink", study.getName());
    link.add(studyNameLinkLabel);
    return link;
}

From source file:hsa.awp.usergui.ProcedureDetailView.java

License:Open Source License

private void createProcedureBar(Procedure procedure) {
    DateFormat df = new SimpleDateFormat("dd.MM.yyyy HH:mm");

    WebMarkupContainer container = new WebMarkupContainer("box");

    container.add(new Label("procedureDetail.detailInfo", "Phase: " + procedure.getName()));
    container.add(new Label("procedureDetail.timeSpan",
            "vom " + df.format(procedure.getStartDate().getTime()) + " bis "
                    + (procedure instanceof DrawProcedure
                            ? df.format(((DrawProcedure) procedure).getDrawDate().getTime())
                            : df.format((procedure.getEndDate().getTime())))));
    if (procedure instanceof DrawProcedure && controller.isAlreadyDrawn((DrawProcedure) procedure)) {
        container.add(new AttributeAppender("class", new Model<String>("disabled"), ";"));
        container.setEnabled(false);
    }//from   ww  w . j  a va  2 s  .  c  om

    float progress = calculateProgress(procedure);

    Label progressLabel = new Label("procedureDetail.progress");
    progressLabel.add(new AttributeAppender("style", new Model<String>("width: " + (int) progress + "%"), ";"));
    container.add(progressLabel);
    add(container);
}

From source file:org.apache.openmeetings.web.components.admin.groups.GroupsPanel.java

License:Apache License

@SuppressWarnings("unchecked")
public GroupsPanel(String id) {
    super(id);/*from  w w  w . j a v a2s.c  o m*/
    final WebMarkupContainer listContainer = new WebMarkupContainer("listContainer");
    final WebMarkupContainer addUsersBtn = new WebMarkupContainer("addUsersBtn");
    addUsersBtn.add(new AjaxEventBehavior("onclick") {
        private static final long serialVersionUID = 6037994365235148885L;

        protected void onEvent(AjaxRequestTarget target) {
            addUsersForm.clear();
            target.add(addUsersForm);
            target.appendJavaScript("addUsers();");
        }
    });

    //Adding the Group Form
    form = new GroupForm("form", listContainer, new Organisation()) {
        private static final long serialVersionUID = -3042797340375988889L;

        @Override
        protected void onModelChanged() {
            super.onModelChanged();
            boolean orgEmpty = getModelObject().getOrganisation_id() == null;
            if (orgEmpty) {
                addUsersBtn.add(AttributeModifier.replace("class", "formNewButton disabled"));
            } else {
                addUsersBtn.add(AttributeModifier.replace("class", "formNewButton"));
            }
            addUsersBtn.setEnabled(!orgEmpty);
            addUsersForm.setOrganisation(getModelObject());
        }

        @Override
        void updateView(AjaxRequestTarget target) {
            super.updateView(target);
            target.add(addUsersBtn);
        }
    };
    add(form.add(addUsersBtn.setOutputMarkupId(true)));
    addUsersForm = new AddUsersForm("addUsers", form);
    add(addUsersForm);

    //List view
    SearchableDataView<Organisation> dataView = new SearchableDataView<Organisation>("groupList",
            new SearchableDataProvider<Organisation>(OrganisationDao.class)) {
        private static final long serialVersionUID = 8715559628755439596L;

        @Override
        protected void populateItem(Item<Organisation> item) {
            final Organisation organisation = item.getModelObject();
            item.add(new Label("organisation_id", "" + organisation.getOrganisation_id()));
            item.add(new Label("name", "" + organisation.getName()));
            item.add(new AjaxEventBehavior("onclick") {
                private static final long serialVersionUID = -8069413566800571061L;

                protected void onEvent(AjaxRequestTarget target) {
                    form.hideNewRecord();
                    form.setModelObject(organisation);
                    form.updateView(target);
                    target.appendJavaScript("groupsInit();");
                }
            });
            item.add(AttributeModifier.append("class",
                    "clickable " + ((item.getIndex() % 2 == 1) ? "even" : "odd")));
        }
    };

    //Paging
    add(listContainer.add(dataView).setOutputMarkupId(true));
    DataViewContainer<Organisation> container = new DataViewContainer<Organisation>(listContainer, dataView);
    container.setLinks(new OrderByBorder<Organisation>("orderById", "organisation_id", container),
            new OrderByBorder<Organisation>("orderByName", "name", container));
    add(container.orderLinks);
    add(new PagedEntityListPanel("navigator", dataView) {
        private static final long serialVersionUID = 5097048616003411362L;

        @Override
        protected void onEvent(AjaxRequestTarget target) {
            target.add(listContainer);
        }
    });
}

From source file:org.apache.syncope.client.console.pages.AbstractSyncTaskModalPage.java

License:Apache License

public AbstractSyncTaskModalPage(final ModalWindow window, final AbstractProvisioningTaskTO taskTO,
        final PageReference pageRef) {

    super(window, taskTO, pageRef);

    final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<>("resource",
            getString("resourceName"), new PropertyModel<String>(taskTO, "resource"));
    resource.setChoices(allResources.getObject());
    resource.setChoiceRenderer(new SelectChoiceRenderer<String>());
    resource.addRequiredLabel();//ww  w  .j a v a  2s  .  c o  m
    resource.setEnabled(taskTO.getKey() == 0);
    resource.setStyleSheet("ui-widget-content ui-corner-all long_dynamicsize");

    profile.add(resource);

    final WebMarkupContainer syncActionsClassNames = new WebMarkupContainer("syncActionsClassNames");
    syncActionsClassNames.setOutputMarkupId(true);
    profile.add(syncActionsClassNames);

    final AjaxLink<Void> first = new IndicatingAjaxLink<Void>("first") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            taskTO.getActionsClassNames().add(StringUtils.EMPTY);
            setVisible(false);
            target.add(syncActionsClassNames);
        }
    };
    first.setOutputMarkupPlaceholderTag(true);
    first.setVisible(taskTO.getActionsClassNames().isEmpty());
    syncActionsClassNames.add(first);

    final ListView<String> actionsClasses = new ListView<String>("actionsClasses",
            new PropertyModel<List<String>>(taskTO, "actionsClassNames")) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<String> item) {
            final String className = item.getModelObject();

            final DropDownChoice<String> actionsClass = new DropDownChoice<String>("actionsClass",
                    new Model<String>(className), syncActionsClasses.getObject());
            actionsClass.setNullValid(true);
            actionsClass.setRequired(true);
            actionsClass.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

                private static final long serialVersionUID = -1107858522700306810L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().set(item.getIndex(), actionsClass.getModelObject());
                    target.add(syncActionsClassNames);
                }
            });
            actionsClass.setRequired(true);
            actionsClass.setOutputMarkupId(true);
            actionsClass.setRequired(true);
            item.add(actionsClass);

            AjaxLink<Void> minus = new IndicatingAjaxLink<Void>("drop") {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().remove(className);
                    first.setVisible(taskTO.getActionsClassNames().isEmpty());
                    target.add(syncActionsClassNames);
                }
            };
            item.add(minus);

            final AjaxLink<Void> plus = new IndicatingAjaxLink<Void>("add") {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().add(StringUtils.EMPTY);
                    target.add(syncActionsClassNames);
                }
            };
            plus.setOutputMarkupPlaceholderTag(true);
            plus.setVisible(item.getIndex() == taskTO.getActionsClassNames().size() - 1);
            item.add(plus);
        }
    };
    syncActionsClassNames.add(actionsClasses);

    syncActionsClassNames.setEnabled(!syncActionsClasses.getObject().isEmpty());

    final AjaxCheckBoxPanel creates = new AjaxCheckBoxPanel("performCreate", getString("creates"),
            new PropertyModel<Boolean>(taskTO, "performCreate"));
    profile.add(creates);

    final AjaxCheckBoxPanel updates = new AjaxCheckBoxPanel("performUpdate", getString("updates"),
            new PropertyModel<Boolean>(taskTO, "performUpdate"));
    profile.add(updates);

    final AjaxCheckBoxPanel deletes = new AjaxCheckBoxPanel("performDelete", getString("updates"),
            new PropertyModel<Boolean>(taskTO, "performDelete"));
    profile.add(deletes);

    final AjaxCheckBoxPanel syncStatus = new AjaxCheckBoxPanel("syncStatus", getString("syncStatus"),
            new PropertyModel<Boolean>(taskTO, "syncStatus"));
    profile.add(syncStatus);

    matchingRule = new AjaxDropDownChoicePanel<MatchingRule>("matchingRule", "matchingRule",
            new PropertyModel<MatchingRule>(taskTO, "matchingRule"));
    matchingRule.setChoices(Arrays.asList(MatchingRule.values()));
    ((DropDownChoice) matchingRule.getField()).setNullValid(false);

    unmatchingRule = new AjaxDropDownChoicePanel<UnmatchingRule>("unmatchingRule", "unmatchingRule",
            new PropertyModel<UnmatchingRule>(taskTO, "unmatchingRule"));
    unmatchingRule.setChoices(Arrays.asList(UnmatchingRule.values()));
    ((DropDownChoice) unmatchingRule.getField()).setNullValid(false);
}

From source file:org.apache.syncope.client.console.panels.GroupTabPanel.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
public GroupTabPanel(final String id, final GroupTO selectedNode, final ModalWindow window,
        final PageReference pageRef) {

    super(id);//w  w  w.j  av  a2 s . c  om

    this.add(new Label("displayName", selectedNode.getDisplayName()));

    final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef);
    links.setOutputMarkupId(true);
    this.add(links);
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    GroupTO groupTO = new GroupTO();
                    groupTO.setParent(selectedNode.getKey());
                    return new GroupModalPage(pageRef, window, groupTO);
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Groups", "create"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new StatusModalPage<GroupTO>(pageRef, window,
                            groupRestClient.read(selectedNode.getKey()));
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getEntitlement("Groups", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    GroupTO groupTO = groupRestClient.read(selectedNode.getKey());
                    return new GroupModalPage(pageRef, window, groupTO);
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.EDIT, xmlRolesReader.getEntitlement("Groups", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            try {
                final GroupTO groupTO = groupRestClient.delete(selectedNode.getETagValue(),
                        selectedNode.getKey());

                ((Groups) pageRef.getPage()).setModalResult(true);

                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new ResultStatusModalPage.Builder(window, groupTO).build();
                    }
                });

                window.show(target);
            } catch (SyncopeClientException e) {
                error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
                ((Groups) pageRef.getPage()).getFeedbackPanel().refresh(target);
            }
        }
    }, ActionLink.ActionType.DELETE, xmlRolesReader.getEntitlement("Groups", "delete"));

    final Form form = new Form("groupForm");
    form.setModel(new CompoundPropertyModel(selectedNode));
    form.setOutputMarkupId(true);

    final GroupPanel groupPanel = new GroupPanel.Builder("groupPanel").form(form).groupTO(selectedNode)
            .groupModalPageMode(Mode.ADMIN).build();
    groupPanel.setEnabled(false);
    form.add(groupPanel);

    final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");

    userListContainer.setOutputMarkupId(true);
    userListContainer.setEnabled(true);
    userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
    userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
            userListContainer.replace(new UserSearchResultPanel("userList", true,
                    SyncopeClient.getUserSearchConditionBuilder().inGroups(selectedNode.getKey()).query(),
                    pageRef, userRestClient));

            target.add(userListContainer);
        }
    });

    form.add(userListContainer);
    add(form);
}

From source file:org.apache.syncope.client.console.panels.RoleTabPanel.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
public RoleTabPanel(final String id, final RoleTO selectedNode, final ModalWindow window,
        final PageReference pageRef) {

    super(id);/*from ww  w .j  av  a2  s  .co m*/

    this.add(new Label("displayName", selectedNode.getDisplayName()));

    final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef);
    links.setOutputMarkupId(true);
    this.add(links);
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    RoleTO roleTO = new RoleTO();
                    roleTO.setParent(selectedNode.getKey());
                    return new RoleModalPage(pageRef, window, roleTO);
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.CREATE, xmlRolesReader.getEntitlement("Roles", "create"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new StatusModalPage<RoleTO>(pageRef, window,
                            roleRestClient.read(selectedNode.getKey()));
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getEntitlement("Roles", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    RoleTO roleTO = roleRestClient.read(selectedNode.getKey());
                    return new RoleModalPage(pageRef, window, roleTO);
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.EDIT, xmlRolesReader.getEntitlement("Roles", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            try {
                final RoleTO roleTO = roleRestClient.delete(selectedNode.getETagValue(), selectedNode.getKey());

                ((Roles) pageRef.getPage()).setModalResult(true);

                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new ResultStatusModalPage.Builder(window, roleTO).build();
                    }
                });

                window.show(target);
            } catch (SyncopeClientException e) {
                error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
                ((Roles) pageRef.getPage()).getFeedbackPanel().refresh(target);
            }
        }
    }, ActionLink.ActionType.DELETE, xmlRolesReader.getEntitlement("Roles", "delete"));

    final Form form = new Form("roleForm");
    form.setModel(new CompoundPropertyModel(selectedNode));
    form.setOutputMarkupId(true);

    final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode)
            .roleModalPageMode(Mode.ADMIN).build();
    rolePanel.setEnabled(false);
    form.add(rolePanel);

    final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");

    userListContainer.setOutputMarkupId(true);
    userListContainer.setEnabled(true);
    userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
    userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
            userListContainer.replace(new UserSearchResultPanel("userList", true,
                    SyncopeClient.getUserSearchConditionBuilder().hasRoles(selectedNode.getKey()).query(),
                    pageRef, userRestClient));

            target.add(userListContainer);
        }
    });

    form.add(userListContainer);
    add(form);
}

From source file:org.apache.syncope.client.console.wizards.resources.ResourceProvisionPanel.java

License:Apache License

public ResourceProvisionPanel(final BaseModal<Serializable> modal, final ResourceTO resourceTO,
        final PageReference pageRef) {

    super(modal, pageRef);
    this.resourceTO = resourceTO;

    baseModel = Model.of(resourceTO.getOrgUnit() == null ? new OrgUnitTO() : resourceTO.getOrgUnit());

    setOutputMarkupId(true);//from  www.j av a  2  s .c  o m

    // ----------------------------------------------------------------------
    // Realms provisioning
    // ----------------------------------------------------------------------
    aboutRealmProvison = new WebMarkupContainer("aboutRealmProvison");
    aboutRealmProvison.setOutputMarkupPlaceholderTag(true);
    add(aboutRealmProvison);

    boolean realmProvisionEnabled = resourceTO.getOrgUnit() != null;

    final AjaxCheckBoxPanel enableRealmsProvision = new AjaxCheckBoxPanel("enableRealmsProvision",
            "enableRealmsProvision", Model.of(realmProvisionEnabled), false);
    aboutRealmProvison.add(enableRealmsProvision);
    enableRealmsProvision.setIndex(1).setTitle(getString("enableRealmsProvision.title"));

    final WebMarkupContainer realmsProvisionContainer = new WebMarkupContainer("realmsProvisionContainer");
    realmsProvisionContainer.setOutputMarkupPlaceholderTag(true);
    realmsProvisionContainer.setEnabled(realmProvisionEnabled).setVisible(realmProvisionEnabled);
    aboutRealmProvison.add(realmsProvisionContainer);

    final AjaxTextFieldPanel objectClass = new AjaxTextFieldPanel("objectClass", getString("objectClass"),
            new PropertyModel<String>(baseModel.getObject(), "objectClass"), false);
    realmsProvisionContainer.add(objectClass.addRequiredLabel());

    final AjaxTextFieldPanel extAttrName = new AjaxTextFieldPanel("extAttrName", getString("extAttrName"),
            new PropertyModel<String>(baseModel.getObject(), "extAttrName"), false);
    if (resourceTO.getOrgUnit() != null) {
        extAttrName.setChoices(connectorRestClient.getExtAttrNames(resourceTO.getOrgUnit().getObjectClass(),
                resourceTO.getConnector(), resourceTO.getConfOverride()));
    }
    realmsProvisionContainer.add(extAttrName.addRequiredLabel());

    objectClass.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_BLUR) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            extAttrName.setChoices(connectorRestClient.getExtAttrNames(objectClass.getModelObject(),
                    resourceTO.getConnector(), resourceTO.getConfOverride()));
            target.focusComponent(extAttrName);
        }
    });

    final AjaxTextFieldPanel connObjectLink = new AjaxTextFieldPanel("connObjectLink",
            new ResourceModel("connObjectLink", "connObjectLink").getObject(),
            new PropertyModel<String>(baseModel.getObject(), "connObjectLink"), false);
    realmsProvisionContainer.add(connObjectLink.addRequiredLabel());

    enableRealmsProvision.getField().add(new IndicatorAjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            boolean realmProvisionEnabled = enableRealmsProvision.getModelObject();
            realmsProvisionContainer.setEnabled(realmProvisionEnabled).setVisible(realmProvisionEnabled);
            target.add(realmsProvisionContainer);

            if (realmProvisionEnabled) {
                resourceTO.setOrgUnit(baseModel.getObject());
            } else {
                resourceTO.setOrgUnit(null);
            }

        }
    });
    // ----------------------------------------------------------------------

    final ProvisionWizardBuilder wizard = new ProvisionWizardBuilder(resourceTO, pageRef);

    final ListViewPanel.Builder<ProvisionTO> builder = new ListViewPanel.Builder<ProvisionTO>(ProvisionTO.class,
            pageRef) {

        private static final long serialVersionUID = 4907732721283972943L;

        @Override
        protected ProvisionTO getActualItem(final ProvisionTO item, final List<ProvisionTO> list) {
            return item == null ? null : IteratorUtils.find(list.iterator(), new Predicate<ProvisionTO>() {

                @Override
                public boolean evaluate(final ProvisionTO in) {
                    return ((item.getKey() == null && in.getKey() == null)
                            || (in.getKey() != null && in.getKey().equals(item.getKey())))
                            && ((item.getAnyType() == null && in.getAnyType() == null)
                                    || (in.getAnyType() != null && in.getAnyType().equals(item.getAnyType())));
                }
            });
        }

        @Override
        protected void customActionOnCancelCallback(final AjaxRequestTarget target) {
            ResourceProvisionPanel.this.aboutRealmProvison.setVisible(true);
            target.add(ResourceProvisionPanel.this.aboutRealmProvison);
        }

        @Override
        protected void customActionOnFinishCallback(final AjaxRequestTarget target) {
            ResourceProvisionPanel.this.aboutRealmProvison.setVisible(true);
            target.add(ResourceProvisionPanel.this.aboutRealmProvison);
        }
    };

    builder.setItems(resourceTO.getProvisions());
    builder.includes("anyType", "objectClass", "auxClasses");
    builder.setReuseItem(false);

    builder.addAction(new ActionLink<ProvisionTO>() {

        private static final long serialVersionUID = -3722207913631435504L;

        @Override
        public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
            send(ResourceProvisionPanel.this, Broadcast.DEPTH,
                    new AjaxWizard.NewItemActionEvent<>(provisionTO, 2, target)
                            .setResourceModel(new StringResourceModel("inner.provision.mapping",
                                    ResourceProvisionPanel.this, Model.of(provisionTO))));
        }
    }, ActionLink.ActionType.MAPPING, StandardEntitlement.RESOURCE_UPDATE)
            .addAction(new ActionLink<ProvisionTO>() {

                private static final long serialVersionUID = -7780999687733432439L;

                @Override
                public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
                    try {
                        SyncopeConsoleSession.get().getService(ResourceService.class)
                                .setLatestSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
                        SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (Exception e) {
                        LOG.error("While setting latest sync token for {}/{}", resourceTO.getKey(),
                                provisionTO.getAnyType(), e);
                        SyncopeConsoleSession.get().error(
                                StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
                    }
                    ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
                }
            }, ActionLink.ActionType.SET_LATEST_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE)
            .addAction(new ActionLink<ProvisionTO>() {

                private static final long serialVersionUID = -7780999687733432439L;

                @Override
                public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
                    try {
                        SyncopeConsoleSession.get().getService(ResourceService.class)
                                .removeSyncToken(resourceTO.getKey(), provisionTO.getAnyType());
                        SyncopeConsoleSession.get().info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (Exception e) {
                        LOG.error("While removing sync token for {}/{}", resourceTO.getKey(),
                                provisionTO.getAnyType(), e);
                        SyncopeConsoleSession.get().error(
                                StringUtils.isBlank(e.getMessage()) ? e.getClass().getName() : e.getMessage());
                    }
                    ((BasePage) pageRef.getPage()).getNotificationPanel().refresh(target);
                }
            }, ActionLink.ActionType.REMOVE_SYNC_TOKEN, StandardEntitlement.RESOURCE_UPDATE)
            .addAction(new ActionLink<ProvisionTO>() {

                private static final long serialVersionUID = -3722207913631435534L;

                @Override
                public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
                    final ProvisionTO clone = SerializationUtils.clone(provisionTO);
                    clone.setKey(null);
                    clone.setAnyType(null);
                    clone.setObjectClass(null);
                    send(ResourceProvisionPanel.this, Broadcast.DEPTH,
                            new AjaxWizard.NewItemActionEvent<>(clone, target)
                                    .setResourceModel(new StringResourceModel("inner.provision.clone",
                                            ResourceProvisionPanel.this, Model.of(provisionTO))));
                }
            }, ActionLink.ActionType.CLONE, StandardEntitlement.RESOURCE_CREATE)
            .addAction(new ActionLink<ProvisionTO>() {

                private static final long serialVersionUID = -3722207913631435544L;

                @Override
                public void onClick(final AjaxRequestTarget target, final ProvisionTO provisionTO) {
                    resourceTO.getProvisions().remove(provisionTO);
                    send(ResourceProvisionPanel.this, Broadcast.DEPTH, new ListViewReload<>(target));
                }
            }, ActionLink.ActionType.DELETE, StandardEntitlement.RESOURCE_DELETE);

    builder.addNewItemPanelBuilder(wizard);

    final WizardMgtPanel<ProvisionTO> list = builder.build("provision");
    add(list);
}

From source file:org.apache.syncope.console.pages.AbstractSyncTaskModalPage.java

License:Apache License

public AbstractSyncTaskModalPage(final ModalWindow window, final AbstractSyncTaskTO taskTO,
        final PageReference pageRef) {

    super(window, taskTO, pageRef);

    final AjaxDropDownChoicePanel<String> resource = new AjaxDropDownChoicePanel<String>("resource",
            getString("resourceName"), new PropertyModel<String>(taskTO, "resource"));
    resource.setChoices(allResources.getObject());
    resource.setChoiceRenderer(new SelectChoiceRenderer<String>());
    resource.addRequiredLabel();//from  w  w w  .  j  av a 2  s.c  o  m
    resource.setEnabled(taskTO.getId() == 0);
    resource.setStyleSheet("ui-widget-content ui-corner-all long_dynamicsize");

    profile.add(resource);

    final WebMarkupContainer syncActionsClassNames = new WebMarkupContainer("syncActionsClassNames");
    syncActionsClassNames.setOutputMarkupId(true);
    profile.add(syncActionsClassNames);

    final AjaxLink<Void> first = new IndicatingAjaxLink<Void>("first") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            taskTO.getActionsClassNames().add(StringUtils.EMPTY);
            setVisible(false);
            target.add(syncActionsClassNames);
        }
    };
    first.setOutputMarkupPlaceholderTag(true);
    first.setVisible(taskTO.getActionsClassNames().isEmpty());
    syncActionsClassNames.add(first);

    final ListView<String> actionsClasses = new ListView<String>("actionsClasses",
            new PropertyModel<List<String>>(taskTO, "actionsClassNames")) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<String> item) {
            final String className = item.getModelObject();

            final DropDownChoice<String> actionsClass = new DropDownChoice<String>("actionsClass",
                    new Model<String>(className), syncActionsClasses.getObject());
            actionsClass.setNullValid(true);
            actionsClass.setRequired(true);
            actionsClass.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

                private static final long serialVersionUID = -1107858522700306810L;

                @Override
                protected void onUpdate(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().set(item.getIndex(), actionsClass.getModelObject());
                    target.add(syncActionsClassNames);
                }
            });
            actionsClass.setRequired(true);
            actionsClass.setOutputMarkupId(true);
            actionsClass.setRequired(true);
            item.add(actionsClass);

            AjaxLink<Void> minus = new IndicatingAjaxLink<Void>("drop") {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().remove(className);
                    first.setVisible(taskTO.getActionsClassNames().isEmpty());
                    target.add(syncActionsClassNames);
                }
            };
            item.add(minus);

            final AjaxLink<Void> plus = new IndicatingAjaxLink<Void>("add") {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    taskTO.getActionsClassNames().add(StringUtils.EMPTY);
                    target.add(syncActionsClassNames);
                }
            };
            plus.setOutputMarkupPlaceholderTag(true);
            plus.setVisible(item.getIndex() == taskTO.getActionsClassNames().size() - 1);
            item.add(plus);
        }
    };
    syncActionsClassNames.add(actionsClasses);

    syncActionsClassNames.setEnabled(!syncActionsClasses.getObject().isEmpty());

    final AjaxCheckBoxPanel creates = new AjaxCheckBoxPanel("performCreate", getString("creates"),
            new PropertyModel<Boolean>(taskTO, "performCreate"));
    profile.add(creates);

    final AjaxCheckBoxPanel updates = new AjaxCheckBoxPanel("performUpdate", getString("updates"),
            new PropertyModel<Boolean>(taskTO, "performUpdate"));
    profile.add(updates);

    final AjaxCheckBoxPanel deletes = new AjaxCheckBoxPanel("performDelete", getString("updates"),
            new PropertyModel<Boolean>(taskTO, "performDelete"));
    profile.add(deletes);

    final AjaxCheckBoxPanel syncStatus = new AjaxCheckBoxPanel("syncStatus", getString("syncStatus"),
            new PropertyModel<Boolean>(taskTO, "syncStatus"));
    profile.add(syncStatus);

    matchingRule = new AjaxDropDownChoicePanel<MatchingRule>("matchingRule", "matchingRule",
            new PropertyModel<MatchingRule>(taskTO, "matchingRule"));
    matchingRule.setChoices(Arrays.asList(MatchingRule.values()));
    ((DropDownChoice) matchingRule.getField()).setNullValid(false);

    unmatchingRule = new AjaxDropDownChoicePanel<UnmatchingRule>("unmatchingRule", "unmatchingRule",
            new PropertyModel<UnmatchingRule>(taskTO, "unmatchingRule"));
    unmatchingRule.setChoices(Arrays.asList(UnmatchingRule.values()));
    ((DropDownChoice) unmatchingRule.getField()).setNullValid(false);
}

From source file:org.apache.syncope.console.pages.panels.RoleTabPanel.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
public RoleTabPanel(final String id, final RoleTO selectedNode, final ModalWindow window,
        final PageReference pageRef) {

    super(id);/*from w w  w  .ja  v a  2s .co  m*/

    this.add(new Label("displayName", selectedNode.getDisplayName()));

    final ActionLinksPanel links = new ActionLinksPanel("actionLinks", new Model(), pageRef);
    links.setOutputMarkupId(true);
    this.add(links);
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    RoleTO roleTO = new RoleTO();
                    roleTO.setParent(selectedNode.getId());
                    RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                    return form;
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.CREATE, xmlRolesReader.getAllAllowedRoles("Roles", "create"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new StatusModalPage<RoleTO>(pageRef, window,
                            roleRestClient.read(selectedNode.getId()));
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.MANAGE_RESOURCES, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            window.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    RoleTO roleTO = roleRestClient.read(selectedNode.getId());
                    RoleModalPage form = new RoleModalPage(pageRef, window, roleTO);
                    return form;
                }
            });

            window.show(target);
        }
    }, ActionLink.ActionType.EDIT, xmlRolesReader.getAllAllowedRoles("Roles", "update"));
    links.addWithRoles(new ActionLink() {

        private static final long serialVersionUID = -3722207913631435501L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            try {
                final RoleTO roleTO = roleRestClient.delete(selectedNode.getETagValue(), selectedNode.getId());

                ((Roles) pageRef.getPage()).setModalResult(true);

                window.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new ResultStatusModalPage.Builder(window, roleTO).build();
                    }
                });

                window.show(target);
            } catch (SyncopeClientException e) {
                error(getString(Constants.OPERATION_ERROR) + ": " + e.getMessage());
                ((Roles) pageRef.getPage()).getFeedbackPanel().refresh(target);
            }
        }
    }, ActionLink.ActionType.DELETE, xmlRolesReader.getAllAllowedRoles("Roles", "delete"));

    final Form form = new Form("roleForm");
    form.setModel(new CompoundPropertyModel(selectedNode));
    form.setOutputMarkupId(true);

    final RolePanel rolePanel = new RolePanel.Builder("rolePanel").form(form).roleTO(selectedNode)
            .roleModalPageMode(RoleModalPage.Mode.ADMIN).build();
    rolePanel.setEnabled(false);
    form.add(rolePanel);

    final WebMarkupContainer userListContainer = new WebMarkupContainer("userListContainer");

    userListContainer.setOutputMarkupId(true);
    userListContainer.setEnabled(true);
    userListContainer.add(new UserSearchResultPanel("userList", true, null, pageRef, userRestClient));
    userListContainer.add(new ClearIndicatingAjaxButton("search", new ResourceModel("search"), pageRef) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
            userListContainer.replace(new UserSearchResultPanel("userList", true,
                    SyncopeClient.getUserSearchConditionBuilder().hasRoles(selectedNode.getId()).query(),
                    pageRef, userRestClient));

            target.add(userListContainer);
        }
    });

    form.add(userListContainer);
    add(form);
}