我正在使用GWT UiBinder创建自定义组件。主类(表uibinder)将使用寻呼机创建自定义组件表,参见下面的代码
Table.ui.xml:
<ui:UiBinder xmlns:item="urn:import:"com.example.ui.widgets.item">
<g:HTMLPanel >
<item:CustomGrid ui:field="table"></item:CustomGrid>
<item:Pager ui:field="pager" </item:Pager>
</g:HTMLPanel>
</ui:UiBinder>
Table.java:
package com.example.ui.widgets.item;
public class Table extends Composite{
private static TableUiBinder uiBinder = GWT.create(TableUiBinder.class);
interface TableUiBinder extends
UiBinder<Widget, Table> {
}
@UiField CustomGrid grid;
@UiField Pager pager;
public Table() {
initWidget(uiBinder.createAndBindUi(this));
}
class CustomGrid extends CellTable{
//create custom celltable
}
class Pager{
//Pagination code
}
}
如何访问(和添加)Inner Class CustomGrid&amp; UiBinder中的寻呼机?语法是什么?
答案 0 :(得分:0)
不知道我是否帮助你,但在上面的代码中,有些事情应该改变。如果这不能回答你的问题,请更准确。
<ui:UiBinder xmlns:item="urn:import:"com.example.ui.widgets.item">
<g:HTMLPanel >
<item:CustomGrid ui:field="table"></item:CustomGrid>
<item:Pager ui:field="pager" </item:Pager>
</g:HTMLPanel>
</ui:UiBinder>
到目前为止,这么好。这是改变:
package com.example.ui.widgets.item;
public class Table extends Composite{
private static TableUiBinder uiBinder = GWT.create(TableUiBinder.class);
interface TableUiBinder extends
UiBinder<HTMLPanel, Table> {
/* wrapper is HTMLPanel, instance holder is Table */
}
@UiField (provided = true)
CustomGrid table = new CustomGrid();
@UiField (provided = true)
Pager pager = new Pager();
public Table() {
initWidget(uiBinder.createAndBindUi(this));
pager.doSomething();
table.doSomthingElse();
}
class CustomGrid extends CellTable{
//create custom celltable
}
class Pager{
//Pagination code
}
}