Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Getting data out of TableTree(Viewer)
Getting data out of TableTree(Viewer) [message #445138] Tue, 26 October 2004 16:43
Rajeev Sudra is currently offline Rajeev SudraFriend
Messages: 30
Registered: July 2009
Member
Dear all,

I am created a (Extended)TableTreeViewer which is initialised in the usual manner. The TableTree is really just a single column tree (but I wanted the option of other column's in the future) and I need to get the Y coord of the rows to align some GEF edit parts against (to simulate an MS Project like editor).

Based on some event, I ask the editor to given me a map of my model objects as supplied by TableTreeViewer.setInput() (remember that it is a single column) to coords (y only). The way I do this is the iterate over the TableItems:

Map objectToYMapping = new HashMap();
int column = 0;
TableItem[] tableItems = getTableTreeViewer().getTableTree().getTable().getItems();
for (int i = 0; i < tableItems.length; i++) {
// FIXME RS how the heck do I get the associated data object from the table item???
Object data = ((ExtendedTableTreeViewer.ExtendedTableTreeItem)tableItems[i ].getData( "TableTreeItemID")).getData();
LOG.debug("putting key=" + data + " , val=" + tableItems[i].getBounds(column).y);
objectToYMapping.put(data, new Integer(tableItems[i].getBounds(column).y));
}

As you can see by comment, I don't really understand how to get the model object out of the TableItem? It seems that the hacky way that I am doing it must be wrong. In particular the use of "TableTreeItemID" which is a package-private constant in TableTree and the use of (ExtendedTableTreeViewer.ExtendedTableTreeItem) which again is implementation knowledge for the type of underlying control used.

Any help would be great as although the above works, I want to understand how to use the API correctly. TIA & Regards,
Raj
Previous Topic:CCombo truncates selection in Text Field
Next Topic:how to remove blinking cursor in StyledText widget
Goto Forum:
  


Current Time: Fri Apr 19 19:59:29 GMT 2024

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

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

Back to the top