You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Sean Schofield <se...@gmail.com> on 2005/04/27 18:04:15 UTC

[tree2] Who is using the isLeaf method? Should we deprecate this method?

Sureshbabu pointed out something interesting in an earlier post.  The
TreeBacker class has the boolean values for leaf reversed.  So all of
the branch nodes have setLeaf(true) and visa versa.

I will fix this in CVS now, but there is another interesting point
here.  It doesn't matter to any of the simple examples!  This is
because the getType method is used to determine the facet (and hence
what type of icon to use).  The navigation icons (the plus/minus
icons) are determined by the child count.

IMO the getChildCount method and the getType methods could cover
pretty much every scenario that you would need isLeaf for.  I have
opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
method (and eventually eliminate it.)  Please add comments there if
you have feelings on this one way or another.

sean

Re: [tree2] Who is using the isLeaf method? Should we deprecate this method?

Posted by Rob Decker <ro...@objectsource.org>.
Someone might use it in a facet to determine whether that facet is a branch
or a leaf if they had a layout with facets that could be either a branch or
a leaf.

<f:facet name="multi">
    <h:graphicImage value="t.leaf ? 'folder.gif' : 'doc.gif'>
</f:facet>

If anything the tree component should be using isLeaf to determine whether
or not its a leaf.  What if I want a leaf that has children but I don't want
to display it as a branch because I have a different viewer for those
special types of children. I might want to know the child count and get the
children but I want the tree to display a leaf node.

I don't see that the type of facet determines what type of icon to use. The
type of facet just determines where the tree will lay the node out. What's
in the node (facet) is entirely up to the user of the component.




----- Original Message ----- 
From: "Sean Schofield" <se...@gmail.com>
To: "MyFaces Discussion" <us...@myfaces.apache.org>
Sent: Wednesday, April 27, 2005 12:04 PM
Subject: [tree2] Who is using the isLeaf method? Should we deprecate this
method?


Sureshbabu pointed out something interesting in an earlier post.  The
TreeBacker class has the boolean values for leaf reversed.  So all of
the branch nodes have setLeaf(true) and visa versa.

I will fix this in CVS now, but there is another interesting point
here.  It doesn't matter to any of the simple examples!  This is
because the getType method is used to determine the facet (and hence
what type of icon to use).  The navigation icons (the plus/minus
icons) are determined by the child count.

IMO the getChildCount method and the getType methods could cover
pretty much every scenario that you would need isLeaf for.  I have
opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
method (and eventually eliminate it.)  Please add comments there if
you have feelings on this one way or another.

sean


Re: [tree2] Who is using the isLeaf method? Should we deprecate this method?

Posted by Sean Schofield <se...@gmail.com>.
Actually, never mind that idea.  Its possible to have a branch with no
children so that won't work.  We'll just leave it alone.

On 4/27/05, Sean Schofield <se...@gmail.com> wrote:
> That's an interesting point.  So you would be in favor of leaving it
> alone?  If so, I still think we could change TreeNodeBase so that it
> could check its children count to get the answer.  You could always
> override this method in your own TreeNode implementation.
> 
> What do you think about that?
> 
> sean
> 
> On 4/27/05, Sean Radford <sr...@bladesystems.co.uk> wrote:
> > Jon Travis wrote:
> >
> > > Seems like in the very dynamic case, where you are only
> > > generating part of the tree at a time, that isLeaf might
> > > be useful.  You might not know how many children you
> > > have without doing an expensive operation, but you might
> > > know that you are not a leaf.
> > >
> > And I will be doing it as such in a new app in a few weeks time...
> >
> > > isLeaf() isn't even used.  Making it the exclusive way
> > > to determine if there is an expansion button beside it
> > > seems like a better API.
> > >
> > > -- Jon
> > >
> > >
> > > On Apr 27, 2005, at 9:04 AM, Sean Schofield wrote:
> > >
> > >> Sureshbabu pointed out something interesting in an earlier post.  The
> > >> TreeBacker class has the boolean values for leaf reversed.  So all of
> > >> the branch nodes have setLeaf(true) and visa versa.
> > >>
> > >> I will fix this in CVS now, but there is another interesting point
> > >> here.  It doesn't matter to any of the simple examples!  This is
> > >> because the getType method is used to determine the facet (and hence
> > >> what type of icon to use).  The navigation icons (the plus/minus
> > >> icons) are determined by the child count.
> > >>
> > >> IMO the getChildCount method and the getType methods could cover
> > >> pretty much every scenario that you would need isLeaf for.  I have
> > >> opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
> > >> method (and eventually eliminate it.)  Please add comments there if
> > >> you have feelings on this one way or another.
> > >>
> > >> sean
> > >>
> > >>
> > >
> > >
> > >
> >
> > --
> > Dr. Sean Radford, MBBS, MSc
> > sradford@bladesystems.co.uk
> > http://bladesys.demon.co.uk/
> >
> >
>

Re: [tree2] Who is using the isLeaf method? Should we deprecate this method?

Posted by Sean Schofield <se...@gmail.com>.
That's an interesting point.  So you would be in favor of leaving it
alone?  If so, I still think we could change TreeNodeBase so that it
could check its children count to get the answer.  You could always
override this method in your own TreeNode implementation.

What do you think about that?

sean

On 4/27/05, Sean Radford <sr...@bladesystems.co.uk> wrote:
> Jon Travis wrote:
> 
> > Seems like in the very dynamic case, where you are only
> > generating part of the tree at a time, that isLeaf might
> > be useful.  You might not know how many children you
> > have without doing an expensive operation, but you might
> > know that you are not a leaf.
> >
> And I will be doing it as such in a new app in a few weeks time...
> 
> > isLeaf() isn't even used.  Making it the exclusive way
> > to determine if there is an expansion button beside it
> > seems like a better API.
> >
> > -- Jon
> >
> >
> > On Apr 27, 2005, at 9:04 AM, Sean Schofield wrote:
> >
> >> Sureshbabu pointed out something interesting in an earlier post.  The
> >> TreeBacker class has the boolean values for leaf reversed.  So all of
> >> the branch nodes have setLeaf(true) and visa versa.
> >>
> >> I will fix this in CVS now, but there is another interesting point
> >> here.  It doesn't matter to any of the simple examples!  This is
> >> because the getType method is used to determine the facet (and hence
> >> what type of icon to use).  The navigation icons (the plus/minus
> >> icons) are determined by the child count.
> >>
> >> IMO the getChildCount method and the getType methods could cover
> >> pretty much every scenario that you would need isLeaf for.  I have
> >> opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
> >> method (and eventually eliminate it.)  Please add comments there if
> >> you have feelings on this one way or another.
> >>
> >> sean
> >>
> >>
> >
> >
> >
> 
> --
> Dr. Sean Radford, MBBS, MSc
> sradford@bladesystems.co.uk
> http://bladesys.demon.co.uk/
> 
>

Re: [tree2] Who is using the isLeaf method? Should we deprecate this method?

Posted by Sean Radford <sr...@bladesystems.co.uk>.
Jon Travis wrote:

> Seems like in the very dynamic case, where you are only
> generating part of the tree at a time, that isLeaf might
> be useful.  You might not know how many children you
> have without doing an expensive operation, but you might
> know that you are not a leaf.
>
And I will be doing it as such in a new app in a few weeks time...

> isLeaf() isn't even used.  Making it the exclusive way
> to determine if there is an expansion button beside it
> seems like a better API.
>
> -- Jon
>
>
> On Apr 27, 2005, at 9:04 AM, Sean Schofield wrote:
>
>> Sureshbabu pointed out something interesting in an earlier post.  The
>> TreeBacker class has the boolean values for leaf reversed.  So all of
>> the branch nodes have setLeaf(true) and visa versa.
>>
>> I will fix this in CVS now, but there is another interesting point
>> here.  It doesn't matter to any of the simple examples!  This is
>> because the getType method is used to determine the facet (and hence
>> what type of icon to use).  The navigation icons (the plus/minus
>> icons) are determined by the child count.
>>
>> IMO the getChildCount method and the getType methods could cover
>> pretty much every scenario that you would need isLeaf for.  I have
>> opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
>> method (and eventually eliminate it.)  Please add comments there if
>> you have feelings on this one way or another.
>>
>> sean
>>
>>
>
>
>


-- 
Dr. Sean Radford, MBBS, MSc
sradford@bladesystems.co.uk
http://bladesys.demon.co.uk/ 


Re: [tree2] Who is using the isLeaf method? Should we deprecate this method?

Posted by Jon Travis <jt...@p00p.org>.
Seems like in the very dynamic case, where you are only
generating part of the tree at a time, that isLeaf might
be useful.  You might not know how many children you
have without doing an expensive operation, but you might
know that you are not a leaf.

isLeaf() isn't even used.  Making it the exclusive way
to determine if there is an expansion button beside it
seems like a better API.

-- Jon


On Apr 27, 2005, at 9:04 AM, Sean Schofield wrote:

> Sureshbabu pointed out something interesting in an earlier post.  The
> TreeBacker class has the boolean values for leaf reversed.  So all of
> the branch nodes have setLeaf(true) and visa versa.
>
> I will fix this in CVS now, but there is another interesting point
> here.  It doesn't matter to any of the simple examples!  This is
> because the getType method is used to determine the facet (and hence
> what type of icon to use).  The navigation icons (the plus/minus
> icons) are determined by the child count.
>
> IMO the getChildCount method and the getType methods could cover
> pretty much every scenario that you would need isLeaf for.  I have
> opened a JIRA issue (MYFACES-215) to suggest we deprecate the is Leaf
> method (and eventually eliminate it.)  Please add comments there if
> you have feelings on this one way or another.
>
> sean
>
>