You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by chitraa <ac...@gmail.com> on 2009/09/01 13:28:33 UTC

Re: Multiple images

Tapestry 4.

Thank you.



Howard Lewis Ship wrote:
> 
> Tapestry 4 or Tapestry 5?
> 
> On Sun, Aug 30, 2009 at 6:59 PM, chitraa<ac...@gmail.com> wrote:
>>
>> Hi,
>>
>> Did you manage to find a solution to this? I am also trying to render
>> multiple chart images into the same page. However, the service renders
>> the
>> same image (the last one).
>>
>> Thanks.
>>
>>
>>
>> Olexandr Yuzikov wrote:
>>>
>>> Hi, everyone.
>>>
>>>
>>>
>>> I have a problem to represent a couple of images stored in database. The
>>> page has a property of type List with beans that keeps images in byte
>>> arrays. I need to render those images in the iterator on the same page.
>>> It
>>> seems may be like in tapestry "Workbench" tutorial with a dynamic chart
>>> but
>>> with more than one image. I did like in tutorial but service always
>>> renders
>>> the same image (generally the last in the list). Does anybody have any
>>> experience to render more than one image on the page?
>>>
>>>
>>>
>>> Thanks for answering.
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/Multiple-images-tp387585p25217486.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
> 
> 
> 
> -- 
> Howard M. Lewis Ship
> 
> Creator of Apache Tapestry
> 
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Multiple-images-tp387585p25238644.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


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


Re: Multiple images

Posted by Nathan Beemer <na...@gmail.com>.
In a nutshell, the way I did it was to implement IAsset for each  
dynamic chart which then gets fetched by component id in the  
IEngineService and asked to render itself to the given WebResponse.

Or put another way...

I have 2 dynamic chart images In my Foo.html page definition:

<img class="statGraph" width="235" height="135" jwcid="@Image"  
image="ognl:clientStats" title="" alt="" />
<img class="statGraph" width="235" height="135" jwcid="@Image"  
image="ognl:sessionStats" title="" alt="" />
	
I've defined

public abstract class ImageAsset implements IAsset
{
	public void renderImage(OutputStream os) throws IOException ;
}

In Foo.java page class:

public ImageAsset getClientStats() { return new ClientStatsAsset(); }
public ImageAsset getSessionStats() { return new SessionStatsAsset(); }


Finally, in my ImageService (implements IEngineService):

	public void service(IRequestCycle cycle) throws IOException
	{
		String pageName = cycle.getParameter(ServiceConstants.PAGE);
		String idPath = cycle.getParameter(ServiceConstants.COMPONENT);
		String option = cycle.getParameter(ImageAsset.OPTION);
		IPage page = cycle.getPage(pageName);
		IComponent component = page.getNestedComponent(idPath);
		WebResponse response = cycle.getInfrastructure().getResponse();

		try {
			((ImageProvider) component).generateImage(response, new Object[] 
{option});
		}
		catch (ClassCastException ex) {
			exceptionReporter.reportRequestException("Fatal Error 0xa8", ex);
		}
		catch (Throwable ex) {
			exceptionReporter.reportRequestException("Fatal Error 0x32", ex);
		}
	}







On Sep 1, 2009, at 6:28 AM, chitraa wrote:

>
> Tapestry 4.
>
> Thank you.
>
>
>
> Howard Lewis Ship wrote:
>>
>> Tapestry 4 or Tapestry 5?
>>
>> On Sun, Aug 30, 2009 at 6:59 PM, chitraa<ac...@gmail.com>  
>> wrote:
>>>
>>> Hi,
>>>
>>> Did you manage to find a solution to this? I am also trying to  
>>> render
>>> multiple chart images into the same page. However, the service  
>>> renders
>>> the
>>> same image (the last one).
>>>
>>> Thanks.
>>>
>>>
>>>
>>> Olexandr Yuzikov wrote:
>>>>
>>>> Hi, everyone.
>>>>
>>>>
>>>>
>>>> I have a problem to represent a couple of images stored in  
>>>> database. The
>>>> page has a property of type List with beans that keeps images in  
>>>> byte
>>>> arrays. I need to render those images in the iterator on the same  
>>>> page.
>>>> It
>>>> seems may be like in tapestry "Workbench" tutorial with a dynamic  
>>>> chart
>>>> but
>>>> with more than one image. I did like in tutorial but service always
>>>> renders
>>>> the same image (generally the last in the list). Does anybody  
>>>> have any
>>>> experience to render more than one image on the page?
>>>>
>>>>
>>>>
>>>> Thanks for answering.
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Multiple-images-tp387585p25217486.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> -- 
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>>
>> The source for Tapestry training, mentoring and support. Contact me  
>> to
>> learn how I can get you up and productive in Tapestry fast!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/Multiple-images-tp387585p25238644.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>


Re: Multiple images

Posted by Howard Lewis Ship <hl...@gmail.com>.
Generally, it is necessary to include some kind of id in the URL (as
context) that you can get back when handling the request.  Using a
persistent page property is insufficient, since it will be "left" in
the value of the final rendering of the <img> tag, which is kind of
what you are seeing.

This is much easier in Tapestry 5, but the same rules apply: if a
component renders multiple URLs you should include in the URL that
specific id of the object associated with the rendering.

On Tue, Sep 1, 2009 at 4:43 AM, Andreas Andreou<an...@di.uoa.gr> wrote:
> check the urls to the images... is it possible they're all the same?
>
> On Tue, Sep 1, 2009 at 2:28 PM, chitraa<ac...@gmail.com> wrote:
>>
>> Tapestry 4.
>>
>> Thank you.
>>
>>
>>
>> Howard Lewis Ship wrote:
>>>
>>> Tapestry 4 or Tapestry 5?
>>>
>>> On Sun, Aug 30, 2009 at 6:59 PM, chitraa<ac...@gmail.com> wrote:
>>>>
>>>> Hi,
>>>>
>>>> Did you manage to find a solution to this? I am also trying to render
>>>> multiple chart images into the same page. However, the service renders
>>>> the
>>>> same image (the last one).
>>>>
>>>> Thanks.
>>>>
>>>>
>>>>
>>>> Olexandr Yuzikov wrote:
>>>>>
>>>>> Hi, everyone.
>>>>>
>>>>>
>>>>>
>>>>> I have a problem to represent a couple of images stored in database. The
>>>>> page has a property of type List with beans that keeps images in byte
>>>>> arrays. I need to render those images in the iterator on the same page.
>>>>> It
>>>>> seems may be like in tapestry "Workbench" tutorial with a dynamic chart
>>>>> but
>>>>> with more than one image. I did like in tutorial but service always
>>>>> renders
>>>>> the same image (generally the last in the list). Does anybody have any
>>>>> experience to render more than one image on the page?
>>>>>
>>>>>
>>>>>
>>>>> Thanks for answering.
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/Multiple-images-tp387585p25217486.html
>>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Howard M. Lewis Ship
>>>
>>> Creator of Apache Tapestry
>>>
>>> The source for Tapestry training, mentoring and support. Contact me to
>>> learn how I can get you up and productive in Tapestry fast!
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context: http://www.nabble.com/Multiple-images-tp387585p25238644.html
>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>
>
>
> --
> 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
>
>



-- 
Howard M. Lewis Ship

Creator of Apache Tapestry

The source for Tapestry training, mentoring and support. Contact me to
learn how I can get you up and productive in Tapestry fast!

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


Re: Multiple images

Posted by Andreas Andreou <an...@di.uoa.gr>.
check the urls to the images... is it possible they're all the same?

On Tue, Sep 1, 2009 at 2:28 PM, chitraa<ac...@gmail.com> wrote:
>
> Tapestry 4.
>
> Thank you.
>
>
>
> Howard Lewis Ship wrote:
>>
>> Tapestry 4 or Tapestry 5?
>>
>> On Sun, Aug 30, 2009 at 6:59 PM, chitraa<ac...@gmail.com> wrote:
>>>
>>> Hi,
>>>
>>> Did you manage to find a solution to this? I am also trying to render
>>> multiple chart images into the same page. However, the service renders
>>> the
>>> same image (the last one).
>>>
>>> Thanks.
>>>
>>>
>>>
>>> Olexandr Yuzikov wrote:
>>>>
>>>> Hi, everyone.
>>>>
>>>>
>>>>
>>>> I have a problem to represent a couple of images stored in database. The
>>>> page has a property of type List with beans that keeps images in byte
>>>> arrays. I need to render those images in the iterator on the same page.
>>>> It
>>>> seems may be like in tapestry "Workbench" tutorial with a dynamic chart
>>>> but
>>>> with more than one image. I did like in tutorial but service always
>>>> renders
>>>> the same image (generally the last in the list). Does anybody have any
>>>> experience to render more than one image on the page?
>>>>
>>>>
>>>>
>>>> Thanks for answering.
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/Multiple-images-tp387585p25217486.html
>>> Sent from the Tapestry - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>>> For additional commands, e-mail: users-help@tapestry.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Howard M. Lewis Ship
>>
>> Creator of Apache Tapestry
>>
>> The source for Tapestry training, mentoring and support. Contact me to
>> learn how I can get you up and productive in Tapestry fast!
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
>> For additional commands, e-mail: users-help@tapestry.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/Multiple-images-tp387585p25238644.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>



-- 
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