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

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

Introduction

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

Prototype

public void show(final IPartialPageRequestHandler target) 

Source Link

Document

Shows the modal window.

Usage

From source file:org.apache.syncope.client.console.SyncopeApplication.java

License:Apache License

public void setupEditProfileModal(final WebPage page, final UserSelfRestClient userSelfRestClient) {
    // Modal window for editing user profile
    final ModalWindow editProfileModalWin = new ModalWindow("editProfileModal");
    editProfileModalWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    editProfileModalWin.setInitialHeight(EDIT_PROFILE_WIN_HEIGHT);
    editProfileModalWin.setInitialWidth(EDIT_PROFILE_WIN_WIDTH);
    editProfileModalWin.setCookieName("edit-profile-modal");
    page.add(editProfileModalWin);//from   ww  w .  j av  a  2  s. com

    final AjaxLink<Page> editProfileLink = new AjaxLink<Page>("editProfileLink") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            final UserTO userTO;
            if (SyncopeSession.get().isAuthenticated()) {
                try {
                    userTO = userSelfRestClient.read();
                } catch (Exception e) {
                    throw new WicketRuntimeException(e);
                }
            } else {
                userTO = new UserTO();
            }

            editProfileModalWin.setPageCreator(new ModalWindow.PageCreator() {

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new UserSelfModalPage(page.getPageReference(), editProfileModalWin, userTO);
                }
            });

            editProfileModalWin.show(target);
        }
    };

    editProfileLink.add(new Label("username", SyncopeSession.get().getUsername()));

    if ("admin".equals(SyncopeSession.get().getUsername())) {
        editProfileLink.setEnabled(false);
    }

    page.add(editProfileLink);
}

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);/*from w ww  .jav a2 s .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. j  a v a  2  s  .co m

    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

public MembershipsPanel(final String id, final UserTO userTO, final boolean templateMode,
        final StatusPanel statusPanel, final PageReference pageRef) {

    super(id);//w w w.  java  2s  . c  o  m
    this.userTO = userTO;
    this.statusPanel = statusPanel;

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

    final ModalWindow membWin = new ModalWindow("membershipWin");
    membWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    membWin.setCookieName("create-membership-modal");
    add(membWin);

    final ITreeProvider<DefaultMutableTreeNode> treeProvider = new TreeRoleProvider(roleTreeBuilder, true);
    final DefaultMutableTreeNodeExpansionModel treeModel = new DefaultMutableTreeNodeExpansionModel();

    tree = new DefaultNestedTree<DefaultMutableTreeNode>("treeTable", treeProvider, treeModel) {

        private static final long serialVersionUID = 7137658050662575546L;

        @Override
        protected Component newContentComponent(final String id, final IModel<DefaultMutableTreeNode> node) {
            final DefaultMutableTreeNode treeNode = node.getObject();
            final RoleTO roleTO = (RoleTO) treeNode.getUserObject();

            return new Folder<DefaultMutableTreeNode>(id, MembershipsPanel.this.tree, node) {

                private static final long serialVersionUID = 9046323319920426493L;

                @Override
                protected boolean isClickable() {
                    return true;
                }

                @Override
                protected IModel<?> newLabelModel(final IModel<DefaultMutableTreeNode> model) {
                    return new Model<String>(roleTO.getDisplayName());
                }

                @Override
                protected void onClick(final AjaxRequestTarget target) {
                    if (roleTO.getId() > 0) {
                        membWin.setPageCreator(new ModalWindow.PageCreator() {

                            private static final long serialVersionUID = 7661763358801821185L;

                            @Override
                            public Page createPage() {
                                PageReference pageRef = getPage().getPageReference();

                                for (MembershipTO membTO : membView.getList()) {
                                    if (membTO.getRoleId() == roleTO.getId()) {
                                        return new MembershipModalPage(pageRef, membWin, membTO, templateMode);
                                    }
                                }
                                MembershipTO membTO = new MembershipTO();
                                membTO.setRoleId(roleTO.getId());
                                membTO.setRoleName(roleTO.getName());

                                return new MembershipModalPage(pageRef, membWin, membTO, templateMode);
                            }
                        });
                        membWin.show(target);
                    }
                }
            };
        }
    };
    tree.add(new WindowsTheme());
    tree.setOutputMarkupId(true);

    DefaultMutableTreeNodeExpansion.get().expandAll();

    this.add(tree);

    membView = new ListView<MembershipTO>("memberships",
            new PropertyModel<List<? extends MembershipTO>>(userTO, "memberships")) {

        private static final long serialVersionUID = 9101744072914090143L;

        @Override
        protected void populateItem(final ListItem<MembershipTO> item) {
            final MembershipTO membershipTO = (MembershipTO) item.getDefaultModelObject();

            item.add(new Label("roleId", new Model<Long>(membershipTO.getRoleId())));
            item.add(new Label("roleName", new Model<String>(membershipTO.getRoleName())));

            AjaxLink editLink = new ClearIndicatingAjaxLink("editLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

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

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new MembershipModalPage(getPage().getPageReference(), membWin, membershipTO,
                                    templateMode);

                        }
                    });
                    membWin.show(target);
                }
            };
            item.add(editLink);

            AjaxLink deleteLink = new IndicatingOnConfirmAjaxLink("deleteLink", pageRef) {

                private static final long serialVersionUID = -7978723352517770644L;

                @Override
                protected void onClickInternal(final AjaxRequestTarget target) {
                    userTO.getMemberships().remove(membershipTO);
                    ((UserModalPage) getPage()).getUserTO().getMemberships().remove(membershipTO);
                    target.add(membershipsContainer);

                    RoleTO roleTO = RoleUtils.findRole(roleTreeBuilder, membershipTO.getRoleId());
                    Set<String> resourcesToRemove = roleTO == null ? Collections.<String>emptySet()
                            : roleTO.getResources();
                    if (!resourcesToRemove.isEmpty()) {
                        Set<String> resourcesAssignedViaMembership = new HashSet<String>();
                        for (MembershipTO membTO : userTO.getMemberships()) {
                            roleTO = RoleUtils.findRole(roleTreeBuilder, membTO.getRoleId());
                            if (roleTO != null) {
                                resourcesAssignedViaMembership.addAll(roleTO.getResources());
                            }
                        }
                        resourcesToRemove.removeAll(resourcesAssignedViaMembership);
                        resourcesToRemove.removeAll(userTO.getResources());
                    }

                    StatusUtils.update(userTO, statusPanel, target, Collections.<String>emptySet(),
                            resourcesToRemove);
                }
            };
            item.add(deleteLink);
        }
    };

    membershipsContainer.add(membView);

    setWindowClosedCallback(membWin, membershipsContainer);
}

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

License:Apache License

public PoliciesPanel(final String id, final PageReference pageRef, final PolicyType policyType) {
    super(id);//from  ww  w .j  a  v  a 2  s .co  m
    this.pageRef = pageRef;
    this.policyType = policyType;

    // Modal window for editing user attributes
    final ModalWindow mwindow = new ModalWindow("editModalWin");
    mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    mwindow.setInitialHeight(MODAL_WIN_HEIGHT);
    mwindow.setInitialWidth(MODAL_WIN_WIDTH);
    mwindow.setCookieName("policy-modal");
    add(mwindow);

    // Container for user list
    final WebMarkupContainer container = new WebMarkupContainer("container");
    container.setOutputMarkupId(true);
    add(container);

    setWindowClosedCallback(mwindow, container);

    final List<IColumn<AbstractPolicyTO, String>> columns = new ArrayList<IColumn<AbstractPolicyTO, String>>();

    columns.add(new PropertyColumn<AbstractPolicyTO, String>(new ResourceModel("id"), "id", "id"));

    columns.add(new PropertyColumn<AbstractPolicyTO, String>(new ResourceModel("description"), "description",
            "description"));

    columns.add(new AbstractColumn<AbstractPolicyTO, String>(new ResourceModel("type")) {

        private static final long serialVersionUID = 8263694778917279290L;

        @Override
        public void populateItem(final Item<ICellPopulator<AbstractPolicyTO>> cellItem,
                final String componentId, final IModel<AbstractPolicyTO> model) {

            cellItem.add(new Label(componentId, getString(model.getObject().getType().name())));
        }
    });

    columns.add(new AbstractColumn<AbstractPolicyTO, String>(new ResourceModel("actions", "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<AbstractPolicyTO>> cellItem,
                final String componentId, final IModel<AbstractPolicyTO> model) {

            final AbstractPolicyTO policyTO = model.getObject();

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

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {

                    mwindow.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @SuppressWarnings({ "unchecked", "rawtypes" })
                        @Override
                        public Page createPage() {
                            return new PolicyModalPage(pageRef, mwindow, policyTO);
                        }
                    });

                    mwindow.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Policies");

            panel.add(new ActionLink() {

                private static final long serialVersionUID = -3722207913631435501L;

                @Override
                public void onClick(final AjaxRequestTarget target) {
                    try {
                        policyRestClient.delete(policyTO.getId(), policyTO.getClass());
                        info(getString(Constants.OPERATION_SUCCEEDED));
                    } catch (SyncopeClientException e) {
                        error(getString(Constants.OPERATION_ERROR));

                        LOG.error("While deleting policy {}({})", policyTO.getId(), policyTO.getDescription(),
                                e);
                    }

                    target.add(container);
                    ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
                }
            }, ActionLink.ActionType.DELETE, "Policies");

            cellItem.add(panel);
        }
    });

    @SuppressWarnings({ "unchecked", "rawtypes" })
    final AjaxFallbackDefaultDataTable table = new AjaxFallbackDefaultDataTable("datatable", columns,
            new PolicyDataProvider(), paginatorRows);

    container.add(table);

    final AjaxLink<Void> createButton = new ClearIndicatingAjaxLink<Void>("createLink", pageRef) {

        private static final long serialVersionUID = -7978723352517770644L;

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

                private static final long serialVersionUID = -7834632442532690940L;

                @SuppressWarnings({ "unchecked", "rawtypes" })
                @Override
                public Page createPage() {
                    return new PolicyModalPage(pageRef, mwindow, getPolicyTOInstance(policyType));
                }
            });

            mwindow.show(target);
        }
    };

    add(createButton);

    MetaDataRoleAuthorizationStrategy.authorize(createButton, ENABLE,
            xmlRolesReader.getAllAllowedRoles("Policies", "create"));

    @SuppressWarnings("rawtypes")
    final Form paginatorForm = new Form("PaginatorForm");

    @SuppressWarnings({ "unchecked", "rawtypes" })
    final DropDownChoice rowsChooser = new DropDownChoice("rowsChooser",
            new PropertyModel(this, "paginatorRows"), prefMan.getPaginatorChoices());

    rowsChooser.add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            prefMan.set(getWebRequest(), (WebResponse) getResponse(), Constants.PREF_POLICY_PAGINATOR_ROWS,
                    String.valueOf(paginatorRows));
            table.setItemsPerPage(paginatorRows);

            target.add(container);
        }
    });

    paginatorForm.add(rowsChooser);
    add(paginatorForm);
}

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

License:Apache License

public RoleDetailsPanel(final String id, final RoleTO roleTO, final boolean templateMode) {
    super(id);//from  ww  w  . j  ava 2 s.c om

    ownerContainer = new WebMarkupContainer("ownerContainer");
    ownerContainer.setOutputMarkupId(true);
    this.add(ownerContainer);

    final ModalWindow userOwnerSelectWin = new ModalWindow("userOwnerSelectWin");
    userOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    userOwnerSelectWin.setCookieName("create-userOwnerSelect-modal");
    this.add(userOwnerSelectWin);
    final ModalWindow roleOwnerSelectWin = new ModalWindow("roleOwnerSelectWin");
    roleOwnerSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    roleOwnerSelectWin.setCookieName("create-roleOwnerSelect-modal");
    this.add(roleOwnerSelectWin);
    final ModalWindow parentSelectWin = new ModalWindow("parentSelectWin");
    parentSelectWin.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    parentSelectWin.setCookieName("create-parentSelect-modal");
    this.add(parentSelectWin);

    if (templateMode) {
        parentFragment = new Fragment("parent", "parentFragment", this);

        parentModel = new ParentModel(roleTO);
        @SuppressWarnings("unchecked")
        final AjaxTextFieldPanel parent = new AjaxTextFieldPanel("parent", "parent", parentModel);
        parent.setReadOnly(true);
        parent.setOutputMarkupId(true);
        parentFragment.add(parent);
        final AjaxLink<Void> parentSelect = new IndicatingAjaxLink<Void>("parentSelect") {

            private static final long serialVersionUID = -7978723352517770644L;

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

                    private static final long serialVersionUID = -7834632442532690940L;

                    @Override
                    public Page createPage() {
                        return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
                                ParentSelectPayload.class);
                    }
                });
                parentSelectWin.show(target);
            }
        };
        parentFragment.add(parentSelect);
        final IndicatingAjaxLink<Void> parentReset = new IndicatingAjaxLink<Void>("parentReset") {

            private static final long serialVersionUID = -7978723352517770644L;

            @Override
            public void onClick(final AjaxRequestTarget target) {
                parentModel.setObject(null);
                target.add(parent);
            }
        };
        parentFragment.add(parentReset);
    } else {
        parentFragment = new Fragment("parent", "emptyFragment", this);
    }
    parentFragment.setOutputMarkupId(true);
    this.add(parentFragment);

    final AjaxTextFieldPanel name = new AjaxTextFieldPanel("name", "name",
            new PropertyModel<String>(roleTO, "name"));

    final WebMarkupContainer jexlHelp = JexlHelpUtil.getJexlHelpWebContainer("jexlHelp");

    final AjaxLink questionMarkJexlHelp = JexlHelpUtil.getAjaxLink(jexlHelp, "questionMarkJexlHelp");
    this.add(questionMarkJexlHelp);
    questionMarkJexlHelp.add(jexlHelp);

    if (!templateMode) {
        name.addRequiredLabel();
        questionMarkJexlHelp.setVisible(false);
    }
    this.add(name);

    userOwnerModel = new OwnerModel(roleTO, AttributableType.USER);
    @SuppressWarnings("unchecked")
    final AjaxTextFieldPanel userOwner = new AjaxTextFieldPanel("userOwner", "userOwner", userOwnerModel);
    userOwner.setReadOnly(true);
    userOwner.setOutputMarkupId(true);
    ownerContainer.add(userOwner);
    final AjaxLink<Void> userOwnerSelect = new IndicatingAjaxLink<Void>("userOwnerSelect") {

        private static final long serialVersionUID = -7978723352517770644L;

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

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new UserOwnerSelectModalPage(getPage().getPageReference(), userOwnerSelectWin);
                }
            });
            userOwnerSelectWin.show(target);
        }
    };
    ownerContainer.add(userOwnerSelect);
    final IndicatingAjaxLink<Void> userOwnerReset = new IndicatingAjaxLink<Void>("userOwnerReset") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            userOwnerModel.setObject(null);
            target.add(userOwner);
        }
    };
    ownerContainer.add(userOwnerReset);

    roleOwnerModel = new OwnerModel(roleTO, AttributableType.ROLE);
    @SuppressWarnings("unchecked")
    final AjaxTextFieldPanel roleOwner = new AjaxTextFieldPanel("roleOwner", "roleOwner", roleOwnerModel);
    roleOwner.setReadOnly(true);
    roleOwner.setOutputMarkupId(true);
    ownerContainer.add(roleOwner);
    final AjaxLink<Void> roleOwnerSelect = new IndicatingAjaxLink<Void>("roleOwnerSelect") {

        private static final long serialVersionUID = -7978723352517770644L;

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

                private static final long serialVersionUID = -7834632442532690940L;

                @Override
                public Page createPage() {
                    return new RoleSelectModalPage(getPage().getPageReference(), parentSelectWin,
                            RoleOwnerSelectPayload.class);
                }
            });
            parentSelectWin.show(target);
        }
    };
    ownerContainer.add(roleOwnerSelect);
    final IndicatingAjaxLink<Void> roleOwnerReset = new IndicatingAjaxLink<Void>("roleOwnerReset") {

        private static final long serialVersionUID = -7978723352517770644L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            roleOwnerModel.setObject(null);
            target.add(roleOwner);
        }
    };
    ownerContainer.add(roleOwnerReset);

    final AjaxCheckBoxPanel inhOwner = new AjaxCheckBoxPanel("inheritOwner", "inheritOwner",
            new PropertyModel<Boolean>(roleTO, "inheritOwner"));
    this.add(inhOwner);

    final AjaxCheckBoxPanel inhTemplates = new AjaxCheckBoxPanel("inheritTemplates", "inheritTemplates",
            new PropertyModel<Boolean>(roleTO, "inheritTemplates"));
    inhTemplates.getField().add(new AjaxFormComponentUpdatingBehavior(Constants.ON_CHANGE) {

        private static final long serialVersionUID = -1107858522700306810L;

        @Override
        protected void onUpdate(final AjaxRequestTarget target) {
            send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rAttrTemplates, target));
            send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rDerAttrTemplates, target));
            send(getPage(), Broadcast.BREADTH, new RoleAttrTemplatesChange(Type.rVirAttrTemplates, target));
        }
    });
    this.add(inhTemplates);
}

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);//ww  w .j  av  a 2s . c o 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);
}

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

License:Apache License

public PolicyModalPage(final PageReference pageRef, final ModalWindow window, final T policyTO) {
    super();//from   w  ww.  ja  v a2  s.c om

    final Form<?> form = new Form<Void>(FORM);
    form.setOutputMarkupId(true);
    add(form);

    final AjaxTextFieldPanel policyid = new AjaxTextFieldPanel("id", "id",
            new PropertyModel<String>(policyTO, "id"));
    policyid.setEnabled(false);
    policyid.setStyleSheet("ui-widget-content ui-corner-all short_fixedsize");
    form.add(policyid);

    final AjaxTextFieldPanel description = new AjaxTextFieldPanel("description", "description",
            new PropertyModel<String>(policyTO, "description"));
    description.addRequiredLabel();
    description.setStyleSheet("ui-widget-content ui-corner-all medium_dynamicsize");
    form.add(description);

    final AjaxDropDownChoicePanel<PolicyType> type = new AjaxDropDownChoicePanel<PolicyType>("type", "type",
            new PropertyModel<PolicyType>(policyTO, "type"));
    switch (policyTO.getType()) {
    case GLOBAL_ACCOUNT:
    case ACCOUNT:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_ACCOUNT, PolicyType.ACCOUNT }));
        break;

    case GLOBAL_PASSWORD:
    case PASSWORD:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_PASSWORD, PolicyType.PASSWORD }));
        break;

    case GLOBAL_SYNC:
    case SYNC:
        type.setChoices(Arrays.asList(new PolicyType[] { PolicyType.GLOBAL_SYNC, PolicyType.SYNC }));

    default:
    }
    type.setChoiceRenderer(new PolicyTypeRenderer());
    type.addRequiredLabel();
    form.add(type);

    // Authentication resources - only for AccountPolicyTO
    Fragment fragment;
    if (policyTO instanceof AccountPolicyTO) {
        fragment = new Fragment("forAccountOnly", "authResourcesFragment", form);

        final List<String> resourceNames = new ArrayList<String>();
        for (ResourceTO resource : resourceRestClient.getAll()) {
            resourceNames.add(resource.getName());
        }
        fragment.add(new AjaxPalettePanel<String>("authResources",
                new PropertyModel<List<String>>(policyTO, "resources"), new ListModel<String>(resourceNames)));
    } else {
        fragment = new Fragment("forAccountOnly", "emptyFragment", form);
    }
    form.add(fragment);
    //

    final AbstractPolicySpec policy = getPolicySpecification(policyTO);

    form.add(new PolicyBeanPanel("panel", policy));

    final ModalWindow mwindow = new ModalWindow("metaEditModalWin");
    mwindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    mwindow.setInitialHeight(WIN_HEIGHT);
    mwindow.setInitialWidth(WIN_WIDTH);
    mwindow.setCookieName("meta-edit-modal");
    add(mwindow);

    List<IColumn<String, String>> resColumns = new ArrayList<IColumn<String, String>>();
    resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("name", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId,
                final IModel<String> rowModel) {

            cellItem.add(new Label(componentId, rowModel.getObject()));
        }
    });
    resColumns.add(new AbstractColumn<String, String>(new StringResourceModel("actions", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<String>> cellItem, final String componentId,
                final IModel<String> model) {

            final String resource = 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) {
                    mwindow.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new ResourceModalPage(PolicyModalPage.this.getPageReference(), mwindow,
                                    resourceRestClient.read(resource), false);
                        }
                    });

                    mwindow.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Resources");

            cellItem.add(panel);
        }
    });
    ISortableDataProvider<String, String> resDataProvider = new SortableDataProvider<String, String>() {

        private static final long serialVersionUID = 8263758912838836438L;

        @Override
        public Iterator<? extends String> iterator(final long first, final long count) {
            return policyTO.getId() == 0 ? Collections.<String>emptyList().iterator()
                    : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources()
                            .subList((int) first, (int) first + (int) count).iterator();
        }

        @Override
        public long size() {
            return policyTO.getId() == 0 ? 0
                    : policyRestClient.getPolicy(policyTO.getId()).getUsedByResources().size();
        }

        @Override
        public IModel<String> model(final String object) {
            return new Model<String>(object);
        }
    };
    final AjaxFallbackDefaultDataTable<String, String> resources = new AjaxFallbackDefaultDataTable<String, String>(
            "resources", resColumns, resDataProvider, 10);
    form.add(resources);

    List<IColumn<RoleTO, String>> roleColumns = new ArrayList<IColumn<RoleTO, String>>();
    roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("id", "id"), "id", "id"));
    roleColumns.add(new PropertyColumn<RoleTO, String>(new ResourceModel("name", "name"), "name", "name"));
    roleColumns.add(new AbstractColumn<RoleTO, String>(new StringResourceModel("actions", this, null, "")) {

        private static final long serialVersionUID = 2054811145491901166L;

        @Override
        public String getCssClass() {
            return "action";
        }

        @Override
        public void populateItem(final Item<ICellPopulator<RoleTO>> cellItem, final String componentId,
                final IModel<RoleTO> model) {

            final RoleTO role = 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) {
                    mwindow.setPageCreator(new ModalWindow.PageCreator() {

                        private static final long serialVersionUID = -7834632442532690940L;

                        @Override
                        public Page createPage() {
                            return new RoleModalPage(PolicyModalPage.this.getPageReference(), mwindow, role);
                        }
                    });

                    mwindow.show(target);
                }
            }, ActionLink.ActionType.EDIT, "Roles");

            cellItem.add(panel);
        }
    });
    ISortableDataProvider<RoleTO, String> roleDataProvider = new SortableDataProvider<RoleTO, String>() {

        private static final long serialVersionUID = 8263758912838836438L;

        @Override
        public Iterator<? extends RoleTO> iterator(final long first, final long count) {
            List<RoleTO> roles = new ArrayList<RoleTO>();

            if (policyTO.getId() > 0) {
                for (Long roleId : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles()
                        .subList((int) first, (int) first + (int) count)) {

                    roles.add(roleRestClient.read(roleId));
                }
            }

            return roles.iterator();
        }

        @Override
        public long size() {
            return policyTO.getId() == 0 ? 0
                    : policyRestClient.getPolicy(policyTO.getId()).getUsedByRoles().size();
        }

        @Override
        public IModel<RoleTO> model(final RoleTO object) {
            return new Model<RoleTO>(object);
        }
    };
    final AjaxFallbackDefaultDataTable<RoleTO, String> roles = new AjaxFallbackDefaultDataTable<RoleTO, String>(
            "roles", roleColumns, roleDataProvider, 10);
    form.add(roles);

    mwindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

        private static final long serialVersionUID = 8804221891699487139L;

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

    final AjaxButton submit = new IndicatingAjaxButton(APPLY, new ResourceModel(APPLY)) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            setPolicySpecification(policyTO, policy);

            try {
                if (policyTO.getId() > 0) {
                    policyRestClient.updatePolicy(policyTO);
                } else {
                    policyRestClient.createPolicy(policyTO);
                }
                ((BasePage) pageRef.getPage()).setModalResult(true);

                window.close(target);
            } catch (Exception e) {
                LOG.error("While creating policy", e);

                error(getString(Constants.ERROR) + ": " + e.getMessage());
                ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
            }
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
            ((NotificationPanel) getPage().get(Constants.FEEDBACK)).refresh(target);
        }
    };
    form.add(submit);

    final IndicatingAjaxButton cancel = new IndicatingAjaxButton(CANCEL, new ResourceModel(CANCEL)) {

        private static final long serialVersionUID = -958724007591692537L;

        @Override
        protected void onSubmit(final AjaxRequestTarget target, final Form<?> form) {
            window.close(target);
        }

        @Override
        protected void onError(final AjaxRequestTarget target, final Form<?> form) {
        }
    };
    cancel.setDefaultFormProcessing(false);
    form.add(cancel);
}

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

License:Apache License

private void setupProfile() {
    final WebMarkupContainer profile = new WebMarkupContainer("profile");
    profile.setOutputMarkupId(true);//from   w w  w. java 2  s.c  om
    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("id"));
    profile.add(idLabel);

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

    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.console.pages.ReportModalPage.java

License:Apache License

@SuppressWarnings({ "unchecked", "rawtypes" })
private void setupExecutions() {
    final WebMarkupContainer executions = new WebMarkupContainer("executionContainer");
    executions.setOutputMarkupId(true);//  w  ww.j ava 2 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("id"), "id", "id"));
    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().getId();
                            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.getId());

                        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.getId() == 0 ? reportTO
                                : reportRestClient.read(reportTO.getId());
                        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);
}