Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 33837 invoked from network); 15 Nov 2007 10:33:03 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 15 Nov 2007 10:33:03 -0000 Received: (qmail 16918 invoked by uid 500); 15 Nov 2007 10:32:51 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 16901 invoked by uid 500); 15 Nov 2007 10:32:51 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 16890 invoked by uid 99); 15 Nov 2007 10:32:51 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2007 02:32:51 -0800 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Nov 2007 10:32:49 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DBD2E1A9832; Thu, 15 Nov 2007 02:32:42 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r595261 - /harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java Date: Thu, 15 Nov 2007 10:32:42 -0000 To: commits@harmony.apache.org From: apavlenko@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071115103242.DBD2E1A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: apavlenko Date: Thu Nov 15 02:32:42 2007 New Revision: 595261 URL: http://svn.apache.org/viewvc?rev=595261&view=rev Log: The method pageDialog(PrintRequestAttributeSet) should store all page settings in the user's attribute set passed to the method. Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java?rev=595261&r1=595260&r2=595261&view=diff ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java (original) +++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/java/awt/print/PrinterJobImpl.java Thu Nov 15 02:32:42 2007 @@ -66,6 +66,11 @@ @Override public PrintService getPrintService() { + if (printService == null) { + printService = PrintServiceLookup.lookupDefaultPrintService(); + printService = isServiceSupported(printService) ? printService + : null; + } return printService; } @@ -130,15 +135,8 @@ @Override public PageFormat pageDialog(final PrintRequestAttributeSet attributes) throws HeadlessException { - return pageDialog(attrsToFormat(attributes)); - } - - @Override - public PageFormat pageDialog(final PageFormat page) - throws HeadlessException { checkHeadless(); - final PrintRequestAttributeSet attributes = formatToAttrs(page); final Window wnd = KeyboardFocusManager .getCurrentKeyboardFocusManager().getActiveWindow(); final Window owner = (((wnd instanceof Dialog) || (wnd instanceof Frame)) @@ -156,8 +154,19 @@ owner.dispose(); } + if (attributes != dialog.getAttributes()) { + attributes.addAll(dialog.getAttributes()); + } + return (dialog.getResult() == ServiceUIDialog.APPROVE_PRINT) - ? attrsToFormat(attributes) : page; + ? attrsToFormat(attributes) : null; + } + + @Override + public PageFormat pageDialog(final PageFormat page) + throws HeadlessException { + final PageFormat format = pageDialog(formatToAttrs(page)); + return format != null ? format : page; } @Override @@ -174,8 +183,7 @@ } final PrintRequestAttributeSet attrs = mergeAttrs(attributes); - final PrintService service = printService != null ? printService - : PrintServiceLookup.lookupDefaultPrintService(); + final PrintService service = getPrintService(); if (service == null) { // Printer not found @@ -207,16 +215,12 @@ } final PrintRequestAttributeSet attrs = mergeAttrs(attributes); - final PrintService defaultPrintService = PrintServiceLookup - .lookupDefaultPrintService(); final Rectangle screen = GraphicsEnvironment .getLocalGraphicsEnvironment().getDefaultScreenDevice() .getDefaultConfiguration().getBounds(); final PrintService newService = ServiceUI.printDialog(null, screen.width / 3, screen.height / 3, - lookupPrintServices(), - (isServiceSupported(defaultPrintService) - ? defaultPrintService : null), + lookupPrintServices(), getPrintService(), DocFlavor.SERVICE_FORMATTED.PRINTABLE, attrs); if (newService != null) { @@ -271,9 +275,8 @@ } private static boolean isServiceSupported(final PrintService service) { - return (service != null) - && service - .isDocFlavorSupported(DocFlavor.SERVICE_FORMATTED.PAGEABLE); + return (service != null) && service.isDocFlavorSupported( + DocFlavor.SERVICE_FORMATTED.PAGEABLE); } private static PrintRequestAttributeSet formatToAttrs(