如何在GWT CellBrowser上设置第一列宽度
有一个错误阻止设置CellBrowser小部件的第一列宽度。这里还介绍了一种变通方法 显然它是有效的,但有人能解释一下如何对CellBrowser进行子类化以使其有效吗?请给我看一些代码如何在GWT CellBrowser上设置第一列宽度,gwt,cellbrowser,Gwt,Cellbrowser,有一个错误阻止设置CellBrowser小部件的第一列宽度。这里还介绍了一种变通方法 显然它是有效的,但有人能解释一下如何对CellBrowser进行子类化以使其有效吗?请给我看一些代码 CellBrowser cellBrowser = new CellBrowser(model, null) { // HACK: workaround for setDefaultColumnWidth not setting the width of the first colu
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);
- 从问题中链接到的线程:
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);
}
}
公共类FixedCellBrowser扩展了CellBrowser{
公共FixedCellBrowser(TreeView模型,T根){
超级(模型,根);
}
公共void setDefaultColumnWidth(int-width){
super.setDefaultColumnWidth(宽度);
SplitLayoutPanel splitPanel=(SplitLayoutPanel)getWidget();
splitPanel.setWidgetSize(splitPanel.getWidget(0),宽度);
}
}
(注意:我没有尝试编译此代码。)