[Common Navigator View] How to restore expanded nodes? [message #870494] |
Tue, 08 May 2012 12:25 |
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!!!
|
|
|
Powered by
FUDForum. Page generated in 0.02863 seconds