9 Replies Latest reply on Dec 14, 2009 11:58 AM by Daniel Posch

    <rich:paint2D> - data too large?

    Daniel Posch Newbie

      Hi everyone,

      I am facing a problem with <rich:paint2D> (using Seam and Hibernate), which might be caused by a big data object.

      What I need to do is to visualize a database table, so I basically pass an entity bean (let's call it DataBean) to my paint()-method. DataBean has a member variable, which is a list usually consisting of up to 100 elements.

      // data bean
      public class DataBean {
       // ...
       List<ChildElements> childElements; // usually has up to 100 elements
       // ...
      }


      In order to test the 2D painting I have copied some simple code into a DataBeanPainter bean. Notice that the example code is completely unrelated to my DataBean:
      // DataBeanPainter.paint()
      public void paint(Graphics2D g, Object obj) {
       g.setBackground(Color.WHITE);
       g.setColor(Color.BLACK);
       g.drawRect(0, 0, 100, 100);
       g.drawLine(5, 5, 100 - 5, 100 - 5);
       g.drawChars(new String("Ajax4JSF").toCharArray(), 0, 8, 40, 15);
       g.drawChars(new String("mediaOutput").toCharArray(), 0, 11, 5, 45);
      }


      That's how I use the <rich:paint2D>-tag:
      <rich:paint2D data="#{dataBeanHome.instance}"
       paint="#{dataBeanPainter.paint}" width="100" height="100"
       format="gif" cacheable="false"/>


      The result is: nothing... RichFaces does generate an < img >-tag, but my browser cannot show this image. However, if I pass a DataBean with an empty list or no data at all, the < img >-tag contains different code and everything works perfectly fine. (Somehow this appears very strange to me, because the image should always be the same, regardless of the data...)

      I'm afraid the problem is caused by the "big" list in my DataBean. The RichFaces documentation says to avaid big objects, but is 100 elements really too big? Can anyone give me more information on this issue or has any other suggestions?