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

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

Introduction

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

Prototype

public ModalWindow setCloseButtonCallback(final CloseButtonCallback callback) 

Source Link

Document

Sets the CloseButtonCallback instance.

Usage

From source file:nl.mpi.lamus.web.pages.LamusPage.java

License:Open Source License

private ModalWindow createAboutModalWindow() {

    ModalWindow modalAbout = new ModalWindow("modalAbout");
    modalAbout.setContent(new AboutPanel(modalAbout.getContentId()));
    modalAbout.setTitle("About LAMUS 2");
    modalAbout.setCookieName("modal-about");
    modalAbout.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        @Override/*from   ww  w . j  ava2 s . c o  m*/
        public boolean onCloseButtonClicked(AjaxRequestTarget art) {
            return true;
        }
    });
    modalAbout.setWindowClosedCallback((new ModalWindow.WindowClosedCallback() {
        @Override
        public void onClose(AjaxRequestTarget art) {
        }
    }));

    return modalAbout;
}

From source file:ontopoly.components.FieldInstanceCreatePlayerPanel.java

License:Apache License

protected void showInstancePage(AjaxRequestTarget target, Topic topic, TopicType topicType, Component c) {
    // open modal window
    final ModalWindow createModal = new ModalWindow("createModal");
    TopicModel<Topic> topicModel = new TopicModel<Topic>(topic);
    TopicTypeModel topicTypeModel = new TopicTypeModel(topicType);
    createModal.setContent(/*  www .  j  a v  a 2  s .  c  om*/
            new ModalInstancePage(createModal.getContentId(), topicModel, topicTypeModel, fieldsViewModel) {
                @Override
                protected void onCloseOk(AjaxRequestTarget target) {
                    // close modal and update parent
                    createModal.close(target);
                    FieldInstanceCreatePlayerPanel.this.hideInstancePage(target);
                }
            });
    createModal.setTitle(new ResourceModel("ModalWindow.title.edit.new").getObject().toString()
            + topicType.getName() + "...");
    createModal.setCookieName("createModal");

    createModal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            // modal already closed, now update parent 
            FieldInstanceCreatePlayerPanel.this.hideInstancePage(target);
            return true;
        }
    });

    replace(createModal);
    createModal.show(target);
    target.addComponent(this);
}

From source file:org.alienlabs.hatchetharry.view.page.HomePage.java

License:Open Source License

private void generateLoginLink(final String id, final ModalWindow window) {
    window.setInitialWidth(300);/*from www  .  j ava 2  s  .co  m*/
    window.setInitialHeight(200);
    window.setTitle("HatchetHarry login");
    window.setContent(new LoginModalWindow(window.getContentId(), window));
    window.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    window.setMaskType(ModalWindow.MaskType.SEMI_TRANSPARENT);
    window.setOutputMarkupId(true);
    window.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        private static final long serialVersionUID = 1L;

        @Override
        public boolean onCloseButtonClicked(final AjaxRequestTarget target) {
            target.appendJavaScript("authenticateUserWithFacebook();");
            return true;
        }
    });
    this.add(window);

    final AjaxLink<Void> loginLink = new AjaxLink<Void>(id) {
        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(final AjaxRequestTarget target) {
            target.prependJavaScript(BattlefieldService.HIDE_MENUS);
            target.appendJavaScript("Wicket.Window.unloadConfirmation = false;");
            HomePage.this.loginWindow.show(target);
        }
    };

    loginLink.setOutputMarkupId(true);
    this.add(loginLink);
}

From source file:org.dcm4chee.web.war.common.SimpleEditDicomObjectPanel.java

License:LGPL

public SimpleEditDicomObjectPanel(String id, final ModalWindow window, AbstractDicomModel dcmModel,
        String title, final int[][] tagPaths, final boolean close, IModel<Boolean> useFnGn) {
    super(id);// w ww . j  a va  2  s. c  om
    this.setOutputMarkupId(true);
    this.useFnGn = useFnGn;
    window.setCloseButtonCallback(new CloseButtonCallback() {
        private static final long serialVersionUID = 1L;

        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            onClose();
            return true;
        }
    });

    this.dcmObj = new BasicDicomObject();
    this.tagPaths = tagPaths;
    dcmModel.getDataset().copyTo(this.dcmObj);
    add(new Label("title", new Model<String>(title)));
    add(form = new BaseForm("form"));
    form.setOutputMarkupId(true);
    addHdrLabels(form);
    RepeatingView rv = new RepeatingView("elements") {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onPopulate() {
            removeAll();
            addDicomObject(this, tagPaths);
        }
    };
    form.add(rv);
    form.add(new AjaxFallbackButton("submit", new ResourceModel("saveBtn"), form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            try {
                SimpleEditDicomObjectPanel.this.onSubmit();
                getPage().setOutputMarkupId(true);
                target.addComponent(getPage());
                if (close)
                    window.close(target);
            } catch (WicketExceptionWithMsgKey e) {
                resultMessage.setObject(this.getString(e.getMsgKey()));
                target.addComponent(SimpleEditDicomObjectPanel.this);
            } catch (Exception e) {
                resultMessage.setObject(e.getLocalizedMessage());
                target.addComponent(SimpleEditDicomObjectPanel.this);
            }
        }

        @Override
        protected void onError(AjaxRequestTarget target, Form<?> form) {
            BaseForm.addFormComponentsToAjaxRequestTarget(target, form);
        }
    });
    form.add(new AjaxFallbackButton("cancel", new ResourceModel("cancelBtn"), form) {

        private static final long serialVersionUID = 1L;

        @Override
        protected void onSubmit(AjaxRequestTarget target, Form<?> form) {
            SimpleEditDicomObjectPanel.this.onCancel();
            window.close(target);
        }
    }.setDefaultFormProcessing(false));
    form.add(new Label("result-message", (resultMessage = new Model<String>(""))));
}

From source file:org.dcm4chee.web.war.folder.StudyListPage.java

License:LGPL

private Link<Object> getStudyPermissionLink(final ModalWindow modalWindow,
        final AbstractEditableDicomModel model, TooltipBehaviour tooltip) {

    int[] winSize = WebCfgDelegate.getInstance().getWindowSize("studyPerm");
    ModalWindowLink studyPermissionLink = new ModalWindowLink("studyPermissions", modalWindow, winSize[0],
            winSize[1]) {//from   w ww  .  j a v a  2s.  c om

        private static final long serialVersionUID = 1L;

        @Override
        public void onClick(AjaxRequestTarget target) {
            if (checkExists(model, target)) {
                modalWindow.setPageCreator(new ModalWindow.PageCreator() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public Page createPage() {
                        return new StudyPermissionsPage(model);
                    }
                });

                modalWindow.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {

                    private static final long serialVersionUID = 1L;

                    @Override
                    public void onClose(AjaxRequestTarget target) {
                        updateStudyPermissions();
                        query(target);
                        modalWindow.getPage().setOutputMarkupId(true);
                        target.addComponent(modalWindow.getPage());
                        target.addComponent(header);
                    }
                });
                modalWindow.add(new ModalWindowLink.DisableDefaultConfirmBehavior());
                modalWindow.setTitle("");
                modalWindow.setCloseButtonCallback(null);
                modalWindow.show(target);
            }
        }

        @Override
        public boolean isVisible() {
            return studyPermissionHelper.isManageStudyPermissions() && model.getDataset() != null
                    && !(model instanceof PatientModel && !((PatientModel) model).isExpandable());
        }
    };
    Image image = new Image("studyPermissionsImg", ImageManager.IMAGE_FOLDER_STUDY_PERMISSIONS);
    image.add(new ImageSizeBehaviour("vertical-align: middle;"));
    if (tooltip != null)
        image.add(tooltip);
    studyPermissionLink.add(image);
    return studyPermissionLink;
}

From source file:org.devgateway.eudevfin.projects.module.components.panels.ReportsTableListPanel.java

private ModalWindow AddModalWindow(PageParameters parameters) {

    if (parameters == null) {
        parameters = new PageParameters();
    }/* w w w  .j  av a  2  s.  co m*/

    final ModalWindow modal = new ModalWindow("modal");

    modal.setCookieName("modal-1");
    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override
        public org.apache.wicket.Page createPage() {
            return new ReportsTableModal(getParameters(),
                    ReportsTableListPanel.this.getPage().getPageReference(), modal);
        }
    });
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        public void onClose(AjaxRequestTarget target) {
            ReportsTableListPanel newComp = new ReportsTableListPanel(WICKETID_LIST_PANEL,
                    new ProjectReportsListGenerator(NewProjectPage.project.getProjectReports()));
            getParent().replace(newComp);
            target.add(newComp);
        }
    });
    modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            return true;
        }
    });

    return modal;
}

From source file:org.devgateway.eudevfin.projects.module.components.panels.ResultsTableListPanel.java

private ModalWindow AddModalWindow(PageParameters parameters) {

    if (parameters == null) {
        parameters = new PageParameters();
    }//from w ww  .  j a  va  2  s. c  om

    final ModalWindow modal = new ModalWindow("modal");

    modal.setCookieName("modal-1");
    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override
        public org.apache.wicket.Page createPage() {
            return new ResultsTableModal(getParameters(),
                    ResultsTableListPanel.this.getPage().getPageReference(), modal);
        }
    });
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        public void onClose(AjaxRequestTarget target) {
            ResultsTableListPanel newComp = new ResultsTableListPanel(WICKETID_LIST_PANEL,
                    new ProjectResultsListGenerator(NewProjectPage.project.getProjectResults()));
            getParent().replace(newComp);
            target.add(newComp);
        }
    });
    modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            // Change the passValue variable when modal window is closed.
            //setPassValue("Modal window is closed by user.");
            return true;
        }
    });

    return modal;
}

From source file:org.devgateway.eudevfin.projects.module.components.panels.TransactionTableListPanel.java

private ModalWindow AddModalWindow(PageParameters parameters) {

    if (parameters == null) {
        parameters = new PageParameters();
    }/*from  www.j  av a 2 s.  com*/

    final ModalWindow modal = new ModalWindow("modal");

    modal.setCookieName("modal-1");
    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override
        public org.apache.wicket.Page createPage() {
            return new TransactionsTableModal(getParameters(),
                    TransactionTableListPanel.this.getPage().getPageReference(), modal);
        }
    });
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        public void onClose(AjaxRequestTarget target) {
            TransactionTableListPanel newComp = new TransactionTableListPanel(WICKETID_LIST_PANEL,
                    new ProjectTransactionsListGenerator(NewProjectPage.project.getProjectTransactions()));
            newComp.add(new AttributeAppender("class", "budget-table"));
            getParent().replace(newComp);
            target.add(newComp);
        }
    });
    modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            return true;
        }
    });

    return modal;
}

From source file:org.devgateway.eudevfin.projects.module.components.tabs.ReportingTab.java

private ModalWindow AddModalWindow(PageParameters parameters) {
    final ModalWindow modal = new ModalWindow("modal");
    modal.setCookieName("modal-1");

    final PageParameters myParams = parameters;

    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override//w  w w .ja  v a2 s . c  o m
        public org.apache.wicket.Page createPage() {
            return new ReportsTableModal(myParams, ReportingTab.this.getPage().getPageReference(), modal);
        }
    });
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        public void onClose(AjaxRequestTarget target) {
            ReportsTableListPanel newComp = new ReportsTableListPanel(WICKETID_LIST_PANEL,
                    new ProjectReportsListGenerator(NewProjectPage.project.getProjectReports()));
            replace(newComp);
            target.add(newComp);
        }
    });
    modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            // Change the passValue variable when modal window is closed.
            //setPassValue("Modal window is closed by user.");
            return true;
        }
    });

    return modal;
}

From source file:org.devgateway.eudevfin.projects.module.components.tabs.ResultsTab.java

private ModalWindow AddModalWindow(PageParameters parameters) {
    final ModalWindow modal = new ModalWindow("modal");
    modal.setCookieName("modal-1");

    final PageParameters myParams = parameters;

    modal.setPageCreator(new ModalWindow.PageCreator() {
        @Override/*from w w  w .  j av a 2s . co  m*/
        public org.apache.wicket.Page createPage() {
            return new ResultsTableModal(myParams, ResultsTab.this.getPage().getPageReference(), modal);
        }
    });
    modal.setWindowClosedCallback(new ModalWindow.WindowClosedCallback() {
        public void onClose(AjaxRequestTarget target) {
            ResultsTableListPanel newComp = new ResultsTableListPanel(WICKETID_LIST_PANEL,
                    new ProjectResultsListGenerator(NewProjectPage.project.getProjectResults()));
            replace(newComp);
            target.add(newComp);
        }
    });
    modal.setCloseButtonCallback(new ModalWindow.CloseButtonCallback() {
        public boolean onCloseButtonClicked(AjaxRequestTarget target) {
            // Change the passValue variable when modal window is closed.
            //setPassValue("Modal window is closed by user.");
            return true;
        }
    });

    return modal;
}