You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Erik Hatcher <er...@ehatchersolutions.com> on 2004/04/06 22:32:40 UTC

contrib:Tree for a menu

Is anyone using the Tree component to build a menu system?  I'm 
embarking on some prototyping, and I've never touched the Tree 
component before.

My first quick test worked nicely, however I want to be able to hide 
the root node permanently - and just have it render its children and 
below.  In other words:

   - child1
     + grandchild1
     + grandchild2
   + child2

The root would merely be a placeholder for the top-level menu items.

How would I go about hiding the root?

Also, my menu component is going to use ICallback's that activate in 
the tree listener - anyone done that?  It seems like a really nice way 
to encapsulate a very flexible handler for menu clicks.

Thanks,
	Erik


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib:Tree for a menu

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 8, 2004, at 9:35 AM, Colin Sampaleanu wrote:
> You intend to store the tree used in this fashion in some sort of 
> border component?

Yes.  I already am.  The ITreeModel is a persistent border component 
property.





>
> Erik Hatcher wrote:
>
>> Follow-up: I've had a nice success with building a menu system in 
>> only a few lines of code using contrib:Tree, a tree state listener, 
>> and callbacks (and a custom ITreeNode).  It is a really elegant way 
>> to do it.
>>
>> The main issue is that I'd like to hide the root element.  Any 
>> pointers on how to do that?
>>
>> I wanted to turn off the +/- images, and encountered an oddity - I 
>> had to supply a nodeRenderFactory to contrib:Tree instead of leaving 
>> it null.  In TreeNodeView.isShowNodeImages, a null render factory 
>> implies showing images.  Why?
>>
>> My next step is to customize the links generated so that some can be 
>> external links that open in new windows.  Parameters to the standard 
>> links are beautifully handled with ICallbacks, so no need to 
>> customize that further.
>>
>>     Erik
>>
>>
>> On Apr 6, 2004, at 4:32 PM, Erik Hatcher wrote:
>>
>>> Is anyone using the Tree component to build a menu system?  I'm 
>>> embarking on some prototyping, and I've never touched the Tree 
>>> component before.
>>>
>>> My first quick test worked nicely, however I want to be able to hide 
>>> the root node permanently - and just have it render its children and 
>>> below.  In other words:
>>>
>>>   - child1
>>>     + grandchild1
>>>     + grandchild2
>>>   + child2
>>>
>>> The root would merely be a placeholder for the top-level menu items.
>>>
>>> How would I go about hiding the root?
>>>
>>> Also, my menu component is going to use ICallback's that activate in 
>>> the tree listener - anyone done that?  It seems like a really nice 
>>> way to encapsulate a very flexible handler for menu clicks.
>>>
>>> Thanks,
>>>     Erik
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib:Tree for a menu

Posted by Colin Sampaleanu <co...@exis.com>.
You intend to store the tree used in this fashion in some sort of border 
component?

Erik Hatcher wrote:

> Follow-up: I've had a nice success with building a menu system in only 
> a few lines of code using contrib:Tree, a tree state listener, and 
> callbacks (and a custom ITreeNode).  It is a really elegant way to do it.
>
> The main issue is that I'd like to hide the root element.  Any 
> pointers on how to do that?
>
> I wanted to turn off the +/- images, and encountered an oddity - I had 
> to supply a nodeRenderFactory to contrib:Tree instead of leaving it 
> null.  In TreeNodeView.isShowNodeImages, a null render factory implies 
> showing images.  Why?
>
> My next step is to customize the links generated so that some can be 
> external links that open in new windows.  Parameters to the standard 
> links are beautifully handled with ICallbacks, so no need to customize 
> that further.
>
>     Erik
>
>
> On Apr 6, 2004, at 4:32 PM, Erik Hatcher wrote:
>
>> Is anyone using the Tree component to build a menu system?  I'm 
>> embarking on some prototyping, and I've never touched the Tree 
>> component before.
>>
>> My first quick test worked nicely, however I want to be able to hide 
>> the root node permanently - and just have it render its children and 
>> below.  In other words:
>>
>>   - child1
>>     + grandchild1
>>     + grandchild2
>>   + child2
>>
>> The root would merely be a placeholder for the top-level menu items.
>>
>> How would I go about hiding the root?
>>
>> Also, my menu component is going to use ICallback's that activate in 
>> the tree listener - anyone done that?  It seems like a really nice 
>> way to encapsulate a very flexible handler for menu clicks.
>>
>> Thanks,
>>     Erik
>


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


Re: contrib:Tree for a menu

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Follow-up: I've had a nice success with building a menu system in only 
a few lines of code using contrib:Tree, a tree state listener, and 
callbacks (and a custom ITreeNode).  It is a really elegant way to do 
it.

The main issue is that I'd like to hide the root element.  Any pointers 
on how to do that?

I wanted to turn off the +/- images, and encountered an oddity - I had 
to supply a nodeRenderFactory to contrib:Tree instead of leaving it 
null.  In TreeNodeView.isShowNodeImages, a null render factory implies 
showing images.  Why?

My next step is to customize the links generated so that some can be 
external links that open in new windows.  Parameters to the standard 
links are beautifully handled with ICallbacks, so no need to customize 
that further.

	Erik


On Apr 6, 2004, at 4:32 PM, Erik Hatcher wrote:

> Is anyone using the Tree component to build a menu system?  I'm 
> embarking on some prototyping, and I've never touched the Tree 
> component before.
>
> My first quick test worked nicely, however I want to be able to hide 
> the root node permanently - and just have it render its children and 
> below.  In other words:
>
>   - child1
>     + grandchild1
>     + grandchild2
>   + child2
>
> The root would merely be a placeholder for the top-level menu items.
>
> How would I go about hiding the root?
>
> Also, my menu component is going to use ICallback's that activate in 
> the tree listener - anyone done that?  It seems like a really nice way 
> to encapsulate a very flexible handler for menu clicks.
>
> Thanks,
> 	Erik
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tapestry-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tapestry-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tapestry-user-help@jakarta.apache.org