You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Andreas Sewe <se...@cqse.eu> on 2018/07/24 10:52:19 UTC

How to show filtered views of single ExplorerManager's nodes?

Hi NetBeans users,

I need some advice on Explorer Views and Nodes, in particular
FilteredNode. Abstractly, my scenario is the following:

The data model is a simple collection of beans with with properties
"key", "left", and "right", represented as a tree of Nodes (dummy root
Node with BeanNode children). Now, in a TopComponent I want to show
*two* explorer views: The left-hand explorer view should be an
OutlineView showing all Nodes whose "left" property is non-null, the
right-hand explorer view should show all Nodes whose "right" property is
non-null.

In crude ASCII art:

  Key | Left           Key | Right
  a   | 1              a   | 3
  b   | 2              c   | 4

So, Nodes can show up in both views (like the one with key "a"), but
that need not be the case ("b", "c").

I imagine that my TopComponent will be an ExplorerManager.Provider for
the unfiltered view. Then the two OutlineViews will need
ExplorerManagers of their own, having some kind of FilteredNode as their
root node. Is this the correct way to think about this issue? And if so,
how would one publish the selected Node (which may or may not be shown
in both views, in the global lookup?

Any pointers are greatly appreciated. (And, no, merging the two views
into one is not an option; the actual UI is more complex than the above
sketch.)

Best wishes,

Andreas

-- 
Dr. Andreas Sewe | sewe@cqse.eu | +49 152 56342856
CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu
Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas


Re: How to show filtered views of single ExplorerManager's nodes?

Posted by Emilian Bold <em...@protonmail.ch.INVALID>.
It's a quite powerful module especially if you want to slice-and-dice the same underlining business model in multiple ways.

Sadly there is a bug related to refresh, I believe you have to refresh the whole view, it's not more fine-grained. My feeling is that Sun/Oracle could have put more work into the module but it was stopped when it was good enough (ie. not enough resources).

--emi

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On 24 July 2018 5:07 PM, Andreas Sewe <se...@cqse.eu> wrote:

> Emilian Bold wrote:
>
> > I don't believe FilterNode is designed for filtering that changes much the hierarchy structure.
> > I recommend reading about http://bits.netbeans.org/8.1/javadoc/org-netbeans-spi-viewmodel/org/netbeans/spi/viewmodel/package-summary.html#package_description which is more generic but should allow you easily to redesign the hierarchy.
>
> Thank for you for the pointer; I wasn't aware of
> org-netbeans-spi-viewmodel. (New to NetBeans and re-reading The
> NetBeans Platform for Beginners, which doesn't cover that API.)
>
> It looks to be more low-level, though. In particular, how would I react
> to changes in the underlying mode? Currently, my Node and ChildFactory
> subclasses listen to property changes of the model at the respective
> levels. Who would be responsible to listen to model changes using the
> view model API?
>
> Best wishes,
>
> Andreas
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Dr. Andreas Sewe | sewe@cqse.eu | +49 152 56342856
> CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu
> Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas
>
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
> For additional commands, e-mail: users-help@netbeans.apache.org
>
> For further information about the NetBeans mailing lists, visit:
> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: How to show filtered views of single ExplorerManager's nodes?

Posted by Andreas Sewe <se...@cqse.eu>.
Emilian Bold wrote:
> I don't believe FilterNode is designed for filtering that changes much the hierarchy structure.
> 
> I recommend reading about http://bits.netbeans.org/8.1/javadoc/org-netbeans-spi-viewmodel/org/netbeans/spi/viewmodel/package-summary.html#package_description which is more generic but should allow you easily to redesign the hierarchy.

Thank for you for the pointer; I wasn't aware of
org-netbeans-spi-viewmodel. (New to NetBeans and re-reading _The
NetBeans Platform for Beginners_, which doesn't cover that API.)

It looks to be more low-level, though. In particular, how would I react
to changes in the underlying mode? Currently, my Node and ChildFactory
subclasses listen to property changes of the model at the respective
levels. Who would be responsible to listen to model changes using the
view model API?

Best wishes,

Andreas

-- 
Dr. Andreas Sewe | sewe@cqse.eu | +49 152 56342856
CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu
Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


Re: How to show filtered views of single ExplorerManager's nodes?

Posted by Emilian Bold <em...@protonmail.ch.INVALID>.
I don't believe FilterNode is designed for filtering that changes much the hierarchy structure.

I recommend reading about http://bits.netbeans.org/8.1/javadoc/org-netbeans-spi-viewmodel/org/netbeans/spi/viewmodel/package-summary.html#package_description which is more generic but should allow you easily to redesign the hierarchy.

--emi

‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐
On 24 July 2018 1:52 PM, Andreas Sewe <se...@cqse.eu> wrote:

> Hi NetBeans users,
>
> I need some advice on Explorer Views and Nodes, in particular
> FilteredNode. Abstractly, my scenario is the following:
>
> The data model is a simple collection of beans with with properties
> "key", "left", and "right", represented as a tree of Nodes (dummy root
> Node with BeanNode children). Now, in a TopComponent I want to show
> two explorer views: The left-hand explorer view should be an
> OutlineView showing all Nodes whose "left" property is non-null, the
> right-hand explorer view should show all Nodes whose "right" property is
> non-null.
>
> In crude ASCII art:
>
> Key | Left Key | Right
> a | 1 a | 3
> b | 2 c | 4
>
> So, Nodes can show up in both views (like the one with key "a"), but
> that need not be the case ("b", "c").
>
> I imagine that my TopComponent will be an ExplorerManager.Provider for
> the unfiltered view. Then the two OutlineViews will need
> ExplorerManagers of their own, having some kind of FilteredNode as their
> root node. Is this the correct way to think about this issue? And if so,
> how would one publish the selected Node (which may or may not be shown
> in both views, in the global lookup?
>
> Any pointers are greatly appreciated. (And, no, merging the two views
> into one is not an option; the actual UI is more complex than the above
> sketch.)
>
> Best wishes,
>
> Andreas
>
> ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Dr. Andreas Sewe | sewe@cqse.eu | +49 152 56342856
> CQSE GmbH | Lichtenbergstrasse 8 | 85748 Garching | www.cqse.eu
> Amtsgericht Muenchen | HRB 177678 | GF: F. Deissenboeck, M. Feilkas


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists