有一个错误阻止设置CellBrowser小部件的第一列宽度。还有一个解决办法,在这里解释。
http://groups.google.com/group/google-web-toolkit/browse_thread/thread/4fc39b5805833ea2
显然,它可以工作,但谁能解释如何子类CellBrowser使其工作呢?请给我看看密码。
发布于 2011-11-11 16:34:57
CellBrowser cellBrowser = new CellBrowser(model, null) {
// HACK: workaround for setDefaultColumnWidth not setting the width of the first column!
// SEE: https://groups.google.com/forum/?pli=1#!topic/google-web-toolkit/T8Ob...
public void setDefaultColumnWidth(int width) {
super.setDefaultColumnWidth(width);
SplitLayoutPanel splitPanel = (SplitLayoutPanel) getWidget();
splitPanel.setWidgetSize(splitPanel.getWidget(0), width);
}
};
cellBrowser.setDefaultColumnWidth(300); 问题:http://groups.google.com/group/google-web-toolkit/browse_thread/thread/4fc39b5805833ea2中链接到的线程的
如果您想要一个具有此修复的可重用类(这可能是个好主意),那么将这个匿名子类转换为一个常规子类非常简单:
public class FixedCellBrowser<T> extends CellBrowser<T> {
public FixedCellBrowser(TreeViewModel model, T root) {
super(model, root);
}
public void setDefaultColumnWidth(int width) {
super.setDefaultColumnWidth(width);
SplitLayoutPanel splitPanel = (SplitLayoutPanel) getWidget();
splitPanel.setWidgetSize(splitPanel.getWidget(0), width);
}
}(注意:我没有尝试编译这段代码。)
https://stackoverflow.com/questions/5160495
复制相似问题