PDF: missing pageEventClass

View: New views
3 Messages — Rating Filter:   Alert me  

PDF: missing pageEventClass

by Kenneth Christensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Maybe someone could explain me why the "pageEventClass" have been  
removed from the UIDocument and why is it not supported by Seam PDF  
anymore?

JBoss Seam 2.0.3:

     @Override
     public void encodeBegin(FacesContext context)
         throws IOException
     {
         super.encodeBegin(context);

         stream = new ByteArrayOutputStream();

         try {
             writer = createWriterForStream(stream);

             initMetaData(context);
             initPageEvent(writer);
             processHeaders();

             document.open();
         } catch (DocumentException e) {
             throw new RuntimeException(e);
         }
     }

     protected void initPageEvent(DocWriter writer) {
         if (pageEventClass != null && writer instanceof PdfWriter) {
             try {
                 PdfPageEvent event = (PdfPageEvent)  
Class.forName(pageEventClass).getConstructor().newInstance();
                 ((PdfWriter) writer).setPageEvent(event);
             } catch (Exception e) {
                 throw new RuntimeException(e);
             }
         }
     }

JBoss Seam 2.2.0:

    @Override
    public void encodeBegin(FacesContext context) throws IOException
    {
       super.encodeBegin(context);

       stream = new ByteArrayOutputStream();

       try
       {
          writer = createWriterForStream(stream);

          initMetaData(context);
          processHeaders();

          document.open();
       }
       catch (DocumentException e)
       {
          throw new RuntimeException(e);
       }
    }

Best regards

Kenneth Christensen

_______________________________________________
seam-dev mailing list
seam-dev@...
https://lists.jboss.org/mailman/listinfo/seam-dev

Re: PDF: missing pageEventClass

by Dan Allen (mojavelinux) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I can't find a reference to pageEventClass or the initPageEvent() method in any of the Seam source code that I have on my machine (which is most Seam versions). Are you sure this wasn't a patch you or your team was maintaining? If not, please point to the SVN URL of the UIDocument class when it had this method. Then we can get to the bottom of it. If it is a new feature -> JIRA.

-Dan

On Sat, Aug 22, 2009 at 4:47 PM, Kenneth Christensen <kec@...> wrote:
Maybe someone could explain me why the "pageEventClass" have been
removed from the UIDocument and why is it not supported by Seam PDF
anymore?

JBoss Seam 2.0.3:

    @Override
    public void encodeBegin(FacesContext context)
        throws IOException
    {
        super.encodeBegin(context);

        stream = new ByteArrayOutputStream();

        try {
            writer = createWriterForStream(stream);

            initMetaData(context);
            initPageEvent(writer);
            processHeaders();

            document.open();
        } catch (DocumentException e) {
            throw new RuntimeException(e);
        }
    }

    protected void initPageEvent(DocWriter writer) {
        if (pageEventClass != null && writer instanceof PdfWriter) {
            try {
                PdfPageEvent event = (PdfPageEvent)
Class.forName(pageEventClass).getConstructor().newInstance();
                ((PdfWriter) writer).setPageEvent(event);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

JBoss Seam 2.2.0:

   @Override
   public void encodeBegin(FacesContext context) throws IOException
   {
      super.encodeBegin(context);

      stream = new ByteArrayOutputStream();

      try
      {
         writer = createWriterForStream(stream);

         initMetaData(context);
         processHeaders();

         document.open();
      }
      catch (DocumentException e)
      {
         throw new RuntimeException(e);
      }
   }

Best regards

Kenneth Christensen

_______________________________________________
seam-dev mailing list
seam-dev@...
https://lists.jboss.org/mailman/listinfo/seam-dev



--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

_______________________________________________
seam-dev mailing list
seam-dev@...
https://lists.jboss.org/mailman/listinfo/seam-dev

Re: PDF: missing pageEventClass

by Kenneth Christensen :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Dan,

Thank you for the answer.

Sorry, my mistake.

Wow... my short (or long) term memory is a bit rusty :-)
Yes, it's one of our own Seam patch.

:-)

Best regards

Kenneth

On 28/08/2009, at 05.54, Dan Allen wrote:

I can't find a reference to pageEventClass or the initPageEvent() method in any of the Seam source code that I have on my machine (which is most Seam versions). Are you sure this wasn't a patch you or your team was maintaining? If not, please point to the SVN URL of the UIDocument class when it had this method. Then we can get to the bottom of it. If it is a new feature -> JIRA.

-Dan

On Sat, Aug 22, 2009 at 4:47 PM, Kenneth Christensen <kec@...> wrote:
Maybe someone could explain me why the "pageEventClass" have been
removed from the UIDocument and why is it not supported by Seam PDF
anymore?

JBoss Seam 2.0.3:

    @Override
    public void encodeBegin(FacesContext context)
        throws IOException
    {
        super.encodeBegin(context);

        stream = new ByteArrayOutputStream();

        try {
            writer = createWriterForStream(stream);

            initMetaData(context);
            initPageEvent(writer);
            processHeaders();

            document.open();
        } catch (DocumentException e) {
            throw new RuntimeException(e);
        }
    }

    protected void initPageEvent(DocWriter writer) {
        if (pageEventClass != null && writer instanceof PdfWriter) {
            try {
                PdfPageEvent event = (PdfPageEvent)
Class.forName(pageEventClass).getConstructor().newInstance();
                ((PdfWriter) writer).setPageEvent(event);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }
    }

JBoss Seam 2.2.0:

   @Override
   public void encodeBegin(FacesContext context) throws IOException
   {
      super.encodeBegin(context);

      stream = new ByteArrayOutputStream();

      try
      {
         writer = createWriterForStream(stream);

         initMetaData(context);
         processHeaders();

         document.open();
      }
      catch (DocumentException e)
      {
         throw new RuntimeException(e);
      }
   }

Best regards

Kenneth Christensen

_______________________________________________
seam-dev mailing list
seam-dev@...
https://lists.jboss.org/mailman/listinfo/seam-dev



--
Dan Allen
Senior Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://mojavelinux.com
http://mojavelinux.com/seaminaction
http://in.relation.to/Bloggers/Dan

Med venlig hilsen / Best regards
Mediator Systems ApS

Kenneth Christensen
Direktør / CEO

=======================================================
Email from Mediator Systems ApS

Mediator Systems ApS
Stenfeldtsvej 19
DK-3000 Helsingør
Denmark

Tel: +45 35 10 44 19
Mobile: +45 61 60 50 00

=======================================================
e-branchekoden: http://e-branchekoden.com
=======================================================






_______________________________________________
seam-dev mailing list
seam-dev@...
https://lists.jboss.org/mailman/listinfo/seam-dev