< prev index next >

src/java.desktop/share/classes/sun/print/PrintJob2D.java

Print this page




 468                 p.setImageableArea(18.0, 18.0,
 469                                    p.getWidth()-36.0,
 470                                    p.getHeight()-36.0);
 471             } else {
 472                 p.setImageableArea(0.0,0.0,p.getWidth(),p.getHeight());
 473             }
 474 
 475             pageFormat.setPaper(p);
 476 
 477             OrientationRequested orient =
 478                (OrientationRequested)attributes.get(OrientationRequested.class);
 479             if (orient!= null &&
 480                 orient == OrientationRequested.REVERSE_LANDSCAPE) {
 481                 pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
 482             } else if (orient == OrientationRequested.LANDSCAPE) {
 483                 pageFormat.setOrientation(PageFormat.LANDSCAPE);
 484             } else {
 485                 pageFormat.setOrientation(PageFormat.PORTRAIT);
 486                 }
 487 






















 488             printerJob.setPrintable(this, pageFormat);
 489 
 490         }
 491 
 492         return proceedWithPrint;
 493     }
 494 
 495     private void updateAttributes() {
 496         Copies c = (Copies)attributes.get(Copies.class);
 497         jobAttributes.setCopies(c.getValue());
 498 
 499         SunPageSelection sel =
 500             (SunPageSelection)attributes.get(SunPageSelection.class);
 501         if (sel == SunPageSelection.RANGE) {
 502             jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
 503         } else if (sel == SunPageSelection.SELECTION) {
 504             jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
 505         } else {
 506             jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
 507         }




 468                 p.setImageableArea(18.0, 18.0,
 469                                    p.getWidth()-36.0,
 470                                    p.getHeight()-36.0);
 471             } else {
 472                 p.setImageableArea(0.0,0.0,p.getWidth(),p.getHeight());
 473             }
 474 
 475             pageFormat.setPaper(p);
 476 
 477             OrientationRequested orient =
 478                (OrientationRequested)attributes.get(OrientationRequested.class);
 479             if (orient!= null &&
 480                 orient == OrientationRequested.REVERSE_LANDSCAPE) {
 481                 pageFormat.setOrientation(PageFormat.REVERSE_LANDSCAPE);
 482             } else if (orient == OrientationRequested.LANDSCAPE) {
 483                 pageFormat.setOrientation(PageFormat.LANDSCAPE);
 484             } else {
 485                 pageFormat.setOrientation(PageFormat.PORTRAIT);
 486             }
 487 
 488             PageRanges pageRangesAttr
 489                     = (PageRanges) attributes.get(PageRanges.class);
 490             if (pageRangesAttr != null) {
 491                 // Get the PageRanges from print dialog.
 492                 int[][] range = pageRangesAttr.getMembers();
 493 
 494                 int prevFromPage = this.jobAttributes.getFromPage();
 495                 int prevToPage = this.jobAttributes.getToPage();
 496 
 497                 int currFromPage = range[0][0];
 498                 int currToPage = range[range.length - 1][1];
 499 
 500                 // if from < to update fromPage first followed by toPage
 501                 // else update toPage first followed by fromPage
 502                 if (currFromPage < prevToPage) {
 503                     this.jobAttributes.setFromPage(currFromPage);
 504                     this.jobAttributes.setToPage(currToPage);
 505                 } else {
 506                     this.jobAttributes.setToPage(currToPage);
 507                     this.jobAttributes.setFromPage(currFromPage);
 508                 }
 509             }
 510             printerJob.setPrintable(this, pageFormat);
 511 
 512         }
 513 
 514         return proceedWithPrint;
 515     }
 516 
 517     private void updateAttributes() {
 518         Copies c = (Copies)attributes.get(Copies.class);
 519         jobAttributes.setCopies(c.getValue());
 520 
 521         SunPageSelection sel =
 522             (SunPageSelection)attributes.get(SunPageSelection.class);
 523         if (sel == SunPageSelection.RANGE) {
 524             jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
 525         } else if (sel == SunPageSelection.SELECTION) {
 526             jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
 527         } else {
 528             jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
 529         }


< prev index next >