custom treenode smartgwt

你离开我真会死。 提交于 2019-12-11 11:47:45

问题


I am very inexperienced with SmartGWT and have the following issue:

I managed to make a Library of different kinds of documents in a tree.

For some documents I want to show three icons, which are representing links to other websites, further i want to show some description under them.

I tried to write my own CustomTreeNode, also I looked at setCellFormatter() and tried to overwrite it with no luck.

Can you give me some Tips and hints how to achieve the desired functionality and what I have to keep in mind?

Or are there some good tutorials or books on smartGWT besides the apidocs and the smartclient forum?

Any help greatly appreciated!!

This is what the tree should kinda look like:

[+]node1
[+]node2
[-]node3
    - documentEntry
[+]node4
[-]node5
    - custom documentEntry
       IMG IMG IMG
       description text

[+]node6

EDIT: Thanks to the comment I accomplished to code a tree with 3 different types of documents as leafs (.pdf, .txt and link to a web address). They all have a name and different icons and all have a different behavior, when clicked. But I've got still the issue, that I still have to implement another special leaf, which consists of 3 icons, representing 3 web-links and underneath a description text. The icons must be clickable and lead to three different web addresses.

2.Edit With trial and error I think i came a little step further. I created a class CustumTreeGrid wich overwrites the createRecordComponent method of Treegrid and draws a dynamic form over the tree leaf. Now I'm fillig this form with text 3 icons and links. Is this the right/a good way to solve my problem, or is there a better way to achief my desired functionality? I hope someone can help me


回答1:


Maybe there are other ways, but this is what I did:

I made my own class MyTreeGrid, which extends TreeGrid.

Then I set setShowRecordComponents(true) , setShowRecordComponentsByCell(true);

and I used the method: createRecordComponent(ListGridRecord record, Integer col) and overrode it, to draw a canvas for a leaf. The canvas contains 3 buttons and three images and a description text.



来源:https://stackoverflow.com/questions/13140842/custom-treenode-smartgwt

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