You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by "Giaccone, Anthony CTR DTIC-A" <AG...@dtic.mil> on 2009/01/16 21:59:18 UTC

Finding a block..


I'm working in Tapestry 4.1.6. I've been reading the docs for the
Block/RenderBlock and this second sentence has my focus. 

The Block may be on the same page as the RenderBlock or on another page
entirely.

Which is followed by an example where the block that is found is on the
same page (a contained block).


 return (Block) getContainer().getComponent(selectedId);   


What is not at all obvious is how you find a block on a another page.
Can someone give me a brief description of how you search blocks
contained on other pages, that you can be rendered on the current page. 

I recognize that there's some issues with the render listeners on the
page/component that contains the block that is not contained on my
current page..


My  test case, is like this:

BlockA (BlockA.html, BlockA.jwc, BlockPageA.java) is a component that
renders a simple table.  The Table is wrapped in a block with the title
blockA (notice my lowercase first letter for the block name).

BlockA (BlockB.html, BlockB.jwc, BlockPageB.java) is a component that
renders a paragraph of text.  


My Home Page, has the following markup...

	<span jwcid="@RenderBlock" block="ognl:thisBlock">
		<span style="background-color: grey;">Block Goes
Here</span>
	</span>

What I want to do is render either the Acomponent or Bcomponent, based
on the string that's returned from Home.java:getThisBlock()

Re: Finding a block..

Posted by Andreas Andreou <an...@di.uoa.gr>.
Try
requestCycle.getPage("otherPage").getComponent("compId")


On Fri, Jan 16, 2009 at 10:59 PM, Giaccone, Anthony CTR DTIC-A
<AG...@dtic.mil> wrote:
>
>
> I'm working in Tapestry 4.1.6. I've been reading the docs for the
> Block/RenderBlock and this second sentence has my focus.
>
> The Block may be on the same page as the RenderBlock or on another page
> entirely.
>
> Which is followed by an example where the block that is found is on the
> same page (a contained block).
>
>
>  return (Block) getContainer().getComponent(selectedId);
>
>
> What is not at all obvious is how you find a block on a another page.
> Can someone give me a brief description of how you search blocks
> contained on other pages, that you can be rendered on the current page.
>
> I recognize that there's some issues with the render listeners on the
> page/component that contains the block that is not contained on my
> current page..
>
>
> My  test case, is like this:
>
> BlockA (BlockA.html, BlockA.jwc, BlockPageA.java) is a component that
> renders a simple table.  The Table is wrapped in a block with the title
> blockA (notice my lowercase first letter for the block name).
>
> BlockA (BlockB.html, BlockB.jwc, BlockPageB.java) is a component that
> renders a paragraph of text.
>
>
> My Home Page, has the following markup...
>
>        <span jwcid="@RenderBlock" block="ognl:thisBlock">
>                <span style="background-color: grey;">Block Goes
> Here</span>
>        </span>
>
> What I want to do is render either the Acomponent or Bcomponent, based
> on the string that's returned from Home.java:getThisBlock()
>



-- 
Andreas Andreou - andyhot@apache.org - http://blog.andyhot.gr
Tapestry / Tacos developer
Open Source / JEE Consulting

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