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

License:Apache License

/**
 * Set a WindowClosedCallback for a ModalWindow instance.
 *
 * @param window window/* w w  w. j  a v a2  s.  c om*/
 * @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("operation_succeded"));
                target.add(feedbackPanel);
                setModalResult(false);
            }
        }
    });
}

From source file:org.syncope.console.pages.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//from  w  w w .  j  av a2s  . c  o m
        public void onClose(final AjaxRequestTarget target) {
            target.add(container);
        }
    });
}

From source file:org.syncope.console.pages.panels.ResultSetPanel.java

License:Apache License

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

        private static final long serialVersionUID = 8804221891699487139L;

        @Override/* w w w. j  a v  a2s .co  m*/
        public void onClose(final AjaxRequestTarget target) {
            final EventDataWrapper data = new EventDataWrapper();
            data.setTarget(target);

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

            if (page.isModalResult()) {
                // reset modal result
                page.setModalResult(false);
                // set operation succeded
                getSession().info(getString("operation_succeded"));
                // refresh feedback panel
                target.add(feedbackPanel);
            }
        }
    });
}

From source file:org.syncope.console.pages.panels.RolesPanel.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 va  2 s. co  m*/
        public void onClose(final AjaxRequestTarget target) {
            final UserTO updatedUserTO = ((UserModalPage) getPage()).getUserTO();

            RolesPanel.this.userTO.setMemberships(updatedUserTO.getMemberships());
            target.add(container);
        }
    });
}

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

License:Apache License

private void setupExecutions() {
    final WebMarkupContainer executions = new WebMarkupContainer("executions");
    executions.setOutputMarkupId(true);/*from  w  ww . ja  v a2s. 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 AbstractColumn<ReportExecTO>(new ResourceModel("actions", "")) {

        private static final long serialVersionUID = 2054811145491901166L;

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

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

            final ReportExecTO taskExecutionTO = model.getObject();

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

            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", "read",
                    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", "read",
                    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 {
                        restClient.deleteExecution(taskExecutionTO.getId());

                        reportTO.removeExecution(taskExecutionTO);

                        info(getString("operation_succeded"));
                    } catch (SyncopeClientCompositeErrorException scce) {
                        error(scce.getMessage());
                    }

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

            cellItem.add(panel);
        }
    });

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

From source file:org.syncope.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 ww.ja  va 2 s  . com
        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 succeded
                getSession().info(getString("operation_succeded"));
                // refresh feedback panel
                target.add(feedbackPanel);
            }
        }
    });
}

From source file:org.webical.web.pages.ErrorPage.java

License:Open Source License

public void setupNonAccessibleComponents() {
    //ModelDialog for the detailmessage
    final ModalWindow modalWindow = new ModalWindow(DETAILED_ERROR_PANEL_ID);

    //The detailed message
    final String detailedMessage = getDetailedMessage();

    //Link to show the details
    IndicatingAjaxLink showDetailsLink = new IndicatingAjaxLink(SHOW_DETAILS_LINK_MARKUP_ID) {

        private static final long serialVersionUID = 1L;

        @Override//from www.  j  a v  a2 s  .co  m
        public void onClick(AjaxRequestTarget ajaxRequestTarget) {

            modalWindow.setContent(new DetailPanel(modalWindow.getContentId(), new Model(detailedMessage)));
            modalWindow.setVisible(true);
            modalWindow.show(ajaxRequestTarget);
        }

    };

    if (detailedMessage == null) {
        showDetailsLink.setEnabled(false);
    } else {
        modalWindow.setInitialWidth(700);
        modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

            private static final long serialVersionUID = 1L;

            public void onClose(AjaxRequestTarget ajaxRequestTarget) {
                modalWindow.setContent(new Label(modalWindow.getContentId(), new Model("")));
                modalWindow.setVisible(false);
                ajaxRequestTarget.addComponent(modalWindow);
                getSession().createAutoPageMap();
            }

        });
    }

    //Add components
    addOrReplace(modalWindow);
    addOrReplace(showDetailsLink);
}