复制GWT TabLayoutPanel 的元素
我发现 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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 GWT 2.1 中,有 UiChild 属性。这很酷。
title
参数将用tabdef
标记中的同名属性填充,如下所示:Edit: 明确地说,
tabdef
没有在任何地方定义为类;解析期间所需的行为由 UiChild 属性定义。In GWT 2.1 there's the UiChild attribute. It's quite cool.
The
title
parameter will be filled with an attribute of the same name in thetabdef
tag, like so:Edit: to be clear,
tabdef
isn't defined anywhere as a class; the desired behaviour during parsing is defined by UiChild attribute.要为您的小部件使用自定义标签,例如
和
,您需要创建一个自定义 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