我正在尝试在我的应用程序中使用SimplePager并将其显示设置为实现HasRows的自定义窗口小部件,但未显示SimplePager。
以下是UiBinder代码段:
<g:LayoutPanel ui:field="mainPanel" styleName="{style.panel}">
<!-- OTHER LAYERS CONTAINING DATA CONTAINERS (ROWS) -->
<g:layer left="0%" width="30%" top="0px" height="200px">
...
</g:layer>
...
<!-- LAYER CONTAINING SimplePager -->
<g:layer left="0px" right="0px" top="400px" height="50px">
<cv:SimplePager ui:field="pager" />
</g:layer>
</g:LayoutPanel>
这是自定义小部件类:
public class MyCustomWidget extends Composite implements HasRows {
private static final int NUM_ROWS = 3;
private static MyCustomWidgetUiBinder uiBinder = GWT.create(MyCustomWidgetUiBinder.class);
public interface MyCustomWidgetUiBinder extends UiBinder<Widget, MyCustomWidget> {
}
@UiField LayoutPanel mainPanel;
@UiField(provided = true) SimplePager pager;
public MyCustomWidget() {
// create and initialize SimplePager
SimplePager.Resources resources = GWT.create(SimplePager.Resources.class);
pager = new SimplePager(TextLocation.CENTER, resources, false, 0, true);
pager.setDisplay(this);
pager.setPageSize(NUM_ROWS);
initWidget(uiBinder.createAndBindUi(this));
}
...
// HasRows implementations, etc.
}
正在显示数据,寻呼机的hasNextPage()方法返回true,但不显示SimplePager。为什么呢?