Java Code Examples for javax.print.attribute.standard.PageRanges#getMembers()

The following examples show how to use javax.print.attribute.standard.PageRanges#getMembers() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 2
Source File: CPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 3
Source File: CPrinterJob.java    From dragonwell8_jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 4
Source File: CPrinterJob.java    From jdk8u-jdk with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 5
Source File: CPrinterJob.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    // See if this has an NSPrintInfo in it.
    NSPrintInfo nsPrintInfo = (NSPrintInfo)attributes.get(NSPrintInfo.class);
    if (nsPrintInfo != null) {
        fNSPrintInfo = nsPrintInfo.getValue();
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 6
Source File: CPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException {
    super.setAttributes(attributes);

    if (attributes == null) {
        return;
    }

    PageRanges pageRangesAttr =  (PageRanges)attributes.get(PageRanges.class);
    if (isSupportedValue(pageRangesAttr, attributes)) {
        SunPageSelection rangeSelect = (SunPageSelection)attributes.get(SunPageSelection.class);
        // If rangeSelect is not null, we are using AWT's print dialog that has
        // All, Selection, and Range radio buttons
        if (rangeSelect == null || rangeSelect == SunPageSelection.RANGE) {
            int[][] range = pageRangesAttr.getMembers();
            // setPageRange will set firstPage and lastPage as called in getFirstPage
            // and getLastPage
            setPageRange(range[0][0] - 1, range[0][1] - 1);
        }
    }
}
 
Example 7
Source File: RasterPrinterJob.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
protected final int getFromPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[0][0];
        }
    }
    return getMinPageAttrib();
}
 
Example 8
Source File: RasterPrinterJob.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 9
Source File: PrintPanel.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
private void createPageRangeFields(PrintRequestAttributeSet set) {
    PrintService service = getService();
    if (service.isAttributeCategorySupported(PageRanges.class)) {
        ButtonGroup group      = new ButtonGroup();
        int         start      = 1;
        int         end        = 9999;
        PageRanges  pageRanges = (PageRanges) set.get(PageRanges.class);
        if (pageRanges != null) {
            int[][] ranges = pageRanges.getMembers();
            if (ranges.length > 0 && ranges[0].length > 1) {
                start = ranges[0][0];
                end = ranges[0][1];
            } else {
                pageRanges = null;
            }
        }
        JLabel label = new JLabel(I18n.Text("Print Range"), SwingConstants.CENTER);
        add(label, new PrecisionLayoutData().setEndHorizontalAlignment());
        JPanel wrapper = new JPanel(new PrecisionLayout().setMargins(0).setColumns(5));
        mPageRangeAll = new JRadioButton(I18n.Text("All"), pageRanges == null);
        wrapper.add(mPageRangeAll);
        mPageRangeSome = new JRadioButton(I18n.Text("Pages"), pageRanges != null);
        wrapper.add(mPageRangeSome);
        mPageRangeStart = createPageRangeField(start, wrapper);
        wrapper.add(new JLabel(I18n.Text("to"), SwingConstants.CENTER));
        mPageRangeEnd = createPageRangeField(end, wrapper);
        add(wrapper);
        group.add(mPageRangeAll);
        group.add(mPageRangeSome);
        adjustPageRanges();
        mPageRangeAll.addActionListener(this);
        mPageRangeSome.addActionListener(this);
    } else {
        mPageRangeAll = null;
        mPageRangeSome = null;
        mPageRangeStart = null;
        mPageRangeEnd = null;
    }
}
 
Example 10
Source File: RasterPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 11
Source File: RasterPrinterJob.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 12
Source File: RasterPrinterJob.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
protected final int getFromPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[0][0];
        }
    }
    return getMinPageAttrib();
}
 
Example 13
Source File: RasterPrinterJob.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 14
Source File: RasterPrinterJob.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 15
Source File: RasterPrinterJob.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 16
Source File: RasterPrinterJob.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
protected final int getToPageAttrib() {
    if (attributes != null) {
        PageRanges pageRangesAttr =
            (PageRanges)attributes.get(PageRanges.class);
        if (pageRangesAttr != null) {
            int[][] range = pageRangesAttr.getMembers();
            return range[range.length-1][1];
        }
    }
    return getMaxPageAttrib();
}
 
Example 17
Source File: PrintJob2D.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void updateAttributes() {
    Copies c = (Copies)attributes.get(Copies.class);
    jobAttributes.setCopies(c.getValue());

    SunPageSelection sel =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (sel == SunPageSelection.RANGE) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
    } else if (sel == SunPageSelection.SELECTION) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
    } else {
        jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
    }

    Destination dest = (Destination)attributes.get(Destination.class);
    if (dest != null) {
        jobAttributes.setDestination(DestinationType.FILE);
        jobAttributes.setFileName(dest.getURI().getPath());
    } else {
        jobAttributes.setDestination(DestinationType.PRINTER);
    }

    PrintService serv = printerJob.getPrintService();
    if (serv != null) {
        jobAttributes.setPrinter(serv.getName());
    }

    PageRanges range = (PageRanges)attributes.get(PageRanges.class);
    int[][] members = range.getMembers();
    jobAttributes.setPageRanges(members);

    SheetCollate collation =
        (SheetCollate)attributes.get(SheetCollate.class);
    if (collation == SheetCollate.COLLATED) {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES);
    } else {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    }

    Sides sides = (Sides)attributes.get(Sides.class);
    if (sides == Sides.TWO_SIDED_LONG_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_LONG_EDGE);
    } else if (sides == Sides.TWO_SIDED_SHORT_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_SHORT_EDGE);
    } else {
        jobAttributes.setSides(SidesType.ONE_SIDED);
    }

    // PageAttributes

    Chromaticity color =
        (Chromaticity)attributes.get(Chromaticity.class);
    if (color == Chromaticity.COLOR) {
        pageAttributes.setColor(ColorType.COLOR);
    } else {
        pageAttributes.setColor(ColorType.MONOCHROME);
    }

    OrientationRequested orient =
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orient == OrientationRequested.LANDSCAPE) {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.LANDSCAPE);
    } else {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.PORTRAIT);
    }

    PrintQuality qual = (PrintQuality)attributes.get(PrintQuality.class);
    if (qual == PrintQuality.DRAFT) {
        pageAttributes.setPrintQuality(PrintQualityType.DRAFT);
    } else if (qual == PrintQuality.HIGH) {
        pageAttributes.setPrintQuality(PrintQualityType.HIGH);
    } else { // NORMAL
        pageAttributes.setPrintQuality(PrintQualityType.NORMAL);
    }

    Media msn = (Media)attributes.get(Media.class);
    if (msn != null && msn instanceof MediaSizeName) {
        MediaType mType = unMapMedia((MediaSizeName)msn);

        if (mType != null) {
            pageAttributes.setMedia(mType);
        }
    }
    debugPrintAttributes(false, false);
}
 
Example 18
Source File: PrintJob2D.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void updateAttributes() {
    Copies c = (Copies)attributes.get(Copies.class);
    jobAttributes.setCopies(c.getValue());

    SunPageSelection sel =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (sel == SunPageSelection.RANGE) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
    } else if (sel == SunPageSelection.SELECTION) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
    } else {
        jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
    }

    Destination dest = (Destination)attributes.get(Destination.class);
    if (dest != null) {
        jobAttributes.setDestination(DestinationType.FILE);
        jobAttributes.setFileName(dest.getURI().getPath());
    } else {
        jobAttributes.setDestination(DestinationType.PRINTER);
    }

    PrintService serv = printerJob.getPrintService();
    if (serv != null) {
        jobAttributes.setPrinter(serv.getName());
    }

    PageRanges range = (PageRanges)attributes.get(PageRanges.class);
    int[][] members = range.getMembers();
    jobAttributes.setPageRanges(members);

    SheetCollate collation =
        (SheetCollate)attributes.get(SheetCollate.class);
    if (collation == SheetCollate.COLLATED) {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES);
    } else {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    }

    Sides sides = (Sides)attributes.get(Sides.class);
    if (sides == Sides.TWO_SIDED_LONG_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_LONG_EDGE);
    } else if (sides == Sides.TWO_SIDED_SHORT_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_SHORT_EDGE);
    } else {
        jobAttributes.setSides(SidesType.ONE_SIDED);
    }

    // PageAttributes

    Chromaticity color =
        (Chromaticity)attributes.get(Chromaticity.class);
    if (color == Chromaticity.COLOR) {
        pageAttributes.setColor(ColorType.COLOR);
    } else {
        pageAttributes.setColor(ColorType.MONOCHROME);
    }

    OrientationRequested orient =
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orient == OrientationRequested.LANDSCAPE) {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.LANDSCAPE);
    } else {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.PORTRAIT);
    }

    PrintQuality qual = (PrintQuality)attributes.get(PrintQuality.class);
    if (qual == PrintQuality.DRAFT) {
        pageAttributes.setPrintQuality(PrintQualityType.DRAFT);
    } else if (qual == PrintQuality.HIGH) {
        pageAttributes.setPrintQuality(PrintQualityType.HIGH);
    } else { // NORMAL
        pageAttributes.setPrintQuality(PrintQualityType.NORMAL);
    }

    Media msn = (Media)attributes.get(Media.class);
    if (msn != null && msn instanceof MediaSizeName) {
        MediaType mType = unMapMedia((MediaSizeName)msn);

        if (mType != null) {
            pageAttributes.setMedia(mType);
        }
    }
    debugPrintAttributes(false, false);
}
 
Example 19
Source File: PrintJob2D.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private void updateAttributes() {
    Copies c = (Copies)attributes.get(Copies.class);
    jobAttributes.setCopies(c.getValue());

    SunPageSelection sel =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (sel == SunPageSelection.RANGE) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
    } else if (sel == SunPageSelection.SELECTION) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
    } else {
        jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
    }

    Destination dest = (Destination)attributes.get(Destination.class);
    if (dest != null) {
        jobAttributes.setDestination(DestinationType.FILE);
        jobAttributes.setFileName(dest.getURI().getPath());
    } else {
        jobAttributes.setDestination(DestinationType.PRINTER);
    }

    PrintService serv = printerJob.getPrintService();
    if (serv != null) {
        jobAttributes.setPrinter(serv.getName());
    }

    PageRanges range = (PageRanges)attributes.get(PageRanges.class);
    int[][] members = range.getMembers();
    jobAttributes.setPageRanges(members);

    SheetCollate collation =
        (SheetCollate)attributes.get(SheetCollate.class);
    if (collation == SheetCollate.COLLATED) {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES);
    } else {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    }

    Sides sides = (Sides)attributes.get(Sides.class);
    if (sides == Sides.TWO_SIDED_LONG_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_LONG_EDGE);
    } else if (sides == Sides.TWO_SIDED_SHORT_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_SHORT_EDGE);
    } else {
        jobAttributes.setSides(SidesType.ONE_SIDED);
    }

    // PageAttributes

    Chromaticity color =
        (Chromaticity)attributes.get(Chromaticity.class);
    if (color == Chromaticity.COLOR) {
        pageAttributes.setColor(ColorType.COLOR);
    } else {
        pageAttributes.setColor(ColorType.MONOCHROME);
    }

    OrientationRequested orient =
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orient == OrientationRequested.LANDSCAPE) {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.LANDSCAPE);
    } else {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.PORTRAIT);
    }

    PrintQuality qual = (PrintQuality)attributes.get(PrintQuality.class);
    if (qual == PrintQuality.DRAFT) {
        pageAttributes.setPrintQuality(PrintQualityType.DRAFT);
    } else if (qual == PrintQuality.HIGH) {
        pageAttributes.setPrintQuality(PrintQualityType.HIGH);
    } else { // NORMAL
        pageAttributes.setPrintQuality(PrintQualityType.NORMAL);
    }

    Media msn = (Media)attributes.get(Media.class);
    if (msn != null && msn instanceof MediaSizeName) {
        MediaType mType = unMapMedia((MediaSizeName)msn);

        if (mType != null) {
            pageAttributes.setMedia(mType);
        }
    }
    debugPrintAttributes(false, false);
}
 
Example 20
Source File: PrintJob2D.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void updateAttributes() {
    Copies c = (Copies)attributes.get(Copies.class);
    jobAttributes.setCopies(c.getValue());

    SunPageSelection sel =
        (SunPageSelection)attributes.get(SunPageSelection.class);
    if (sel == SunPageSelection.RANGE) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.RANGE);
    } else if (sel == SunPageSelection.SELECTION) {
        jobAttributes.setDefaultSelection(DefaultSelectionType.SELECTION);
    } else {
        jobAttributes.setDefaultSelection(DefaultSelectionType.ALL);
    }

    Destination dest = (Destination)attributes.get(Destination.class);
    if (dest != null) {
        jobAttributes.setDestination(DestinationType.FILE);
        jobAttributes.setFileName(dest.getURI().getPath());
    } else {
        jobAttributes.setDestination(DestinationType.PRINTER);
    }

    PrintService serv = printerJob.getPrintService();
    if (serv != null) {
        jobAttributes.setPrinter(serv.getName());
    }

    PageRanges range = (PageRanges)attributes.get(PageRanges.class);
    int[][] members = range.getMembers();
    jobAttributes.setPageRanges(members);

    SheetCollate collation =
        (SheetCollate)attributes.get(SheetCollate.class);
    if (collation == SheetCollate.COLLATED) {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_COLLATED_COPIES);
    } else {
        jobAttributes.setMultipleDocumentHandling(
        MultipleDocumentHandlingType.SEPARATE_DOCUMENTS_UNCOLLATED_COPIES);
    }

    Sides sides = (Sides)attributes.get(Sides.class);
    if (sides == Sides.TWO_SIDED_LONG_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_LONG_EDGE);
    } else if (sides == Sides.TWO_SIDED_SHORT_EDGE) {
        jobAttributes.setSides(SidesType.TWO_SIDED_SHORT_EDGE);
    } else {
        jobAttributes.setSides(SidesType.ONE_SIDED);
    }

    // PageAttributes

    Chromaticity color =
        (Chromaticity)attributes.get(Chromaticity.class);
    if (color == Chromaticity.COLOR) {
        pageAttributes.setColor(ColorType.COLOR);
    } else {
        pageAttributes.setColor(ColorType.MONOCHROME);
    }

    OrientationRequested orient =
        (OrientationRequested)attributes.get(OrientationRequested.class);
    if (orient == OrientationRequested.LANDSCAPE) {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.LANDSCAPE);
    } else {
        pageAttributes.setOrientationRequested(
                                   OrientationRequestedType.PORTRAIT);
    }

    PrintQuality qual = (PrintQuality)attributes.get(PrintQuality.class);
    if (qual == PrintQuality.DRAFT) {
        pageAttributes.setPrintQuality(PrintQualityType.DRAFT);
    } else if (qual == PrintQuality.HIGH) {
        pageAttributes.setPrintQuality(PrintQualityType.HIGH);
    } else { // NORMAL
        pageAttributes.setPrintQuality(PrintQualityType.NORMAL);
    }

    Media msn = (Media)attributes.get(Media.class);
    if (msn != null && msn instanceof MediaSizeName) {
        MediaType mType = unMapMedia((MediaSizeName)msn);

        if (mType != null) {
            pageAttributes.setMedia(mType);
        }
    }
    debugPrintAttributes(false, false);
}