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<achitral...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@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-unsubscr...@tapestry.apache.org
For additional commands, e-mail: users-h...@tapestry.apache.org


Reply via email to