Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Lots of problems migrating TableTreeViewer to TreeViewer (Eclipse 3.1)
Lots of problems migrating TableTreeViewer to TreeViewer (Eclipse 3.1) [message #460734] Tue, 06 September 2005 12:21 Go to next message
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Dear all,

I'll apologise in advanced for the length of this email! However, it will
be useful for others as well to document peoples thoughts in one places as
part migrating from TableTreeViewer to TreeViewer.

I have been trying to migrate an editor that uses a TableTreeViewer with
two columns to use the TreeViewer with Tree/TreeColumn. I have some concerns
regarding differences in behaviour. I will bugzilla them unless people can
explain/correct my usage.

QUESTION 1: When I have an ITreeViewerListener registered with the listener,
during the listeners invocation I expect that event to have already happened
(so by collapsing a node in the tree, during the event handling the TreeItem
should be collapsed and AbstractTreeViewer.getExpandedState(Object) should
return false). This worked as expected for TableTreeViewer but not for TreeViewer.

QUESTION: When opening the TreeViewer on my data, I am presented with the
following structure

AAA
BBB
CCC
DDD
EEE
FFF

I need to get the y coords of the TreeItems to align some gef editparts in
a viewer that sits to the right of the TreeViewer. I have to iterate (depth-first)
over all the TreeItems (and their children) collecting them in a list. Nodes
AAA through to CCC all have negative y values ( as reported by treeItem.getBounds().y
). Actually, calling tree.getTopItem() returns the item for DDD. Shouldn't
AAA have a y value of zero? I have disabled the header BTW.

QUESTION 2: Is there any way of switching off / disabling rendering of the
tree lines (not the table lines) that connect parent to children as with
TableTree?

QUESTION 3: In my two column TreeViewer, I explicitly have to create TreeColumns
to show the second column as of the the TreeViewers construction. Is there
not a JFace level way of allowing this to happen automatically? I would have
thought the content provider should have been a union (in functionality)
of ITreeContentProvider and some TableContentProvider.

QUESTION 4: When I set an image into the second column of my Tree, an empty
space for all of the first column items is inserted (where its image would
have been so there is a gap between the +/- and the text for all items).
How can I use the image on the second column and get rid of the space created
in the first one?

QUESTION 5: Given two columns an a TreeViewer, if I set an image on an item
in the first column and then set the image to null, the image appears and
disappears as expected. For items on the second column, setting will display
the image but setting to null has no effect. Currently, I am setting an empty
image of the same size as my feedback image.

QUESTION 6: Is there any JFace level way of providing mouseover feedback
for TreeItems (in a TreeColumn). I am currently using an swt level listener
to set an image when the mouse is over an item.

QUESTION 7: Also, I am using the same listener code from Q6 to detect a single
click and display up a context menu (regardless of right or left click),
I want to hook the the menu code into a cell editor/modifier instead so that
when a click is made on the image in the second column, this creates the
menu rather than swt level code.

QUESTION 8: How do I increase the height of rows in the TreeVeiwer? In aTableTreeViewer,
I would set a dummy image on the first TableTreeItem and then dispose it.
Additionally, I don't want the gap to remain between the +/- controls and
the node text if it involves using a similar approach (of using an image
to size the row height).

Thanks and sorry for the length!
Raj
Re: Lots of problems migrating TableTreeViewer to TreeViewer (Eclipse 3.1) [message #460736 is a reply to message #460734] Tue, 06 September 2005 12:33 Go to previous message
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Indentation and question numbering was wrong, here is a revised version!!!
------

Dear all,

I'll apologise in advanced for the length of this email! However, it
will be useful for others as well to document peoples thoughts in one
places as part migrating from TableTreeViewer to TreeViewer.

I have been trying to migrate an editor that uses a TableTreeViewer
with two columns to use the TreeViewer with Tree/TreeColumn. I have
some concerns regarding differences in behaviour. I will bugzilla them
unless people can explain/correct my usage.

QUESTION 1: When I have an ITreeViewerListener registered with the
listener, during the listeners invocation I expect that event to have
already happened (so by collapsing a node in the tree, during the
event handling the TreeItem should be collapsed and
AbstractTreeViewer.getExpandedState(Object) should return false). This
worked as expected for TableTreeViewer but not for TreeViewer.

QUESTION 2: When opening the TreeViewer on my data, I am presented with
the following structure

[-] AAA
>>> BBB
>>> CCC
[-] DDD
>>> EEE
>>> FFF

">" = spaces...

I need to get the y coords of the TreeItems to align some gef
editparts in a viewer that sits to the right of the TreeViewer. I have
to iterate (depth-first) over all the TreeItems (and their children)
collecting them in a list. Nodes AAA through to CCC all have negative
y values ( as reported by treeItem.getBounds().y ). Actually, calling
tree.getTopItem() returns the item for DDD. Shouldn't AAA have a y
value of zero? I have disabled the header BTW.

QUESTION 3: Is there any way of switching off / disabling rendering of
the tree lines (not the table lines) that connect parent to children
as with TableTree?

QUESTION 4: In my two column TreeViewer, I explicitly have to create
TreeColumns to show the second column as of the the TreeViewers
construction. Is there not a JFace level way of allowing this to
happen automatically? I would have thought the content provider should
have been a union (in functionality) of ITreeContentProvider and some
TableContentProvider.

QUESTION 5: When I set an image into the second column of my Tree, an
empty space for all of the first column items is inserted (where its
image would have been so there is a gap between the +/- and the text
for all items). How can I use the image on the second column and get
rid of the space created in the first one?

QUESTION 6: Given two columns an a TreeViewer, if I set an image on an
item in the first column and then set the image to null, the image
appears and disappears as expected. For items on the second column,
setting will display the image but setting to null has no effect.
Currently, I am setting an empty image of the same size as my feedback
image.

QUESTION 7: Is there any JFace level way of providing mouseover
feedback for TreeItems (in a TreeColumn). I am currently using an swt
level listener to set an image when the mouse is over an item.

QUESTION 8: Also, I am using the same listener code from Q7 to detect
a single click and display up a context menu (regardless of right or
left click), I want to hook the the menu code into a cell
editor/modifier instead so that when a click is made on the image in
the second column, this creates the menu rather than swt level code.

QUESTION 9: How do I increase the height of rows in the TreeVeiwer? In
aTableTreeViewer, I would set a dummy image on the first TableTreeItem
and then dispose it. Additionally, I don't want the gap to remain
between the +/- controls and the node text if it involves using a
similar approach (of using an image to size the row height).

Thanks and sorry for the length!
Raj
Previous Topic:"Hello World" Post !
Next Topic:Image of complete window content
Goto Forum:
  


Current Time: Mon Aug 19 09:44:16 GMT 2019

Powered by FUDForum. Page generated in 0.02067 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top