Search in sources :

Example 1 with PageList

use of com.servoy.j2db.printing.PageList in project servoy-client by Servoy.

the class SwingForm method printXML.

/**
 * @see com.servoy.j2db.IFormUIInternal#printXML(boolean)
 */
public String printXML(boolean printCurrentRecordOnly) {
    IApplication application = formController.getApplication();
    IFoundSetInternal fs = formController.getFoundSet();
    try {
        // $NON-NLS-1$
        application.blockGUI(Messages.getString("servoy.formPanel.status.xmlPrinting"));
        if (printCurrentRecordOnly) {
            fs = fs.copyCurrentRecordFoundSet();
        }
        FormPreviewPanel fpp = new FormPreviewPanel(application, formController, fs);
        fpp.process();
        StringWriter w = new StringWriter();
        ((PageList) fpp.getPageable()).toXML(w);
        fpp.destroy();
        return w.toString();
    } catch (Throwable ex) {
        // $NON-NLS-1$
        application.reportError(Messages.getString("servoy.formPanel.error.printDocument"), ex);
    } finally {
        application.releaseGUI();
    }
    return null;
}
Also used : IApplication(com.servoy.j2db.IApplication) StringWriter(java.io.StringWriter) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) FormPreviewPanel(com.servoy.j2db.printing.FormPreviewPanel) PageList(com.servoy.j2db.printing.PageList)

Example 2 with PageList

use of com.servoy.j2db.printing.PageList in project servoy-client by Servoy.

the class WebForm method printXML.

/**
 * @see com.servoy.j2db.IFormUIInternal#printXML(boolean)
 */
public String printXML(boolean printCurrentRecordOnly) {
    IApplication application = formController.getApplication();
    IFoundSetInternal fs = formController.getFoundSet();
    try {
        if (printCurrentRecordOnly) {
            fs = fs.copyCurrentRecordFoundSet();
        }
        FormPreviewPanel fpp = new FormPreviewPanel(application, formController, fs);
        // AWT stuff happens here, so execute it in the AWT Event Thread - else exceptions can occur
        // for example in JEditorPane while getting the preferred size & stuff
        processFppInAWTEventQueue(fpp, application);
        StringWriter w = new StringWriter();
        ((PageList) fpp.getPageable()).toXML(w);
        fpp.destroy();
        return w.toString();
    } catch (Throwable ex) {
        // $NON-NLS-1$
        application.reportError(application.getI18NMessage("servoy.formPanel.error.printDocument"), ex);
    }
    return null;
}
Also used : IApplication(com.servoy.j2db.IApplication) StringWriter(java.io.StringWriter) IFoundSetInternal(com.servoy.j2db.dataprocessing.IFoundSetInternal) FormPreviewPanel(com.servoy.j2db.printing.FormPreviewPanel) PageList(com.servoy.j2db.printing.PageList)

Aggregations

IApplication (com.servoy.j2db.IApplication)2 IFoundSetInternal (com.servoy.j2db.dataprocessing.IFoundSetInternal)2 FormPreviewPanel (com.servoy.j2db.printing.FormPreviewPanel)2 PageList (com.servoy.j2db.printing.PageList)2 StringWriter (java.io.StringWriter)2