javax.print.attribute.Attribute Java Examples
The following examples show how to use
javax.print.attribute.Attribute.
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: UnixPrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); Attribute attr; for (int i=0; i<attrs.length; i++) { attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #2
Source File: Win32PrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #3
Source File: Win32PrintService.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
public boolean isAttributeCategorySupported(Class<? extends Attribute> category) { if (category == null) { throw new NullPointerException("null category"); } if (!(Attribute.class.isAssignableFrom(category))) { throw new IllegalArgumentException(category + " is not an Attribute"); } Class[] classList = getSupportedAttributeCategories(); for (int i = 0; i < classList.length; i++) { if (category.equals(classList[i])) { return true; } } return false; }
Example #4
Source File: UnixPrintService.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
public boolean isAttributeCategorySupported(Class<? extends Attribute> category) { if (category == null) { throw new NullPointerException("null category"); } if (!(Attribute.class.isAssignableFrom(category))) { throw new IllegalArgumentException(category + " is not an Attribute"); } for (int i=0;i<otherAttrCats.length;i++) { if (category == otherAttrCats[i]) { return true; } } return false; }
Example #5
Source File: UnixPrintService.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
public PrintServiceAttributeSet getUpdatedAttributes() { PrintServiceAttributeSet currSet = getDynamicAttributes(); if (lastSet == null) { lastSet = currSet; return AttributeSetUtilities.unmodifiableView(currSet); } else { PrintServiceAttributeSet updates = new HashPrintServiceAttributeSet(); Attribute []attrs = currSet.toArray(); Attribute attr; for (int i=0; i<attrs.length; i++) { attr = attrs[i]; if (!lastSet.containsValue(attr)) { updates.add(attr); } } lastSet = currSet; return AttributeSetUtilities.unmodifiableView(updates); } }
Example #6
Source File: Win32PrintServiceLookup.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
boolean matchingService(PrintService service, PrintServiceAttributeSet serviceSet) { if (serviceSet != null) { Attribute [] attrs = serviceSet.toArray(); Attribute serviceAttr; for (int i=0; i<attrs.length; i++) { serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } } return true; }
Example #7
Source File: PSStreamPrintService.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
public AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes) { if (flavor != null && !isDocFlavorSupported(flavor)) { throw new IllegalArgumentException("flavor " + flavor + "is not supported"); } if (attributes == null) { return null; } Attribute attr; AttributeSet unsupp = new HashAttributeSet(); Attribute[] attrs = attributes.toArray(); for (int i=0; i<attrs.length; i++) { try { attr = attrs[i]; if (!isAttributeCategorySupported(attr.getCategory())) { unsupp.add(attr); } else if (!isAttributeValueSupported(attr, flavor, attributes)) { unsupp.add(attr); } } catch (ClassCastException e) { } } if (unsupp.isEmpty()) { return null; } else { return unsupp; } }
Example #8
Source File: WPrinterJob.java From hottub with GNU General Public License v2.0 | 5 votes |
private void setSidesAttrib(Attribute attr) { if (attr == Sides.TWO_SIDED_LONG_EDGE) { mAttSides = 2; // DMDUP_VERTICAL } else if (attr == Sides.TWO_SIDED_SHORT_EDGE) { mAttSides = 3; // DMDUP_HORIZONTAL } else { // Sides.ONE_SIDED mAttSides = 1; } }
Example #9
Source File: ServiceUI.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Removes any attributes from the given AttributeSet that are * unsupported by the given PrintService/DocFlavor combination. */ private static void removeUnsupportedAttributes(PrintService ps, DocFlavor flavor, AttributeSet aset) { AttributeSet asUnsupported = ps.getUnsupportedAttributes(flavor, aset); if (asUnsupported != null) { Attribute[] usAttrs = asUnsupported.toArray(); for (int i=0; i<usAttrs.length; i++) { Class category = usAttrs[i].getCategory(); if (ps.isAttributeCategorySupported(category)) { Attribute attr = (Attribute)ps.getDefaultAttributeValue(category); if (attr != null) { aset.add(attr); } else { aset.remove(category); } } else { aset.remove(category); } } } }
Example #10
Source File: WPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private void setSidesAttrib(Attribute attr) { if (attr == Sides.TWO_SIDED_LONG_EDGE) { mAttSides = 2; // DMDUP_VERTICAL } else if (attr == Sides.TWO_SIDED_SHORT_EDGE) { mAttSides = 3; // DMDUP_HORIZONTAL } else { // Sides.ONE_SIDED mAttSides = 1; } }
Example #11
Source File: WPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 5 votes |
private void setCollateAttrib(Attribute attr) { if (attr == SheetCollate.COLLATED) { mAttCollate = 1; // DMCOLLATE_TRUE } else { mAttCollate = 0; // DMCOLLATE_FALSE } }
Example #12
Source File: PrintServiceLookupProvider.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
private boolean matchesAttributes(PrintService service, PrintServiceAttributeSet attributes) { Attribute [] attrs = attributes.toArray(); for (int i=0; i<attrs.length; i++) { @SuppressWarnings("unchecked") Attribute serviceAttr = service.getAttribute((Class<PrintServiceAttribute>)attrs[i].getCategory()); if (serviceAttr == null || !serviceAttr.equals(attrs[i])) { return false; } } return true; }
Example #13
Source File: WPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void setSidesAttrib(Attribute attr, PrintRequestAttributeSet set) { setSidesAttrib(attr); set.add(attr); }
Example #14
Source File: PrintJobAttributeException.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
PrintJobAttributeException(String s, Class cat, Attribute attrval) { super(s); attr = attrval; category = cat; }
Example #15
Source File: PrintJobAttributeException.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
PrintJobAttributeException(String s, Class cat, Attribute attrval) { super(s); attr = attrval; category = cat; }
Example #16
Source File: WPrinterJob.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
private void setSidesAttrib(Attribute attr, PrintRequestAttributeSet set) { setSidesAttrib(attr); set.add(attr); }
Example #17
Source File: WPrinterJob.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * copy the attributes to the native print job * Note that this method, and hence the re-initialisation * of the GDI values is done on each entry to the print dialog since * an app could redisplay the print dialog for the same job and * 1) the application may have changed attribute settings * 2) the application may have changed the printer. * In the event that the user changes the printer using the dialog, then it is up to GDI to report back all changed values. */ protected void setAttributes(PrintRequestAttributeSet attributes) throws PrinterException { // initialize attribute values initAttributeMembers(); super.setAttributes(attributes); mAttCopies = getCopiesInt(); mDestination = destinationAttr; if (attributes == null) { return; // now always use attributes, so this shouldn't happen. } Attribute[] attrs = attributes.toArray(); for (int i=0; i< attrs.length; i++) { Attribute attr = attrs[i]; try { if (attr.getCategory() == Sides.class) { setSidesAttrib(attr); } else if (attr.getCategory() == Chromaticity.class) { setColorAttrib(attr); } else if (attr.getCategory() == PrinterResolution.class) { setResolutionAttrib(attr); } else if (attr.getCategory() == PrintQuality.class) { setQualityAttrib(attr); } else if (attr.getCategory() == SheetCollate.class) { setCollateAttrib(attr); } else if (attr.getCategory() == Media.class || attr.getCategory() == SunAlternateMedia.class) { /* SunAlternateMedia is used if its a tray, and * any Media that is specified is not a tray. */ if (attr.getCategory() == SunAlternateMedia.class) { Media media = (Media)attributes.get(Media.class); if (media == null || !(media instanceof MediaTray)) { attr = ((SunAlternateMedia)attr).getMedia(); } } if (attr instanceof MediaSizeName) { setWin32MediaAttrib(attr); } if (attr instanceof MediaTray) { setMediaTrayAttrib(attr); } } } catch (ClassCastException e) { } } }
Example #18
Source File: PrintJobAttributeException.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
PrintJobAttributeException(String s, Class<?> cat, Attribute attrval) { super(s); attr = attrval; category = cat; }
Example #19
Source File: PSStreamPrintJob.java From Bytecoder with Apache License 2.0 | 4 votes |
private void getAttributeValues(DocFlavor flavor) throws PrintException { Attribute attr; Class<? extends Attribute> category; if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) { fidelity = true; } else { fidelity = false; } Attribute []attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName && service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName((MediaSizeName)attr); } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } } }
Example #20
Source File: UnixPrintService.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
public boolean isAttributeValueSupported(Attribute attr, DocFlavor flavor, AttributeSet attributes) { if (attr == null) { throw new NullPointerException("null attribute"); } if (flavor != null) { if (!isDocFlavorSupported(flavor)) { throw new IllegalArgumentException(flavor + " is an unsupported flavor"); } else if (isAutoSense(flavor)) { return false; } } Class category = attr.getCategory(); if (!isAttributeCategorySupported(category)) { return false; } else if (attr.getCategory() == Chromaticity.class) { if (flavor == null || isServiceFormattedFlavor(flavor)) { return attr == Chromaticity.COLOR; } else { return false; } } else if (attr.getCategory() == Copies.class) { return (flavor == null || !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) || flavor.equals(DocFlavor.URL.POSTSCRIPT) || flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) && isSupportedCopies((Copies)attr); } else if (attr.getCategory() == Destination.class) { URI uri = ((Destination)attr).getURI(); if ("file".equals(uri.getScheme()) && !(uri.getSchemeSpecificPart().equals(""))) { return true; } else { return false; } } else if (attr.getCategory() == Media.class) { if (attr instanceof MediaSizeName) { return isSupportedMedia((MediaSizeName)attr); } else { return false; } } else if (attr.getCategory() == OrientationRequested.class) { if (attr == OrientationRequested.REVERSE_PORTRAIT || (flavor != null) && !isServiceFormattedFlavor(flavor)) { return false; } } else if (attr.getCategory() == PageRanges.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } else if (attr.getCategory() == SheetCollate.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } else if (attr.getCategory() == Sides.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } return true; }
Example #21
Source File: PSStreamPrintService.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
public AttributeSet getUnsupportedAttributes(DocFlavor flavor, AttributeSet attributes) { if (flavor != null && !isDocFlavorSupported(flavor)) { throw new IllegalArgumentException("flavor " + flavor + "is not supported"); } if (attributes == null) { return null; } Attribute attr; AttributeSet unsupp = new HashAttributeSet(); Attribute[] attrs = attributes.toArray(); for (int i=0; i<attrs.length; i++) { try { attr = attrs[i]; if (!isAttributeCategorySupported(attr.getCategory())) { unsupp.add(attr); } else if (!isAttributeValueSupported(attr, flavor, attributes)) { unsupp.add(attr); } } catch (ClassCastException e) { } } if (unsupp.isEmpty()) { return null; } else { return unsupp; } }
Example #22
Source File: Win32PrintJob.java From hottub with GNU General Public License v2.0 | 4 votes |
private void getAttributeValues(DocFlavor flavor) throws PrintException { if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) { fidelity = true; } else { fidelity = false; } Class category; Attribute [] attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == Destination.class) { URI uri = ((Destination)attr).getURI(); if (!"file".equals(uri.getScheme())) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException("Not a file: URI"); } else { try { mDestination = (new File(uri)).getPath(); } catch (Exception e) { throw new PrintException(e); } // check write access SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkWrite(mDestination); } catch (SecurityException se) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(se); } } } } else if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName) { mediaName = (MediaSizeName)attr; // If requested MediaSizeName is not supported, // get the corresponding media size - this will // be used to create a new PageFormat. if (!service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName(mediaName); } } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } } }
Example #23
Source File: WPrinterJob.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void setColorAttrib(Attribute attr, PrintRequestAttributeSet set) { setColorAttrib(attr); set.add(attr); }
Example #24
Source File: PrintServiceStub.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
@Override public Object getDefaultAttributeValue(Class<? extends Attribute> category) { return null; }
Example #25
Source File: WPrinterJob.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
private void setResolutionAttrib(Attribute attr) { PrinterResolution pr = (PrinterResolution)attr; mAttXRes = pr.getCrossFeedResolution(PrinterResolution.DPI); mAttYRes = pr.getFeedResolution(PrinterResolution.DPI); }
Example #26
Source File: UnixPrintJob.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
private void getAttributeValues(DocFlavor flavor) throws PrintException { Attribute attr; Class category; if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) { fidelity = true; } else { fidelity = false; } Attribute []attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == Destination.class) { URI uri = ((Destination)attr).getURI(); if (!"file".equals(uri.getScheme())) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException("Not a file: URI"); } else { try { mDestType = DESTFILE; mDestination = (new File(uri)).getPath(); } catch (Exception e) { throw new PrintException(e); } // check write access SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkWrite(mDestination); } catch (SecurityException se) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(se); } } } } else if (category == JobSheets.class) { if ((JobSheets)attr == JobSheets.NONE) { mNoJobSheet = true; } } else if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName) { mediaName = (MediaSizeName)attr; IPPPrintService.debug_println(debugPrefix+ "mediaName "+mediaName); if (!service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName(mediaName); } } else if (attr instanceof CustomMediaTray) { customTray = (CustomMediaTray)attr; } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } else if (category == NumberUp.class) { nUp = (NumberUp)attr; } else if (category == Sides.class) { sides = (Sides)attr; } } }
Example #27
Source File: UnixPrintService.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
public boolean isAttributeValueSupported(Attribute attr, DocFlavor flavor, AttributeSet attributes) { if (attr == null) { throw new NullPointerException("null attribute"); } if (flavor != null) { if (!isDocFlavorSupported(flavor)) { throw new IllegalArgumentException(flavor + " is an unsupported flavor"); } else if (isAutoSense(flavor)) { return false; } } Class<? extends Attribute> category = attr.getCategory(); if (!isAttributeCategorySupported(category)) { return false; } else if (attr.getCategory() == Chromaticity.class) { if (flavor == null || isServiceFormattedFlavor(flavor)) { return attr == Chromaticity.COLOR; } else { return false; } } else if (attr.getCategory() == Copies.class) { return (flavor == null || !(flavor.equals(DocFlavor.INPUT_STREAM.POSTSCRIPT) || flavor.equals(DocFlavor.URL.POSTSCRIPT) || flavor.equals(DocFlavor.BYTE_ARRAY.POSTSCRIPT))) && isSupportedCopies((Copies)attr); } else if (attr.getCategory() == Destination.class) { URI uri = ((Destination)attr).getURI(); if ("file".equals(uri.getScheme()) && !(uri.getSchemeSpecificPart().equals(""))) { return true; } else { return false; } } else if (attr.getCategory() == Media.class) { if (attr instanceof MediaSizeName) { return isSupportedMedia((MediaSizeName)attr); } else { return false; } } else if (attr.getCategory() == OrientationRequested.class) { if (attr == OrientationRequested.REVERSE_PORTRAIT || (flavor != null) && !isServiceFormattedFlavor(flavor)) { return false; } } else if (attr.getCategory() == PageRanges.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } else if (attr.getCategory() == SheetCollate.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } else if (attr.getCategory() == Sides.class) { if (flavor != null && !(flavor.equals(DocFlavor.SERVICE_FORMATTED.PAGEABLE) || flavor.equals(DocFlavor.SERVICE_FORMATTED.PRINTABLE))) { return false; } } return true; }
Example #28
Source File: Win32PrintJob.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
private void getAttributeValues(DocFlavor flavor) throws PrintException { if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) { fidelity = true; } else { fidelity = false; } Class category; Attribute [] attrs = reqAttrSet.toArray(); for (int i=0; i<attrs.length; i++) { Attribute attr = attrs[i]; category = attr.getCategory(); if (fidelity == true) { if (!service.isAttributeCategorySupported(category)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported category: " + category, category, null); } else if (!service.isAttributeValueSupported(attr, flavor, null)) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintJobAttributeException( "unsupported attribute: " + attr, null, attr); } } if (category == Destination.class) { URI uri = ((Destination)attr).getURI(); if (!"file".equals(uri.getScheme())) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException("Not a file: URI"); } else { try { mDestination = (new File(uri)).getPath(); } catch (Exception e) { throw new PrintException(e); } // check write access SecurityManager security = System.getSecurityManager(); if (security != null) { try { security.checkWrite(mDestination); } catch (SecurityException se) { notifyEvent(PrintJobEvent.JOB_FAILED); throw new PrintException(se); } } } } else if (category == JobName.class) { jobName = ((JobName)attr).getValue(); } else if (category == Copies.class) { copies = ((Copies)attr).getValue(); } else if (category == Media.class) { if (attr instanceof MediaSizeName) { mediaName = (MediaSizeName)attr; // If requested MediaSizeName is not supported, // get the corresponding media size - this will // be used to create a new PageFormat. if (!service.isAttributeValueSupported(attr, null, null)) { mediaSize = MediaSize.getMediaSizeForName(mediaName); } } } else if (category == OrientationRequested.class) { orient = (OrientationRequested)attr; } } }
Example #29
Source File: Sides.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <P> * For class Sides, the category is class Sides itself. * * @return Printing attribute class (category), an instance of class * {@link java.lang.Class java.lang.Class}. */ public final Class<? extends Attribute> getCategory() { return Sides.class; }
Example #30
Source File: ColorSupported.java From Bytecoder with Apache License 2.0 | 2 votes |
/** * Get the printing attribute class which is to be used as the "category" * for this printing attribute value. * <p> * For class {@code ColorSupported}, the category is class * {@code ColorSupported} itself. * * @return printing attribute class (category), an instance of class * {@link Class java.lang.Class} */ public final Class<? extends Attribute> getCategory() { return ColorSupported.class; }