Are there any disadvantages of using the Nodes API for the presentation layer?

View: New views
2 Messages — Rating Filter:   Alert me  

Are there any disadvantages of using the Nodes API for the presentation layer?

by erisch :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi guys,

I've got some new questions as my current application evolves :)

What do you think: Are there any disadvantages if you build the
presentation layer of an application around the Nodes API? I've managed
to get the basics and underlying data model of my application to work
(more or less) seamingless with the NetBeans framework. And now I'm
about to create the presentation layer in all its colored glory :-) But
I have to make some decisions how to proceed with the development of
this application. In particular I'm interested in your thoughts about
the Nodes API and how it can be used to build the presentation layer of
an application.

My application operates on a data structure which is slightly complex
but a perfect hierarchical tree structure. From this perspective it
seems to be very reasonable to use the Nodes API to create the GUI for
my application. Moreover it would be very helpful to reuse things like
the properties or explorer view for parts of these data. One of my "main
views" should consist of a table view which should also provide
individual table cell renderes. Without a deeper understanding of the
NetBeans platform it's really hard to decide whether it makes sense to
build a hierarchy of nodes which represents my data model or to go for
plain Swing data models and use just Swing components to present the
data to the user.

What are your experiences with this? Is it worth the work to recreate a
data structure with "Nodes" and build the presentation layer on this? Or
is the Nodes API too limited if you want to use advanced features like
table cell renderers? From what I read it should be no big deal to use
FilterNodes for example if I have to represent different parts of the
data differently, but I'm not sure at all... Really sorry for asking all
these stupid questions, but at the beginning it really takes some effort
to get the "big picture" of what the NetBeans platform can do and can't
do ;)

Thanks for any comments!

Marco

Re: Are there any disadvantages of using the Nodes API for the presentation layer?

by tomwheel :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On 7/14/08, Marco Ehrentreich <erisch@...> wrote:
> I've got some new questions as my current application evolves :)
>
> What do you think: Are there any disadvantages if you build the presentation
> layer of an application around the Nodes API?

I am waiting for a long compile to complete, so I have time for a few
thoughts.  First, some people say that there are no stupid questions.
I humbly disagree but your question certainly is not one of them :-)

Next I want to point out one of the great things about the NetBeans
Platform is that you have this choice to make -- you can use the nodes
and explorer APIs if they will help you or you can do your own thing
if you prefer that.

Reasons I would choose the nodes/explorer views:

1. You are already using the nodes and/or explorer APIs elsewhere in
the app and want things to seem consistent to the user.

2.  You want to reuse existing infrastructure which makes use of Nodes
APIs, such as DataSystems API and project support.

3. You want to easily be able to show the same items in various views
(list, table, tree, etc.) without changing a lot of code.

4. Your data generally maps to hierarchical representation (nodes have
a parent and optionally some number of children).

5.  You want to use the property sheet, perhaps because you can
use/reuse property editors for things like fonts and colors that are
built into Java and/or the NB platform.

Reasons I would not chooce the nodes/explorer views:

1.  You want a great deal of specialized control over the UI.  The
views (tree, list, etc.) tend to be final classes or have final
methods that limit your ability to extend/change their behavior.  You
can create your own views -- I have done this before, but few people
know how and finding help with it will be hard.

2.  If you have *lots* of nodes (5,000 or more) you may run into
performance problems with certain views.  There are improvements
scheduled (perhaps already completed) for 6.5 that should further
improve this, but I would recommend doing a proof of concept first to
make sure the nodes/explorer APIs will perform well enough for you.  I
would also say that showing a user 5,000 nodes at a time is not great
UI design, so this is likely not much of an issue in practice.

--
Tom Wheeler
http://www.tomwheeler.com/