Geertjan's Blog

  • October 24, 2009

Filtering an Explorer View via CheckableNode

Geertjan Wielenga
Product Manager
This took me a really long time to figure out, but now it's working—and here it is as a sample:


The scenario is where you have a list in one explorer view and you'd like to use checkboxes to add/remove selected items from that explorer view to/from another explorer view in a different TopComponent:

I spent most of the time trying to use FilterNode.Children, but that's probably not even the purpose of that class. I was trying to use it because I wanted one explorer view to provide a FilterNode on top of a Node from a different explorer view. It didn't work because both views ended up with the same nodes, i.e., the CreateNodes in the FilterNode.Children didn't enable me to create different nodes for the different views. Ultimately I gave up on that approach and simply added/removed items to/from a list that the second children object used to create new nodes in the lower window.

This is how the source structure looks. You can see the two sets of classes for the windows selected. The other classes are "Movie" (which is the domain object), "RootNode" (which includes an action for adding new items to the top window), "CheckNode" (which implements CheckableNode and is added to the Lookup of the node in the top window), and "Utils" (which provides the lists and ChangeSupport that is shared between the other classes).

So not, as intended, a sample of FilterNode.Children. But still very useful, I believe.

Join the discussion

Comments ( 2 )
  • Andrei I. Sunday, October 25, 2009

    OT: do you know any WIKI plug-in for Netbeans?

    I mean a plug-in that would allow to edit in one of the wiki syntax (I know, there are many - but any would do it), and have live preview? Or any other sort of "smart" assistance from the IDE: WIKI syntax seems to be used everywhere on the web, but editing it in small browser textareas is just a pain - especially for bigger amount of text.

    I found plug-ins for various(and obscure) languages, but none for WIKI :(.

    Thanks in advance.

  • Eduardo Costa Tuesday, September 28, 2010

    Excellent example. Is there a way to remove the root node from the outline view?

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.