dev@jsftemplating.java.net

Re: dynamicTreeNode

From: Ken Paulsen <Ken.Paulsen_at_Sun.COM>
Date: Fri, 27 Oct 2006 08:37:34 -0700

Hi Anissa,

Yes it is possible, the TreeAdaptor class is designed to do this.
getChildTreeNodeObjects(Object node) is implemented by you... the "node"
that is passed in is determined by you. You can use this "node" object
to determine what to do to create child Objects (nodes)... which will
eventually be passed back into this method, and to other methods.
getChildTreeNodeObjects() allows you to represent a complete Tree if
you'd like.

Every other method gets information about an individual TreeNode as
passes in your "Object" to help you obtain the information needed (i.e.
getFactoryOptions, getId, getFactoryClass, etc.).

Using this, 1 TreeAdaptor class can represent everything you are trying
to do.

Another approach is to divide the Tree definition into multiple
"DynamicTreeNodes" (what you suggested below). To do this, have the
getFactoryClass() method return a "DynamicTreeNodeFactory" type instead
of "TreeNodeFactory" (default). Then it will provide a way for you to
nest DynamicTreeNodeFactory instances... I would only do this if your
Tree/code is structured to handle this type of recursion better. IMO,
it is most likely easier to have 1 TreeAdaptor file handle it all
(although, depending on your situation, this may require very specific
code that knows about your data structure vs. a more dynamic / general
code that nested DynamicTreeNodes may be able to more easily provide).

Let me know if any of this isn't clear...

Thanks!

Ken

Anissa Lam wrote:
> Hi Ken,
> I am working on the EE tree, and there are cases where there will be 3
> or 4 levels of dynamicTreeNode. I am not sure if i can have
> dynamicTreeNode recursively.
>
> The deepest is
> -> Configurations (DN)
> -> server-config (DN)
> -> Security (DN)
> -> Realm (DN)
> realm-1
> realm-2
> -> default-config
> -> Security
>
> Is this possible now ? If not, is it easy for you to support this and
> how long that probably will take you.
>
> thanks
> Anissa.