复制GWT TabLayoutPanel 的元素

发布于 2024-09-16 23:02:10 字数 702 浏览 20 评论 0原文

我发现 GWT 选项卡面板对于我需要执行的样式来说很笨重,因此我尝试制作自己的简单选项卡面板。基本上是一个用于选项卡的 HTML5

GWT TabLayoutPanel 有这些“特殊”标签,用于定义选项卡的内容:

<g:TabLayoutPanel>
    <g:tab>
        <g:header>Tab Title</g:header>
        <g:OtherWidget>Tab contents</g:OtherWidget>
    </g:tab>
</g:TabLayoutPanel>

我指的是 >。我看到这些类型的标签在不同的地方使用,但我不知道如何创建它们。查看 TabLayoutPanel 源代码,我发现它有一个 add 方法,该方法需要两个小部件,然后它将一个小部件(内容)放入面板中进行显示,将另一个小部件(标题)放入面板中。 TabLayoutPanel.Tab 的实例。但我不知道如何复制这种功能。

I've found the GWT tab panels clunky for the styling I need to do, so I'm trying to make my own, simple tab panel. Basically an HTML5 <nav> element for tabs and a DeckPanel to display the content. Let the use figure out the rest with CSS3.

The GWT TabLayoutPanel has these "special" tags it uses to define the contents of a tab:

<g:TabLayoutPanel>
    <g:tab>
        <g:header>Tab Title</g:header>
        <g:OtherWidget>Tab contents</g:OtherWidget>
    </g:tab>
</g:TabLayoutPanel>

I'm referring to <g:tab> and <g:header>. I see these type of tags used in various places but I have no idea how to create them. Looking at the TabLayoutPanel source, I see that it has an add method that expects two widgets, and from that it puts one widget (the contents) into a panel for display and another (the header) into an instance of TabLayoutPanel.Tab. But I have no idea how to duplicate this kind of functionality.

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

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

发布评论

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

评论(2

早茶月光 2024-09-23 23:02:10

在 GWT 2.1 中,有 UiChild 属性。这很酷。

@UiChild public void addTabDef(Widget page, String title) {...}

title 参数将用 tabdef 标记中的同名属性填充,如下所示:

<v:tabdef title="Tab one"><g:Label>Page one.</g:Label></v:tabdef>

Edit: 明确地说,tabdef 没有在任何地方定义为类;解析期间所需的行为由 UiChild 属性定义。

In GWT 2.1 there's the UiChild attribute. It's quite cool.

@UiChild public void addTabDef(Widget page, String title) {...}

The title parameter will be filled with an attribute of the same name in the tabdef tag, like so:

<v:tabdef title="Tab one"><g:Label>Page one.</g:Label></v:tabdef>

Edit: to be clear, tabdef isn't defined anywhere as a class; the desired behaviour during parsing is defined by UiChild attribute.

哥,最终变帅啦 2024-09-23 23:02:10

要为您的小部件使用自定义标签,例如 ,您需要创建一个自定义 ElementParse 并将其注册到 UiBinderWriter。不幸的是,在不编辑 gwt 源代码的情况下,还没有简单的方法可以做到这一点。

有用的链接:

指向无法解决问题的链接创建自定义 ElementParser

TabLayoutPanelParser

To use custome tags for you widget like <g:tab> and <g:header> you need to create a custom ElementParse and register it with the UiBinderWriter. Unfortanatly there is no simple way of doing this yet without editing the sourcecode for gwt.

Usefull links:

A link to the issue of not being able to create custom ElementParser

TabLayoutPanelParser

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