0
我想創建我的自定義TabLayoutPanel
擴展,我的代碼如下:定製TabLayoutPanel在GWT
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如何知道要調用哪個構造函數)?
可能重複;無法將docklayout面板轉換爲自定義面板](http://stackoverflow.com/questions/11433805/gwt-ui-xml-cannot-convert-docklayout-panel-to-custom-panel) – 2012-07-18 18:49:58