2 Image in root of tree in nattable

﹥>﹥吖頭↗ 提交于 2019-12-12 04:59:12

问题


I have inserted one image in the tree body in one of my columns with

 new TreeImagePainter(true, GUIHelper.getImage("right"), GUIHelper.getImage("right_down"), image);

in class TreeConfiguration, but I need to add one more image beside root rows.

Moreover I need to dynamicly obtain this image from some other class, where data is already read . As it turns out i can't because either this class is null or it is called later than it should. Could you guild me how to do that.

Kind Regards


回答1:


The painting of the tree structure with node icons etc. is done by the IndentedTreeImagePainter. The TreeImagePainter is used as a decorator to the base painter for the content (typically text). If you need an additional icon you need to wrap the IndentedTreeImagePainter with another CellPainterDecorator. Or in case the additional icon should be on the right of the tree icon, maybe the base painter can already be a CellPainterDecorator that combines both, an ImagePainter and a TextPainter.

If you only want to show that icon on root nodes, you will need some more customization, probably with a custom painter.

Sorry, I don't really understand your requirement.



来源:https://stackoverflow.com/questions/38585691/2-image-in-root-of-tree-in-nattable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!