Hmm, my feeling is that you're doing it the "right" way by checking the node state and not displaying a context menu if the node is "disabled". I don't think there is a "right" answer as to whether UI input should be enabled/disabled for a specific node if it is in the disabled state. You might, for instance, have a different context menu depending on whether a node is disabled (for example to enable it again in some cases) and so you would want the UI input to get through.
Of course, it might be possible to set a style on the tree as to whether or not disabled nodes pass through their input, but my feeling is that this is better left up to the user what to do..... My 2c... You could file a JIRA issue about this and we could think about it. Or you could implement it yourself and suggest it as a patch ;) Again, thanks for using Pivot. ~Roger Whitcomb -----Original Message----- From: Josh R [mailto:[email protected]] Sent: Wednesday, August 08, 2012 10:45 AM To: [email protected] Subject: How to block UI input to a disabled/busy TreeNode Hi, My tree will have a bunch of nodes and depending on their state, they would either be enabled/disabled/busy. I would like to block mouse input to such disabled/busy nodes. 1) Busy-Indicator: To implement busy-indicator functionality, I borrowed logic(thanks a bunch Edvin!) from this thread: http://apache-pivot-users.399431.n3.nabble.com/Animated-gifs-in-TreeView-node-icons-tt3074038.html#a3086067 The only changes I made were adding calls 'indicator.setActive(false)' in hideIndicator() and setActive(true) in showIndicator(). Other than that it was flawless. 2) Disabling-node: Implemented setDisabledNodeFilter() - thanks to other posts in the mailing list. my_tree.setDisabledNodeFilter(new Filter<TreeNode>() { @Override public boolean include(TreeNode node) { // get state of this Node. return (MyObj)node.getUserData().node_state; } } For now, I fire a nodeUpdated call when a user selects the parent-node of the busy/disabled node: for (TreeViewNodeListener l : my_tree.getTreeViewNodeListeners()) l.nodeUpdated(my_tree, TreePath,child_idx); So far so good. This works as expected with the exception that I can't block UI input to such disabled/busy nodes. I have added context-menu's to my node. So even when the node is disabled(via setDisabledNodeFilter), the configureContextMenu() gets called for such disabled/busy node. For now I'm checking the state of the node and then just returning from configureContextMenu() call. How can I block/prevent such UI inputs from reaching the node? Is there a handy setDisabled(node) function somewhere? If not can it be implemented? thanks
