You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Andreas Pardeike <an...@pardeike.net> on 2004/10/15 08:22:10 UTC

Combining components and sharing info between them

Hi,

my menu system is a bit tricky and right now I have implemented it
using a single component that uses the writer to write our dhtml. Fine.

But I wonder if I could use separate components for the menu elements
that together would form the menu. That way, I preserve the visual
editing of the html template. The problem is that my components somehow
have to talk to each other. Why? Look at my menu dhtml (simplified 
here):

<li class="border"></li>

<li class="item">TOPIC A</li>

<li class="spacer"></li>

<li class="item">TOPIC B</li>

<li class="select1"></li>
<li class="item">TOPIC C</li>
<li class="select2"></li>

<li class="item">TOPIC D</li>

<li class="spacer"></li>

<li class="item">TOPIC E</li>

<li class="border"></li>

This will generate [ A ] [ B ] [*C*] [ D ] [ E ]    (C appears selected)
and the problem is that the spacer is difficult to insert. It depends on
the state of the component before *and* after it which would require a
look ahead.

To generalise my question, I would like to ask if it's possible to have
a number of components on a page that each share some information so if
a component renders it could read or update that information and thus
influence the following components. I have a similar situation elsewhere
where I want dhtml floats to be sharing the same width and thus each
component must know how much horizontal width is already covered.

Any help or pointers appreciated,
Andreas Pardeike


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


Re: Combining components and sharing info between them

Posted by Sandor Irlanda <ty...@tiger.tigra.hu>.
Hi!

Check the Body and the Form components!
They store the actual object during the rendering and any component
can get them through static methods of the Body and Form.

Sandor

On Fri, 15 Oct 2004, Andreas Pardeike wrote:

> To generalise my question, I would like to ask if it's possible to have
> a number of components on a page that each share some information so if
> a component renders it could read or update that information and thus
> influence the following components. I have a similar situation elsewhere
> where I want dhtml floats to be sharing the same width and thus each
> component must know how much horizontal width is already covered.

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