Search in sources :

Example 1 with JRViewerCask

use of eu.ggnet.dwoss.redtapext.ui.cao.jasper.JRViewerCask in project dwoss by gg-net.

the class RedTapeController method openDocument.

/**
 * This method is called if a chosen Document will be printed and/or sent per E-Mail.
 * This Method become a Document and will open a JasperViewer that contains also a Send Button for sending E-Mail
 * <p/>
 * @param document
 */
public void openDocument(Document document, boolean printAsReservation) {
    JasperPrint print = Dl.remote().lookup(DocumentSupporter.class).render(document, (printAsReservation ? DocumentViewType.RESERVATION : DocumentViewType.DEFAULT));
    JDialog d = new JDialog(parent(), "Dokument drucken/versenden");
    d.setSize(800, 1000);
    d.setModalityType(Dialog.ModalityType.DOCUMENT_MODAL);
    d.setLocationRelativeTo(view);
    d.getContentPane().setLayout(new BorderLayout());
    boolean canEmaild = model.getPurchaseCustomer().getEmail() != null && model.getPurchaseCustomer().getEmail().trim().isEmpty();
    JRViewerCask jrViewerCask = new JRViewerCask(print, document, (printAsReservation ? DocumentViewType.RESERVATION : DocumentViewType.DEFAULT), canEmaild);
    d.getContentPane().add(jrViewerCask, BorderLayout.CENTER);
    d.setVisible(true);
    if (jrViewerCask.isCorrectlyBriefed()) {
        reloadSelectionOnStateChange(Dl.remote().lookup(DocumentSupporter.class).briefed(document, Dl.local().lookup(Guardian.class).getUsername()));
    }
}
Also used : JRViewerCask(eu.ggnet.dwoss.redtapext.ui.cao.jasper.JRViewerCask) JasperPrint(net.sf.jasperreports.engine.JasperPrint) Guardian(eu.ggnet.saft.core.auth.Guardian)

Aggregations

JRViewerCask (eu.ggnet.dwoss.redtapext.ui.cao.jasper.JRViewerCask)1 Guardian (eu.ggnet.saft.core.auth.Guardian)1 JasperPrint (net.sf.jasperreports.engine.JasperPrint)1