Example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setWindowClosedCallback

List of usage examples for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setWindowClosedCallback

Introduction

In this page you can find the example usage for org.apache.wicket.extensions.ajax.markup.html.modal ModalWindow setWindowClosedCallback.

Prototype

public ModalWindow setWindowClosedCallback(final WindowClosedCallback callback) 

Source Link

Document

Sets the @{link WindowClosedCallback instance.

Usage

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

License:Apache License

private void setupProfile() {
    final WebMarkupContainer profile = new WebMarkupContainer("profile");
    profile.setOutputMarkupId(true);/*from   w  w  w.  j a  v  a 2s  .co m*/
    form.add(profile);

    final ModalWindow reportletConfWin = new ModalWindow("reportletConfWin");
    reportletConfWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    reportletConfWin.setCookieName("reportlet-conf-win-modal");
    reportletConfWin.setInitialHeight(REPORTLET_CONF_WIN_HEIGHT);
    reportletConfWin.setInitialWidth(REPORTLET_CONF_WIN_WIDTH);
    reportletConfWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            int foundIdx = -1;
            if (modalReportletConfOldName != null) {
                for (int i = 0; i < reportTO.getReportletConfs().size() && foundIdx == -1; i++) {
                    if (reportTO.getReportletConfs().get(i).getName().equals(modalReportletConfOldName)) {
                        foundIdx = i;
                    }
                }
            }
            if (modalReportletConf != null) {
                if (foundIdx == -1) {
                    reportTO.getReportletConfs().add(modalReportletConf);
                } else {
                    reportTO.getReportletConfs().set(foundIdx, modalReportletConf);
                }
            }

            target.add(reportlets);
        }
    });
    add(reportletConfWin);

    final Label idLabel = new Label("idLabel", new ResourceModel("key"));
    profile.add(idLabel);

    final AjaxTextFieldPanel key = new AjaxTextFieldPanel("key", getString("key"),
            new PropertyModel<String>(reportTO, "key"));
    key.setEnabled(false);
    profile.add(key);

    final Label nameLabel = new Label("nameLabel", new ResourceModel("name"));
    profile.add(nameLabel);

    final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", getString("name"),
            new PropertyModel<String>(reportTO, "name"));
    profile.add(name);

    final AjaxTextFieldPanel lastExec = new AjaxTextFieldPanel("lastExec", getString("lastExec"),
            new DateFormatROModel(new PropertyModel<String>(reportTO, "lastExec")));
    lastExec.setEnabled(false);
    profile.add(lastExec);

    final AjaxTextFieldPanel nextExec = new AjaxTextFieldPanel("nextExec", getString("nextExec"),
            new DateFormatROModel(new PropertyModel<String>(reportTO, "nextExec")));
    nextExec.setEnabled(false);
    profile.add(nextExec);

    reportlets = new ListChoice<AbstractReportletConf>("reportletConfs", new Model<AbstractReportletConf>(),
            reportTO.getReportletConfs(), new IChoiceRenderer<ReportletConf>() {

                private static final long serialVersionUID = 1048000918946220007L;

                @Override
                public Object getDisplayValue(final ReportletConf object) {
                    return object.getName();
                }

                @Override
                public String getIdValue(final ReportletConf object, final int index) {
                    return object.getName();
                }
            }) {

        private static final long serialVersionUID = 4022366881854379834L;

        @Override
        protected CharSequence getDefaultChoice(final String selectedValue) {
            return null;
        }
    };

    reportlets.setNullValid(true);
    profile.add(reportlets);
    reportlets.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            target.add(reportlets);
        }
    });

    profile.add(new AjaxLink<Void>(ADD_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

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

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    modalReportletConfOldName = null;
                    modalReportletConf = null;
                    return new ReportletConfModalPage(null, reportletConfWin,
                            ReportModalPage.this.getPageReference());
                }
            });
            reportletConfWin.show(target);
        }
    });

    profile.add(new AjaxLink<Void>(EDIT_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                reportletConfWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        modalReportletConfOldName = reportlets.getModelObject().getName();
                        modalReportletConf = null;
                        return new ReportletConfModalPage(reportlets.getModelObject(), reportletConfWin,
                                ReportModalPage.this.getPageReference());
                    }
                });
                reportletConfWin.show(target);
            }
        }
    });

    profile.add(new AjaxLink<Void>(REMOVE_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            reportTO.getReportletConfs().remove(reportlets.getModelObject());
            reportlets.setModelObject(null);
            target.add(reportlets);
        }

        @Override
        protected void updateAjaxAttributes(final AjaxRequestAttributes attributes) {
            if (reportlets.getModelObject() != null) {

                super.updateAjaxAttributes(attributes);

                final AjaxCallListener ajaxCallListener = new AjaxCallListener() {

                    private static final long serialVersionUID = 7160235486520935153L;

                    @Override
                    public CharSequence getPrecondition(final Component component) {
                        return "if (!confirm('" + getString("confirmDelete") + "')) {return false;}";
                    }
                };
                attributes.getAjaxCallListeners().add(ajaxCallListener);
            }
        }
    });

    profile.add(new AjaxLink<Void>(UP_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                moveUp(reportlets.getModelObject());
                target.add(reportlets);
            }
        }
    });

    profile.add(new AjaxLink<Void>(DOWN_BUTTON_ID) {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            if (reportlets.getModelObject() != null) {
                moveDown(reportlets.getModelObject());
                target.add(reportlets);
            }
        }
    });
}

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

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
private void setupExecutions() {
    final WebMarkupContainer executions = new WebMarkupContainer("executionContainer");
    executions.setOutputMarkupId(true);/*ww  w.jav a2 s.  c o m*/
    form.add(executions);

    final ModalWindow reportExecMessageWin = new ModalWindow("reportExecMessageWin");
    reportExecMessageWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    reportExecMessageWin.setCookieName("report-exec-message-win-modal");
    add(reportExecMessageWin);

    final ModalWindow reportExecExportWin = new ModalWindow("reportExecExportWin");
    reportExecExportWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    reportExecExportWin.setCookieName("report-exec-export-win-modal");
    reportExecExportWin.setInitialHeight(EXEC_EXPORT_WIN_HEIGHT);
    reportExecExportWin.setInitialWidth(EXEC_EXPORT_WIN_WIDTH);
    reportExecExportWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            AjaxExportDownloadBehavior behavior = new AjaxExportDownloadBehavior(
                    ReportModalPage.this.exportFormat, ReportModalPage.this.exportExecId);
            executions.add(behavior);
            behavior.initiate(target);
        }
    });
    add(reportExecExportWin);

    final List<IColumn> columns = new ArrayList<IColumn>();
    columns.add(new PropertyColumn(new ResourceModel("key"), "key", "key"));
    columns.add(new DatePropertyColumn(new ResourceModel("startDate"), "startDate", "startDate"));
    columns.add(new DatePropertyColumn(new ResourceModel("endDate"), "endDate", "endDate"));
    columns.add(new PropertyColumn(new ResourceModel("status"), "status", "status"));
    columns.add(new ActionColumn<ReportExecTO, String>(new ResourceModel("actions", "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public ActionLinksPanel getActions(final String componentId, final IModel<ReportExecTO> model) {

            final ReportExecTO taskExecutionTO = model.getObject();

            final ActionLinksPanel panel = new ActionLinksPanel(componentId, model, getPageReference());

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

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

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ExecMessageModalPage(model.getObject().getMessage());
                        }
                    });
                    reportExecMessageWin.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Reports", StringUtils.hasText(model.getObject().getMessage()));

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

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

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            ReportModalPage.this.exportExecId = model.getObject().getKey();
                            return new ReportExecResultDownloadModalPage(reportExecExportWin,
                                    ReportModalPage.this.getPageReference());
                        }
                    });
                    reportExecExportWin.show(target);
                }
            }, ActionLink.ActionType.EXPORT, "Reports",
                    ReportExecStatus.SUCCESS.name().equals(model.getObject().getStatus()));

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        reportRestClient.deleteExecution(taskExecutionTO.getKey());

                        reportTO.getExecutions().remove(taskExecutionTO);

                        info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (SyncopeClientException scce) {
                        error(scce.getMessage());
                    }

                    feedbackPanel.refresh(target);
                    target.add(executions);
                }
            }, ActionLink.ActionType.DELETE, "Reports");

            return panel;
        }

        @Override
        public Component getHeader(final String componentId) {
            final ActionLinksPanel panel = new ActionLinksPanel(componentId, new Model(), getPageReference());

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    if (target != null) {
                        final ReportTO currentReportTO = reportTO.getKey() == 0 ? reportTO
                                : reportRestClient.read(reportTO.getKey());
                        reportTO.getExecutions().clear();
                        reportTO.getExecutions().addAll(currentReportTO.getExecutions());
                        final AjaxFallbackDefaultDataTable currentTable = new AjaxFallbackDefaultDataTable(
                                "executionsTable", columns, new ReportExecutionsProvider(reportTO), 10);
                        currentTable.setOutputMarkupId(true);
                        target.add(currentTable);
                        executions.addOrReplace(currentTable);
                    }
                }
            }, ActionLink.ActionType.RELOAD, TASKS, "list");

            return panel;
        }
    });

    final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("executionsTable", columns,
            new ReportExecutionsProvider(reportTO), 10);
    executions.add(table);
}

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

License:Apache License

private void setWindowClosedReloadCallback(final ModalWindow window) {
    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override//from w w w .ja v  a 2 s .  c o m
        public void onClose(final AjaxRequestTarget target) {
            final EventDataWrapper data = new EventDataWrapper();
            data.setTarget(target);
            data.setCreate(true);

            send(getPage(), Broadcast.BREADTH, data);

            if (isModalResult()) {
                // reset modal result
                setModalResult(false);
                // set operation succeeded
                getSession().info(getString(Constants.OPERATION_SUCCEEDED));
                // refresh feedback panel
                feedbackPanel.refresh(target);
            }
        }
    });
}

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

License:Apache License

private void setWindowClosedReloadCallback(final ModalWindow window) {
    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override//from ww  w . j a va2  s . c  o m
        public void onClose(final AjaxRequestTarget target) {
            final EventDataWrapper data = new EventDataWrapper();
            data.setTarget(target);
            data.setRows(rows);

            send(getParent(), Broadcast.BREADTH, data);

            if (page.isModalResult()) {
                // reset modal result
                page.setModalResult(false);
                // set operation succeeded
                getSession().info(getString(Constants.OPERATION_SUCCEEDED));
                // refresh feedback panel
                feedbackPanel.refresh(target);
            }
        }
    });
}

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

License:Apache License

private void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) {
    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override/* w w w.j a va2s  . c  o  m*/
        public void onClose(final AjaxRequestTarget target) {
            final UserTO updatedUserTO = ((UserModalPage) getPage()).getUserTO();
            if (!userTO.equals(updatedUserTO)) {
                if (updatedUserTO.getMemberships().size() > userTO.getMemberships().size()) {
                    Set<Long> diff = new HashSet<Long>(updatedUserTO.getMembershipMap().keySet());
                    diff.removeAll(userTO.getMembershipMap().keySet());

                    Set<String> resourcesToAdd = new HashSet<>();
                    for (Long diffMembId : diff) {
                        long groupId = updatedUserTO.getMembershipMap().get(diffMembId).getGroupKey();
                        GroupTO groupTO = groupTreeBuilder.findGroup(groupId);
                        resourcesToAdd.addAll(groupTO.getResources());
                        StatusUtils.update(userTO, statusPanel, target, resourcesToAdd,
                                Collections.<String>emptySet());
                    }
                }

                MembershipsPanel.this.userTO.getMemberships().clear();
                MembershipsPanel.this.userTO.getMemberships().addAll(updatedUserTO.getMemberships());
                target.add(container);
            }
        }
    });
}

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

License:Apache License

private void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) {
    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override/*  ww  w  .  j a  v a 2 s  . c o  m*/
        public void onClose(final AjaxRequestTarget target) {
            target.add(container);
            BasePage configuration = ((BasePage) pageRef.getPage());
            if (configuration.isModalResult()) {
                info(getString(Constants.OPERATION_SUCCEEDED));
                configuration.getFeedbackPanel().refresh(target);
                configuration.setModalResult(false);
            }
        }
    });
}

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

License:Apache License

/**
 * Set a WindowClosedCallback for a ModalWindow instance.
 *
 * @param window window//from   ww w.  j  av a 2  s  .  c  o m
 * @param container container
 */
protected void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) {

    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            target.add(container);
            if (isModalResult()) {
                info(getString(Constants.OPERATION_SUCCEEDED));
                feedbackPanel.refresh(target);
                setModalResult(false);
            }
        }
    });
}

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

License:Apache License

public Login(final PageParameters parameters) {
    super(parameters);

    feedbackPanel = new NotificationPanel(Constants.FEEDBACK);
    add(feedbackPanel);//w w w . ja  va 2s .c o  m

    form = new Form<Void>("login");

    userIdField = new TextField<String>("userId", new Model<String>());
    userIdField.setMarkupId("userId");
    form.add(userIdField);

    passwordField = new PasswordTextField("password", new Model<String>());
    passwordField.setMarkupId("password");
    form.add(passwordField);

    languageSelect = new LocaleDropDown("language");

    form.add(languageSelect);

    AjaxButton submitButton = new AjaxButton("submit", new Model<String>(getString("submit"))) {

        private static final long serialVersionUID = 429178684321093953L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            try {
                if (anonymousUser.equals(userIdField.getRawInput())) {
                    throw new AccessControlException("Illegal username");
                }

                authenticate(userIdField.getRawInput(), passwordField.getRawInput());

                setResponsePage(WelcomePage.class, parameters);
            } catch (AccessControlException e) {
                error(getString("login-error"));
                feedbackPanel.refresh(target);
                SyncopeSession.get().resetClients();
            }
        }
    };

    submitButton.setDefaultFormProcessing(false);
    form.add(submitButton);

    add(form);

    // Modal window for self registration
    final ModalWindow editProfileModalWin = new ModalWindow("selfRegModal");
    editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    editProfileModalWin.setInitialHeight(SELF_REG_WIN_HEIGHT);
    editProfileModalWin.setInitialWidth(SELF_REG_WIN_WIDTH);
    editProfileModalWin.setCookieName("self-reg-modal");
    add(editProfileModalWin);

    Fragment selfRegFrag;
    if (userSelfRestClient.isSelfRegistrationAllowed()) {
        selfRegFrag = new Fragment("selfRegistration", "selfRegAllowed", this);

        final AjaxLink<Void> selfRegLink = new ClearIndicatingAjaxLink<Void>("link", getPageReference()) {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            protected void onClickInternal(final AjaxRequestTarget target) {
                editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        // anonymous authentication needed for self-registration
                        authenticate(anonymousUser, anonymousKey);

                        return new UserSelfModalPage(Login.this.getPageReference(), editProfileModalWin,
                                new UserTO());
                    }
                });

                editProfileModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

                    private static final long serialVersionUID = 251794406325329768L;

                    @Override
                    public void onClose(final AjaxRequestTarget target) {
                        SyncopeSession.get().invalidate();
                    }
                });

                editProfileModalWin.show(target);
            }
        };
        selfRegLink.add(new Label("linkTitle", getString("selfRegistration")));

        Panel panel = new LinkPanel("selfRegistration", new ResourceModel("selfRegistration"));
        panel.add(selfRegLink);
        selfRegFrag.add(panel);
    } else {
        selfRegFrag = new Fragment("selfRegistration", "selfRegNotAllowed", this);
    }
    add(selfRegFrag);
}

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

License:Apache License

public AjaxDataTablePanel(final String id, final List<IColumn<T, S>> columns,
        final ISortableDataProvider<T, S> dataProvider, final int rowsPerPage,
        final Collection<ActionLink.ActionType> actions, final BaseRestClient bulkActionExecutor,
        final String itemIdField, final String pageId, final PageReference pageRef) {

    super(id);/*  ww w .  jav a  2  s  . c  om*/

    final ModalWindow bulkModalWin = new ModalWindow("bulkModal");
    bulkModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    bulkModalWin.setInitialHeight(600);
    bulkModalWin.setInitialWidth(900);
    bulkModalWin.setCookieName("bulk-modal");
    add(bulkModalWin);

    bulkModalWin.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487149L;

        @Override
        public void onClose(final AjaxRequestTarget target) {
            final EventDataWrapper data = new EventDataWrapper();
            data.setTarget(target);
            data.setRows(rowsPerPage);

            send(pageRef.getPage(), Broadcast.BREADTH, data);

            final AbstractBasePage page = (AbstractBasePage) pageRef.getPage();

            if (page.isModalResult()) {
                // reset modal result
                page.setModalResult(false);
                // set operation succeeded
                getSession().info(getString(Constants.OPERATION_SUCCEEDED));
                // refresh feedback panel
                target.add(page.getFeedbackPanel());
            }
        }
    });

    Fragment fragment = new Fragment("tablePanel", "bulkAvailable", this);
    add(fragment);

    Form<T> bulkActionForm = new Form<T>("groupForm");
    fragment.add(bulkActionForm);

    group = new CheckGroup<T>("checkgroup", model);
    group.add(new AjaxFormChoiceComponentUpdatingBehavior() {

        private static final long serialVersionUID = -151291731388673682L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            // triggers AJAX form submit
        }
    });
    bulkActionForm.add(group);

    columns.add(0, new CheckGroupColumn<T, S>(group));
    dataTable = new AjaxFallbackDefaultDataTable<T, S>("dataTable", columns, dataProvider, rowsPerPage);
    group.add(dataTable);

    fragment.add(new ClearIndicatingAjaxButton("bulkActionLink", bulkActionForm, pageRef) {

        private static final long serialVersionUID = 382302811235019988L;

        @Override
        protected void onSubmitInternal(final AjaxRequestTarget target, final Form<?> form) {
            bulkModalWin.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690941L;

                @Override
                public Page createPage() {
                    return new BulkActionModalPage<T, S>(bulkModalWin, group.getModelObject(), columns, actions,
                            bulkActionExecutor, itemIdField, pageId);
                }
            });

            bulkModalWin.show(target);
        }
    });
}

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

License:Apache License

private void setWindowClosedCallback(final ModalWindow window, final WebMarkupContainer container) {
    window.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

        @Override//from w w  w . j ava  2s  . c  o  m
        public void onClose(final AjaxRequestTarget target) {
            final UserTO updatedUserTO = ((UserModalPage) getPage()).getUserTO();
            if (!userTO.equals(updatedUserTO)) {
                if (updatedUserTO.getMemberships().size() > userTO.getMemberships().size()) {
                    Set<Long> diff = new HashSet<Long>(updatedUserTO.getMembershipMap().keySet());
                    diff.removeAll(userTO.getMembershipMap().keySet());

                    Set<String> resourcesToAdd = new HashSet<String>();
                    for (Long diffMembId : diff) {
                        long roleId = updatedUserTO.getMembershipMap().get(diffMembId).getRoleId();
                        RoleTO roleTO = RoleUtils.findRole(roleTreeBuilder, roleId);
                        resourcesToAdd.addAll(roleTO.getResources());
                        StatusUtils.update(userTO, statusPanel, target, resourcesToAdd,
                                Collections.<String>emptySet());
                    }
                }

                MembershipsPanel.this.userTO.getMemberships().clear();
                MembershipsPanel.this.userTO.getMemberships().addAll(updatedUserTO.getMemberships());
                target.add(container);
            }
        }
    });
}