1 /*
2 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1519 flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
1520 flavor.equals(DocFlavor.URL.JPEG) ||
1521 flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
1522 flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
1523 flavor.equals(DocFlavor.URL.PNG)) {
1524 int caps = getPrinterCapabilities();
1525 if ((caps & DEVCAP_COLOR) != 0) {
1526 return true;
1527 } else {
1528 return attr == Chromaticity.MONOCHROME;
1529 }
1530 } else {
1531 return false;
1532 }
1533 } else if (category == Copies.class) {
1534 return isSupportedCopies((Copies)attr);
1535
1536 } else if (category == Destination.class) {
1537 URI uri = ((Destination)attr).getURI();
1538 if ("file".equals(uri.getScheme()) &&
1539 !(uri.getSchemeSpecificPart().equals(""))) {
1540 return true;
1541 } else {
1542 return false;
1543 }
1544
1545 } else if (category == Media.class) {
1546 if (attr instanceof MediaSizeName) {
1547 return isSupportedMedia((MediaSizeName)attr);
1548 }
1549 if (attr instanceof MediaTray) {
1550 return isSupportedMediaTray((MediaTray)attr);
1551 }
1552
1553 } else if (category == MediaPrintableArea.class) {
1554 return isSupportedMediaPrintableArea((MediaPrintableArea)attr);
1555
1556 } else if (category == SunAlternateMedia.class) {
1557 Media media = ((SunAlternateMedia)attr).getMedia();
1558 return isAttributeValueSupported(media, flavor, attributes);
1559
|
1 /*
2 * Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
1519 flavor.equals(DocFlavor.INPUT_STREAM.JPEG) ||
1520 flavor.equals(DocFlavor.URL.JPEG) ||
1521 flavor.equals(DocFlavor.BYTE_ARRAY.PNG) ||
1522 flavor.equals(DocFlavor.INPUT_STREAM.PNG) ||
1523 flavor.equals(DocFlavor.URL.PNG)) {
1524 int caps = getPrinterCapabilities();
1525 if ((caps & DEVCAP_COLOR) != 0) {
1526 return true;
1527 } else {
1528 return attr == Chromaticity.MONOCHROME;
1529 }
1530 } else {
1531 return false;
1532 }
1533 } else if (category == Copies.class) {
1534 return isSupportedCopies((Copies)attr);
1535
1536 } else if (category == Destination.class) {
1537 URI uri = ((Destination)attr).getURI();
1538 if ("file".equals(uri.getScheme()) &&
1539 !uri.getSchemeSpecificPart().isEmpty()) {
1540 return true;
1541 } else {
1542 return false;
1543 }
1544
1545 } else if (category == Media.class) {
1546 if (attr instanceof MediaSizeName) {
1547 return isSupportedMedia((MediaSizeName)attr);
1548 }
1549 if (attr instanceof MediaTray) {
1550 return isSupportedMediaTray((MediaTray)attr);
1551 }
1552
1553 } else if (category == MediaPrintableArea.class) {
1554 return isSupportedMediaPrintableArea((MediaPrintableArea)attr);
1555
1556 } else if (category == SunAlternateMedia.class) {
1557 Media media = ((SunAlternateMedia)attr).getMedia();
1558 return isAttributeValueSupported(media, flavor, attributes);
1559
|