我正在尝试创建我的自定义TabLayoutPanel
扩展,我的代码如下:
public class ExpandableTabLayoutPanel extends TabLayoutPanel {
@UiConstructor
public ExpandableTabLayoutPanel(double barHeight, Unit barUnit) {
super(barHeight, barUnit);
addExpandableBehaviour();
}
private addExpandableBehaviour(){
//...
}
}
在这里我从 UIBinder 调用它:
<a:ExpandableTabLayoutPanel barHeight="20" barUnit="PX">
<a:tab>
<a:header>header</a:header>
<a:AdvancedRichTextArea styleName="{style.area}" ui:field="area"/>
</a:tab>
</a:ExpandableTabLayoutPanel>
(即使我的包/工作区中没有定义选项卡和标题,错误消息也迫使我使用a:tab
/a:header
而不是g:tab
/ ,但这可能不是问题)g:header
a:
如果@UiConstructor
像清单中那样在 ExpandableTabLayoutPanel 上存在注释,我会收到奇怪的错误:
[ERROR] [gwtreproduce] - <a:ExpandableTabLayoutPanel barHeight='20' barUnit='PX'> missing required attribute(s): arg1 barHeight Element <a:ExpandableTabLayoutPanel barHeight='20' barUnit='PX'> (:13)
当我禁用@UiConstructor
时,我会遇到更奇怪的错误:
[ERROR] [gwtreproduce] - Errors in 'generated://E6338B946DFB2D28988DA492134093C7/reproduce/client/TestView_TestViewUiBinderImpl.java' : [ERROR] [gwtreproduce] - Line 33: Type mismatch: cannot convert from TabLayoutPanel to ExpandableTabLayoutPanel
扩展 TabLayoutPanel 我做错了什么?
还有一个问题:构造函数怎么可能TabLayoutPanel
没有用@UiConstructor注释并且可以在UiBinder中使用(UiBinder如何知道要调用哪个构造函数)?