Renderers are only called for painting and never get any input events (either mouse or keyboard), so that's why your mouse click listener never gets called.
The other problem is that TreeBranch and TreeNode are both "content" objects and not components, so they don't have an independent "enabled" state like a component does. Also, there is no requirement that objects in a TreeView have to be our TreeNode or TreeBranch objects. They basically could be any objects that have properties that the current tree node renderer can deal with. I'm thinking what you would need to do is check if the node under the mouse is present in the disabled filter list (if any) and just eat the mouse event in that case (if the new style for disabling input events for disabled nodes) is set. So, you would need to make a new style in TerraTreeViewSkin (with get/set methods). Then if the style value is set, then when you get an input event (mouse click), get the tree node in that position and check if there is a disabled filter set, check the node with the filter and if the node is included, then eat the mouse click.... Something like that. HTH, ~Roger -----Original Message----- From: Josh R [mailto:[email protected]] Sent: Wednesday, August 08, 2012 2:17 PM To: [email protected] Subject: Re: How to block UI input to a disabled/busy TreeNode On Wed, Aug 8, 2012 at 3:09 PM, Josh R <[email protected]> wrote: > On Wed, Aug 8, 2012 at 2:43 PM, Roger L. Whitcomb >> 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 ;) >> TerraTreeViewSkin::mouseClick calls " boolean consumed = super.mouseClick(component, button, x, y, count); " Is this something that would need to be changed? So may be when a new function " TreeBranch.setEnabled(false)" is called then the nodeInfo's attributes are set/reset and then check nodeInfo.isDisabled() before calling super.mouseClick() ? Anyways, for now in my "BusyCapableNodeRenderer extends TreeViewNodeRenderer " class, I'm doing this: public BusyCapableNodeRenderer(TreeView treeView) { this.treeView = treeView; this.getComponentMouseButtonListeners().add(new ComponentMouseButtonListener.Adapter () { public boolean mouseClick(Component component, Mouse.Button button, int x, int y, int count) { System.out.println("comp:"+component.toString()); // print and check if it's a tree... return false; } } ); } Is this correct? The mouseclick listener isn't getting called. If possible, I was thinking of blocking the mouse event here. thanks
