[Logo] Enterprise Client Community
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
Help on using pdfrenderer within new workpage  XML
Forum Index -> Development
Author Message
cvieira

Power User

Joined: 08/07/2010 21:46:40
Messages: 59
Offline

Hi,

I'm using pdfrenderer component with no problems, except in one case. I have a button with an actionevent that opens a new workpage where it should be rendered a pdf on a pdfrenderer component. The problem is that i'm trying to set pdfPrescription variable when the action is done, but it cannot get the pdf rendered. Here it is the action method:

Code:
 public class Report extends WorkpageDispatchedBean implements Serializable {
     
     Dispatcher m_dispatcher;
 [...]
     public void onGeneratePrescriptionReport(ActionEvent ae) {
         try {
             m_pdfPrescription = createPdfPrescription(((PatientVisitWorkpage) getWorkpage()).getPatientVisit());
             logger.info(this.m_pdfPrescription);
         } catch (DocumentException ex) {
             Logger.getLogger(PatientVisitMgmt.class.getName()).log(Level.SEVERE, null, ex);
         } catch (IOException ex) {
             Logger.getLogger(PatientVisitMgmt.class.getName()).log(Level.SEVERE, null, ex);
         }
         
         IWorkpageDispatcher wpd = (IWorkpageDispatcher) getOwningDispatcher().getTopOwner();
         IWorkpageContainer wpc = wpd.getWorkpageContainer();
         IWorkpage wp = new Workpage(wpd,
                 "/clinics/report_prescription.jsp",
                 "",
                 "Prescription Report", null, true);
         wpc.addWorkpage(wp);
     }
 [...]
 }
 


Note: If set m_pdfPrescription on constructor, the pdf is correctly rendered.


The jsp looks like this:

Code:
 <!-- ========== CONTENT BEGIN ========== -->
 <f:view>
 <h:form>
 <f:subview id="clinics_report_prescriptiong_sv">
 <t:rowbodypane id="g_1" padding="20" rowdistance="5" >
 <t:rowbodypane id="g_2" >
 <t:row id="g_3" >
 <t:pdfrenderer id="g_4" height="100%" pdf="#{d.report.pdfPrescription}" rendered="true" triggerprint="#{d.report.onTriggerPrint}" width="100%" />
 </t:row>
 </t:rowbodypane>
 </t:rowbodypane>
 <t:pageaddons id="g_pa"/>
 </f:subview>
 </h:form>
 </f:view>
 <!-- ========== CONTENT END ========== -->
 


========

What am i mising here?

Thanks!

Regards,

--
Carlos Vieira
cvieira

Power User

Joined: 08/07/2010 21:46:40
Messages: 59
Offline

Hi again,

I've found this on logs, and it looks like the cause for this is not working.

Can you help me understand the logs content for this case? Here they are:

Code:
 2012:02:28 22:41:39:256 | 55     | WARNING  | No property value available for: net.tinylabs.prescryb.workplace.clinics.Report@4ea6a6/pdfPrescription, Error is: javax.el.ELException: Error reading 'pdfPrescription' on type net.tinylabs.prescryb.workplace.clinics.Report
 2012:02:28 22:41:39:257 | 55     | WARNING  |                                  probable complete expression is: #{d.d_8.report.pdfPrescription} (this epxression is only correct in a single-user server scenario)
 


Thanks!

Regards,

--
Carlos Vieira
CaptainCasa

Power User
[Avatar]

Joined: 21/11/2007 12:23:06
Messages: 5521
Offline

What type is pdfPrescription?
Is it a hex-String? I believe the creation of the hex-String is throwing some error? Can you debug into the getter?

Regards, Björn

Björn Müller, CaptainCasa GmbH
cvieira

Power User

Joined: 08/07/2010 21:46:40
Messages: 59
Offline

Hi Bjorn,

pdfDescription contains an hex-String. It's correct, i've debugged it... basically is the result of

Code:
ValueManager.encodeHexString(FileManager.readFile(tempFile, true));


If i use the result of this (obtained after debugging) directly on the jsp component, it renders Ok.

Also, if i use a modal popup instead of a new workpage this works well... like this:

Code:
     public void onGeneratePrescriptionReport(ActionEvent ae) {
         try {
             m_pdf = createPdfPrescription(((PatientVisitWorkpage) getWorkpage()).getPatientVisit());
             logger.info(m_pdf);
         } catch (DocumentException ex) {
             Logger.getLogger(Report.class.getName()).log(Level.SEVERE, null, ex);
         } catch (IOException ex) {
             Logger.getLogger(Report.class.getName()).log(Level.SEVERE, null, ex);
         }
 
         /*IWorkpageDispatcher wpd = (IWorkpageDispatcher) getOwningDispatcher().getTopOwner();
         IWorkpageContainer wpc = wpd.getWorkpageContainer();
         IWorkpage wp = new Workpage(wpd,
         "/clinics/report_prescription.jsp",
         "",
         "Prescription Report", null, true);
         wpc.addWorkpage(wp);*/
 
 
         final ModalPopup dlg = getOwningDispatcher().createModalPopup();
         ModalPopup.IModalPopupListener mpl = new DefaultModalPopupListener(dlg) {
 
             @Override
             public void reactOnPopupClosedByUser() {
                 dlg.close();
             }
         };
         dlg.open("/clinics/report.jsp", "Prescription Report", 518, 735, mpl);
         dlg.maximize(true);
     }
 


If instead of opening a modal popup, i use the new workpage approach (commented code), it simply fails... it seems that the getter method does not return what i wanted to return... maybe something related with object instance? I don't think so because it's working fine with modal popup...

Thanks!

Regards,

--
Carlos Vieira
 
Forum Index -> Development
Go to:   
Powered by JForum 2.1.6 © JForum Team