2 Image in root of tree in nattable

2019-09-11 11:50发布

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条回答
相关推荐>>
2楼-- · 2019-09-11 12:47

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.

查看更多
登录 后发表回答