1

嗨,我有一个具有可选 RootItems 的 CellTree。

我想更改选定 RootItem 的打开/关闭项目图像

是否可以更改图像动态?

我正在使用 GWT 2.5 thx :)

4

1 回答 1

3

这为时已晚,但我希望它能帮助其他谷歌人。首先,定义一个接口:

public interface TreeResources extends CellTree.Resources {

@ImageOptions(flipRtl = true)
@Source("cellTreeClosedArrow.gif")
ImageResource cellTreeClosedItem();

 /**
 * An image indicating an open branch.
 */
@ImageOptions(flipRtl = true)
@Source("cellTreeOpenArrow.gif")
ImageResource cellTreeOpenItem();
}

其中 cellTreeClosedArrow.gif 和 cellTreeOpenArrow.gif 是自定义图像的名称(路径)。接下来就是实例化上面的接口(在你看来):

CellTree.Resources treeResource = GWT.create(TreeResources.class); 

最后要做的是将 treeResource 与您的树相关联:示例:

tree = new CellTree(myTreeViewModel , null,treeResource);

我希望这是你需要的。

干杯

于 2013-01-11T13:10:09.363 回答