Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » [Common Navigator View] How to restore expanded nodes?
[Common Navigator View] How to restore expanded nodes? [message #870494] Tue, 08 May 2012 08:25
David BY Chan is currently offline David BY Chan
Messages: 40
Registered: July 2009
Member
Hi, I created a CNF viewer to display filtered resources which contains
structured information that can be display in a tree-like style.

I can use method "saveState" to save all expanded nodes as path string,
but I feel frustrated in the method "restoreState". You know, CNF
dynamically create children when people click expansion arrow, so only
these nodes on the first level were created when initializing. If I
restore view at that time, I can't find more nodes except the first
level ones, and I can't use method "setExpandedElements(Object[])" to
show last saved expanded states.

For example.

saveState()
{
Object[] expanded = batisViewer.getVisibleExpandedElements();
save each expanded nodes as string, here the string will be the Primary
Key of saved node.
}
restoreState()
{
String[] all_node_pk = .....
Object[] all_expanded_nodes;
for (String pk : all_node_pk)
{
Object view_node = queryNodeByPk(pk);
addToExpandedNode(view_node);
}
}

I can't do further when accoutered method "queryNodebyPK", because some
nodes that matched PK is not available now.

Or how to call CNF functions to create view node dynamically?

Thanks for your great help!!!
Previous Topic:OutOfMemoryError: Java heap space (vmargs does not work)
Next Topic:Problem adding a vertical ruler listener
Goto Forum:
  


Current Time: Wed Apr 16 18:51:14 EDT 2014

Powered by FUDForum. Page generated in 0.01558 seconds