The idea is that the "grouper" and the "leaf" implement the same
interface and perhaps share an abstract parent -- this is named
"component" in the GoF Pattern.  This is to avoid the following sort
of code when you are processing the tree:

if (x.isLeaf())
{
  // process leaf
}
else
{
  // process branch
}

You simple implement the appropriate behavior on the leaf/branch
appropriately.  Often the branch simply summarizes the branches/leaves
below it.


On 3/26/07, Matt Welch <[EMAIL PROTECTED]> wrote:
> On 3/23/07, Scott Swank <[EMAIL PROTECTED]> wrote:
> > In short, the Gang of Four's "Composite" pattern.
> >
> > http://en.wikipedia.org/wiki/Composite_pattern
> >
> >
>
> Really? I briefly took a look at that pattern specifically and I didn't see
> the fit, but I'll take a closer look. Thanks for the advice.
>
> James, I currently have all of the objects that might be parents of children
> of each other implement an abstract class that provides the the two
> attributes that are the same between them all. I'll take a look at the
> TreeNodes that you suggested.
>
>
>
>
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> _______________________________________________
> Wicket-user mailing list
> Wicket-user@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wicket-user
>
>


-- 
Scott Swank
reformed mathematician

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to