Package com.lightcrafts.ui.print

Examples of com.lightcrafts.ui.print.PrintLayoutModel$LengthUnit


        if (image instanceof PlanarImage) {
            image = ((PlanarImage) image).getAsBufferedImage();
        }
        // Restore the previous layout:
        PrintLayoutModel layout = doc.getPrintLayout();

        if (layout == null) {
            Dimension size = engine.getNaturalSize();
            // First try the most recent settings:
            if (LastPrintLayout != null) {
                layout = LastPrintLayout;
                layout.updateImageSize(size.width, size.height);
            }
            else {
                // Last resort is default settings:
                layout = new PrintLayoutModel(size.width, size.height);
            }
        }
        // Show the layout dialog:
        final PrintLayoutDialog dialog = new PrintLayoutDialog(
            (BufferedImage) image, layout, frame, LOCALE.get("PrintDialogTitle")
        );
        // Hook up behaviors for the dialog buttons:
        dialog.addCancelAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    dialog.dispose();
                    if (callback != null)
                        callback.done();
                }
            }
        );
        dialog.addDoneAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    dialog.dispose();
                    if (callback != null)
                        callback.done();
                    LastPrintLayout = layout;
                    savePrefs();
                }
            }
        );
        dialog.addPrintAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    printHeadless(frame, doc);
                    LastPrintLayout = layout;
                    savePrefs();
                }
            }
        );
        dialog.addPageSetupAction(
            new ActionListener() {
                public void actionPerformed(ActionEvent event) {
                    PrintLayoutModel layout = dialog.getPrintLayout();
                    doc.setPrintLayout(layout);
                    pageSetup(doc);
                    layout = doc.getPrintLayout();
                    PageFormat format = layout.getPageFormat();
                    dialog.setPageFormat(format);
                }
            }
        );
        PrinterLayer printer = Env.getPrinterLayer();
View Full Code Here


        }
        return options;
    }

    private static void pageSetup(Document doc) {
        PrintLayoutModel layout = doc.getPrintLayout();
        PageFormat format = layout.getPageFormat();
        format = Platform.getPlatform().getPrinterLayer().pageDialog(format);
        if (format != null)
            layout.setPageFormat(format);
    }
View Full Code Here

        // The Printable:
        final Engine engine = doc.getEngine();

        // The layout info:
        PrintLayoutModel layout = doc.getPrintLayout();

        // The Engine's layout sub-info:
        final PrintSettings settings = layout.getPrintSettings();

        PrinterLayer printer = Platform.getPlatform().getPrinterLayer();

        // The PageFormat:
        printer.setPageFormat(layout.getPageFormat());
        final PageFormat format = printer.getPageFormat();

        // Make up a name for the print job:
        String jobName;
        File file = doc.getFile();
View Full Code Here

            }
            // Restore default print settings:
            doc = restoreXmlPrefs(PrintTag);
            if (doc != null) {
                try {
                    LastPrintLayout = new PrintLayoutModel(0, 0);
                    LastPrintLayout.restore(doc.getRoot());
                }
                catch (XMLException e) {
                    System.err.println(
                        "Malformed print preferences: " + e.getMessage()
View Full Code Here

            save = SaveOptions.restore(saveNode);
        }
        if (root.hasChild(PrintTag)) {
            XmlNode printNode = root.getChild(PrintTag);
            Dimension size = engine.getNaturalSize();
            print = new PrintLayoutModel(size.width, size.height);
            print.restore(printNode);
        }
        if (root.hasChild(ExportTag)) {
            XmlNode exportNode = root.getChild(ExportTag);
            export = ImageExportOptions.read(exportNode);
View Full Code Here

TOP

Related Classes of com.lightcrafts.ui.print.PrintLayoutModel$LengthUnit

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.