Wicket 模态窗口无法正确显示

发布于 2024-10-16 06:26:36 字数 1945 浏览 2 评论 0原文

我正在尝试为我的应用程序创建一个模式窗口,但不幸的是我无法这样做。

我有一个扩展 WebPage 的页面,并且添加了一个扩展 Panel 的面板。页面和面板分开书写;即在 panel.javapage.java 中。现在,我在 this Wicket 的帮助下向面板添加了一个模式窗口示例示例 ()。但是,当页面呈现时,通过检查该页面的元素,我发现 divwicket:id 为“modal1”,具有属性 script="显示:无”。我不知道该怎么办。任何信息都会对我非常有帮助。

还有一件事:

return new ModalContent1Page(ModalWindowPage.this.getPageReference(), modal1);

return new ModalContent1Page(ModalWindowPage.this, modal1);

是相同的吗?


编辑:
问题解决了。事实上,当我问这个问题时,我当时并没有代码。我正在遵循 RoseIndia 的教程,但我没有成功,因为我我使用的是 wicket 1.3.1,PageReference 类在那里不可用。所以我解决它:

    final ModalWindow modalWindow;
    add(modalWindow = new ModalWindow("modalVideo"));

    modalWindow.setCookieName("modal-video");
    modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modalWindow.setResizable(false);
    modalWindow.setInitialHeight(215);
    modalWindow.setInitialWidth(215);
    modalWindow.setHeightUnit("px");        

    modalWindow.setPageCreator(new ModalWindow.PageCreator() {
        public Page createPage() {
            return new PlayVideo(ItemViewPanel.this.getPage(), modalWindow, itemId);
        }
    });

    AjaxLink showModalLink;
    add(showModalLink = new AjaxLink("showModal") {
        @Override
        public void onClick(AjaxRequestTarget target) {
                    modalWindow.show(target);
        }
    });

谢谢。

I am trying to create a modal window for my application, but unfortunately I am unable to do so.

I have a page that extends WebPage and I have added a panel that extends Panel to it. The page and panel are written separately; that is, in panel.java and page.java. Now, I have added a modal window to the panel with the help of this Wicket Examples example (source). But when the page renders, I am seeing — by inspecting element of that page — that the div with wicket:id of "modal1" has attribute script="display: none". I don't know what to do. Any information will be very helpful to me.

One more thing: are

return new ModalContent1Page(ModalWindowPage.this.getPageReference(), modal1);

and

return new ModalContent1Page(ModalWindowPage.this, modal1);

the same?

Edit:

The problem is solved. Actually when I asked the question I did not have the code then. I was following the tutorial of RoseIndia, but I was unsuccessful and as I am using wicket 1.3.1 the PageReference class is not available there. So I solve it as:

    final ModalWindow modalWindow;
    add(modalWindow = new ModalWindow("modalVideo"));

    modalWindow.setCookieName("modal-video");
    modalWindow.setCssClassName(ModalWindow.CSS_CLASS_GRAY);
    modalWindow.setResizable(false);
    modalWindow.setInitialHeight(215);
    modalWindow.setInitialWidth(215);
    modalWindow.setHeightUnit("px");        

    modalWindow.setPageCreator(new ModalWindow.PageCreator() {
        public Page createPage() {
            return new PlayVideo(ItemViewPanel.this.getPage(), modalWindow, itemId);
        }
    });

    AjaxLink showModalLink;
    add(showModalLink = new AjaxLink("showModal") {
        @Override
        public void onClick(AjaxRequestTarget target) {
                    modalWindow.show(target);
        }
    });

Thank you.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

仅冇旳回忆 2024-10-23 06:26:36

回答你的第二个问题:不,这两行代码不一样。 ModalWindowPage.this 是页面本身,因此其类型为 ModalWindowPage。另一方面,getPageReference() 返回一个 PageReference,它不在同一层次结构中。

To answer your second question: no, those two lines of code are not the same. ModalWindowPage.this is the page itself, so its type is ModalWindowPage. getPageReference(), on the other hand, returns a PageReference, which is not in the same hierarchy.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文