Java 类javax.print.attribute.standard.Fidelity 实例源码

项目:JuggleMasterPro    文件:PrintJDialog.java   
final public void setVisible() {

        this.setVisible(true);
        if (this.bolGvalidated) {
            final Fidelity objLfidelity = (Fidelity) this.objGhashPrintRequestAttributeSet.get(Fidelity.class);
            if (objLfidelity != null && objLfidelity == Fidelity.FIDELITY_TRUE) {
                this.removeUnsupportedAttributes();
            }
        }
    }
项目:javify    文件:IppRequest.java   
/**
 * Writes an attribute in EnumSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(EnumSyntax attribute) throws IOException
{
  // in JPS API enum syntax is used for enums, keyword and boolean types
  String name = ((Attribute) attribute).getName();

  // the enum value types
  if (attribute instanceof Finishings
      || attribute instanceof OrientationRequested
      || attribute instanceof PrintQuality)
    {
      out.writeByte(IppValueTag.ENUM);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(4); // length, enum is 4 bytes
      out.writeInt(attribute.getValue());
    }
  // the boolean value type
  else if (attribute instanceof Fidelity)
    {
      out.writeByte(IppValueTag.BOOLEAN);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(1); // length, boolean is 1 bytes
      out.writeByte(attribute.getValue() == 0 ? 0x00 : 0x01);
    }
  // the keyword value types
  else
    {
      String keyword = attribute.toString();
      out.writeByte(IppValueTag.KEYWORD);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(keyword.length());
      out.write(keyword.getBytes());
    }
}
项目:jvm-stm    文件:IppRequest.java   
/**
 * Writes an attribute in EnumSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(EnumSyntax attribute) throws IOException
{
  // in JPS API enum syntax is used for enums, keyword and boolean types
  String name = ((Attribute) attribute).getName();

  // the enum value types
  if (attribute instanceof Finishings
      || attribute instanceof OrientationRequested
      || attribute instanceof PrintQuality)
    {
      out.writeByte(IppValueTag.ENUM);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(4); // length, enum is 4 bytes
      out.writeInt(attribute.getValue());
    }
  // the boolean value type
  else if (attribute instanceof Fidelity)
    {
      out.writeByte(IppValueTag.BOOLEAN);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(1); // length, boolean is 1 bytes
      out.writeByte(attribute.getValue() == 0 ? 0x00 : 0x01);
    }
  // the keyword value types
  else
    {
      String keyword = attribute.toString();
      out.writeByte(IppValueTag.KEYWORD);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(keyword.length());
      out.write(keyword.getBytes());
    }
}
项目:JamVM-PH    文件:IppRequest.java   
/**
 * Writes an attribute in EnumSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(EnumSyntax attribute) throws IOException
{
  // in JPS API enum syntax is used for enums, keyword and boolean types
  String name = ((Attribute) attribute).getName();

  // the enum value types
  if (attribute instanceof Finishings
      || attribute instanceof OrientationRequested
      || attribute instanceof PrintQuality)
    {
      out.writeByte(IppValueTag.ENUM);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(4); // length, enum is 4 bytes
      out.writeInt(attribute.getValue());
    }
  // the boolean value type
  else if (attribute instanceof Fidelity)
    {
      out.writeByte(IppValueTag.BOOLEAN);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(1); // length, boolean is 1 bytes
      out.writeByte(attribute.getValue() == 0 ? 0x00 : 0x01);
    }
  // the keyword value types
  else
    {
      String keyword = attribute.toString();
      out.writeByte(IppValueTag.KEYWORD);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(keyword.length());
      out.write(keyword.getBytes());
    }
}
项目:classpath    文件:IppRequest.java   
/**
 * Writes an attribute in EnumSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(EnumSyntax attribute) throws IOException
{
  // in JPS API enum syntax is used for enums, keyword and boolean types
  String name = ((Attribute) attribute).getName();

  // the enum value types
  if (attribute instanceof Finishings
      || attribute instanceof OrientationRequested
      || attribute instanceof PrintQuality)
    {
      out.writeByte(IppValueTag.ENUM);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(4); // length, enum is 4 bytes
      out.writeInt(attribute.getValue());
    }
  // the boolean value type
  else if (attribute instanceof Fidelity)
    {
      out.writeByte(IppValueTag.BOOLEAN);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(1); // length, boolean is 1 bytes
      out.writeByte(attribute.getValue() == 0 ? 0x00 : 0x01);
    }
  // the keyword value types
  else
    {
      String keyword = attribute.toString();
      out.writeByte(IppValueTag.KEYWORD);
      out.writeShort(name.length());
      out.write(name.getBytes());
      out.writeShort(keyword.length());
      out.write(keyword.getBytes());
    }
}
项目:OpenJSharp    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:OpenJSharp    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:OpenJSharp    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:OpenJSharp    文件:Win32PrintJob.java   
private void getAttributeValues(DocFlavor flavor) throws PrintException {

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        } else {
            fidelity = false;
        }

        Attribute chroma = reqAttrSet.get( Chromaticity.class );
        // TODO check whether supported by the print service
        printColor = chroma == Chromaticity.COLOR;

        Attribute newTray = reqAttrSet.get( Media.class );
        if( newTray instanceof MediaTray ){
            mediaTray = (MediaTray)newTray;
        }
        // TODO check whether supported by the print service

        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, flavor, null)) {
                        mediaSize = MediaSize.getMediaSizeForName(mediaName);
                    }
                }
            } else if (category == OrientationRequested.class) {
                orient = (OrientationRequested)attr;
            }
        }
    }
项目:jdk8u-jdk    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:jdk8u-jdk    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:jdk8u-jdk    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:openjdk-jdk10    文件:PSStreamPrintJob.java   
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;
            }
        }
    }
项目:openjdk-jdk10    文件:UnixPrintJob.java   
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 == 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;
        }
    }
}
项目:openjdk-jdk10    文件:Win32PrintJob.java   
private void getAttributeValues(DocFlavor flavor) throws PrintException {

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        } else {
            fidelity = false;
        }

        Class<? extends Attribute> 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;
            }
        }
    }
项目:openjdk9    文件:PSStreamPrintJob.java   
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;
            }
        }
    }
项目:openjdk9    文件:UnixPrintJob.java   
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 == 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;
        }
    }
}
项目:openjdk9    文件:Win32PrintJob.java   
private void getAttributeValues(DocFlavor flavor) throws PrintException {

        if (reqAttrSet.get(Fidelity.class) == Fidelity.FIDELITY_TRUE) {
            fidelity = true;
        } else {
            fidelity = false;
        }

        Class<? extends Attribute> 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;
            }
        }
    }
项目:jdk8u_jdk    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:jdk8u_jdk    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:jdk8u_jdk    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:lookaside_java-1.8.0-openjdk    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:lookaside_java-1.8.0-openjdk    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:lookaside_java-1.8.0-openjdk    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:javify    文件:IppPrintService.java   
/**
 * @see javax.print.PrintService#getDefaultAttributeValue(java.lang.Class)
 */
public Object getDefaultAttributeValue(Class<? extends Attribute> category)
{
  // required attributes
  if (category.equals(Fidelity.class))
    return Fidelity.FIDELITY_FALSE;
  if (category.equals(JobName.class))
    return JOB_NAME;
  if (category.equals(RequestingUserName.class))
    return REQUESTING_USER_NAME;

  // optional attributes
  if (category.equals(JobPriority.class)
      && printerAttr.containsKey(JobPriorityDefault.class))
    return getPrinterDefaultAttribute(JobPriorityDefault.class);
  if (category.equals(JobHoldUntil.class)
      && printerAttr.containsKey(JobHoldUntilDefault.class))
    return getPrinterDefaultAttribute(JobHoldUntilDefault.class);
  if (category.equals(JobSheets.class)
      && printerAttr.containsKey(JobSheetsDefault.class))
    return getPrinterDefaultAttribute(JobSheetsDefault .class);
  if (category.equals(MultipleDocumentHandling.class)
      && printerAttr.containsKey(MultipleDocumentHandlingDefault.class))
    return getPrinterDefaultAttribute(MultipleDocumentHandlingDefault.class);
  if (category.equals(Copies.class)
      && printerAttr.containsKey(CopiesDefault.class))
    return getPrinterDefaultAttribute(CopiesDefault.class);
  if (category.equals(Finishings.class)
      && printerAttr.containsKey(FinishingsDefault.class))
    return getPrinterDefaultAttribute(FinishingsDefault.class);
  if (category.equals(Sides.class)
      && printerAttr.containsKey(SidesDefault.class))
    return getPrinterDefaultAttribute(SidesDefault.class);
  if (category.equals(NumberUp.class)
      && printerAttr.containsKey(NumberUpDefault.class))
    return getPrinterDefaultAttribute(NumberUpDefault.class);
  if (category.equals(OrientationRequested.class)
      && printerAttr.containsKey(OrientationRequestedDefault.class))
    return getPrinterDefaultAttribute(OrientationRequestedDefault.class);
  if (category.equals(Media.class)
      && printerAttr.containsKey(MediaDefault.class))
    return getPrinterDefaultAttribute(MediaDefault.class);
  if (category.equals(PrinterResolution.class)
      && printerAttr.containsKey(PrinterResolutionDefault.class))
    return getPrinterDefaultAttribute(PrinterResolutionDefault.class);
  if (category.equals(PrintQuality.class)
      && printerAttr.containsKey(PrintQualityDefault.class))
    return getPrinterDefaultAttribute(PrintQualityDefault.class);
  if (category.equals(Compression.class)
      && printerAttr.containsKey(CompressionSupported.class))
    return Compression.NONE;
  if (category.equals(PageRanges.class))
    return new PageRanges(1, Integer.MAX_VALUE);

  return null;
}
项目:javify    文件:IppPrintService.java   
/**
 * @see javax.print.PrintService#getSupportedAttributeCategories()
 */
public Class<?>[] getSupportedAttributeCategories()
{
  Set<Class<? extends Attribute>> categories =
    new HashSet<Class<? extends Attribute>>();

  // Should only be job template attributes as of section 4.2
  if (printerAttr.containsKey(JobPrioritySupported.class))
    categories.add(JobPriority.class);
  if (printerAttr.containsKey(JobHoldUntilSupported.class))
    categories.add(JobHoldUntil.class);
  if (printerAttr.containsKey(JobSheetsSupported.class))
    categories.add(JobSheets.class);
  if (printerAttr.containsKey(MultipleDocumentHandlingSupported.class))
    categories.add(MultipleDocumentHandling.class);
  if (printerAttr.containsKey(CopiesSupported.class))
    categories.add(Copies.class);
  if (printerAttr.containsKey(FinishingsSupported.class))
    {
      // if only none finishing is supported - it does not count as supported
      Set<FinishingsSupported> set = getPrinterAttributeSet(FinishingsSupported.class);
      if (! (set.size() == 1 && set.contains(FinishingsSupported.NONE)))
        categories.add(Finishings.class);
    }
  if (printerAttr.containsKey(PageRangesSupported.class))
    categories.add(PageRanges.class);
  if (printerAttr.containsKey(SidesSupported.class))
    categories.add(Sides.class);
  if (printerAttr.containsKey(NumberUpSupported.class))
    categories.add(NumberUp.class);
  if (printerAttr.containsKey(OrientationRequestedSupported.class))
    categories.add(OrientationRequested.class);
  if (printerAttr.containsKey(MediaSupported.class))
    categories.add(Media.class);
  if (printerAttr.containsKey(PrinterResolutionSupported.class))
    categories.add(PrinterResolution.class);
  if (printerAttr.containsKey(PrintQualitySupported.class))
    categories.add(PrintQuality.class);

  // Chromaticity, Destination, MediaPrintableArea,
  // SheetCollate, PresentationDirection - not IPP attributes

  // attributes outside section 4.2
  if (printerAttr.containsKey(CompressionSupported.class))
    categories.add(Compression.class);
  if (printerAttr.containsKey(JobImpressionsSupported.class))
    categories.add(JobImpressions.class);
  if (printerAttr.containsKey(JobKOctetsSupported.class))
    categories.add(JobKOctets.class);
  if (printerAttr.containsKey(JobMediaSheetsSupported.class))
    categories.add(JobMediaSheets.class);

  // always supported as required by IPP specification
  categories.add(Fidelity.class);
  categories.add(JobName.class);
  categories.add(RequestingUserName.class);

  return categories.toArray(new Class[categories.size()]);
}
项目:jvm-stm    文件:IppPrintService.java   
/**
 * @see javax.print.PrintService#getDefaultAttributeValue(java.lang.Class)
 */
public Object getDefaultAttributeValue(Class category)
{ 
  // required attributes
  if (category.equals(Fidelity.class))
    return Fidelity.FIDELITY_FALSE;    
  if (category.equals(JobName.class))
    return JOB_NAME;
  if (category.equals(RequestingUserName.class))
    return REQUESTING_USER_NAME;

  // optional attributes
  if (category.equals(JobPriority.class) 
      && printerAttr.containsKey(JobPriorityDefault.class))
    return getPrinterDefaultAttribute(JobPriorityDefault.class);
  if (category.equals(JobHoldUntil.class) 
      && printerAttr.containsKey(JobHoldUntilDefault.class))
    return getPrinterDefaultAttribute(JobHoldUntilDefault.class);
  if (category.equals(JobSheets.class) 
      && printerAttr.containsKey(JobSheetsDefault.class))
    return getPrinterDefaultAttribute(JobSheetsDefault .class);
  if (category.equals(MultipleDocumentHandling.class) 
      && printerAttr.containsKey(MultipleDocumentHandlingDefault.class))
    return getPrinterDefaultAttribute(MultipleDocumentHandlingDefault.class);
  if (category.equals(Copies.class) 
      && printerAttr.containsKey(CopiesDefault.class))
    return getPrinterDefaultAttribute(CopiesDefault.class);
  if (category.equals(Finishings.class) 
      && printerAttr.containsKey(FinishingsDefault.class))
    return getPrinterDefaultAttribute(FinishingsDefault.class);
  if (category.equals(Sides.class) 
      && printerAttr.containsKey(SidesDefault.class))
    return getPrinterDefaultAttribute(SidesDefault.class);
  if (category.equals(NumberUp.class) 
      && printerAttr.containsKey(NumberUpDefault.class))
    return getPrinterDefaultAttribute(NumberUpDefault.class);
  if (category.equals(OrientationRequested.class) 
      && printerAttr.containsKey(OrientationRequestedDefault.class))
    return getPrinterDefaultAttribute(OrientationRequestedDefault.class);
  if (category.equals(Media.class) 
      && printerAttr.containsKey(MediaDefault.class))
    return getPrinterDefaultAttribute(MediaDefault.class);
  if (category.equals(PrinterResolution.class) 
      && printerAttr.containsKey(PrinterResolutionDefault.class))
    return getPrinterDefaultAttribute(PrinterResolutionDefault.class);
  if (category.equals(PrintQuality.class) 
      && printerAttr.containsKey(PrintQualityDefault.class))
    return getPrinterDefaultAttribute(PrintQualityDefault.class);
  if (category.equals(Compression.class) 
      && printerAttr.containsKey(CompressionSupported.class))
    return Compression.NONE;
  if (category.equals(PageRanges.class))
    return new PageRanges(1, Integer.MAX_VALUE);

  return null; 
}
项目:jvm-stm    文件:IppPrintService.java   
/**
 * @see javax.print.PrintService#getSupportedAttributeCategories()
 */
public Class[] getSupportedAttributeCategories()
{
  Set categories = new HashSet();

  // Should only be job template attributes as of section 4.2    
  if (printerAttr.containsKey(JobPrioritySupported.class))
    categories.add(JobPriority.class);
  if (printerAttr.containsKey(JobHoldUntilSupported.class))
    categories.add(JobHoldUntil.class);
  if (printerAttr.containsKey(JobSheetsSupported.class))
    categories.add(JobSheets.class);
  if (printerAttr.containsKey(MultipleDocumentHandlingSupported.class))
    categories.add(MultipleDocumentHandling.class);    
  if (printerAttr.containsKey(CopiesSupported.class))
    categories.add(Copies.class);
  if (printerAttr.containsKey(FinishingsSupported.class))
    {
      // if only none finishing is supported - it does not count as supported
      Set set = getPrinterAttributeSet(FinishingsSupported.class);        
      if (! (set.size() == 1 && set.contains(FinishingsSupported.NONE)))          
        categories.add(Finishings.class);
    }
  if (printerAttr.containsKey(PageRangesSupported.class))
    categories.add(PageRanges.class);
  if (printerAttr.containsKey(SidesSupported.class))
    categories.add(Sides.class);
  if (printerAttr.containsKey(NumberUpSupported.class))
    categories.add(NumberUp.class);
  if (printerAttr.containsKey(OrientationRequestedSupported.class))
    categories.add(OrientationRequested.class);
  if (printerAttr.containsKey(MediaSupported.class))
    categories.add(Media.class);
  if (printerAttr.containsKey(PrinterResolutionSupported.class))
    categories.add(PrinterResolution.class);
  if (printerAttr.containsKey(PrintQualitySupported.class))
    categories.add(PrintQuality.class);

  // Chromaticity, Destination, MediaPrintableArea, 
  // SheetCollate, PresentationDirection - not IPP attributes

  // attributes outside section 4.2   
  if (printerAttr.containsKey(CompressionSupported.class))
    categories.add(Compression.class);
  if (printerAttr.containsKey(JobImpressionsSupported.class))
    categories.add(JobImpressions.class);
  if (printerAttr.containsKey(JobKOctetsSupported.class))
    categories.add(JobKOctets.class);
  if (printerAttr.containsKey(JobMediaSheetsSupported.class))
    categories.add(JobMediaSheets.class);

  // always supported as required by IPP specification
  categories.add(Fidelity.class);
  categories.add(JobName.class);
  categories.add(RequestingUserName.class);

  return (Class[]) categories.toArray(new Class[categories.size()]);
}
项目:infobip-open-jdk-8    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:infobip-open-jdk-8    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:infobip-open-jdk-8    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:jdk8u-dev-jdk    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:jdk8u-dev-jdk    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:jdk8u-dev-jdk    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:jdk7-jdk    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:jdk7-jdk    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:jdk7-jdk    文件:UnixPrintJob.java   
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;
        }
    }
}
项目:openjdk-source-code-learn    文件:PSStreamPrintJob.java   
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 == 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;
            }
        }
    }
项目:openjdk-source-code-learn    文件:Win32PrintJob.java   
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;
            }
        }
    }
项目:openjdk-source-code-learn    文件:UnixPrintJob.java   
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;
        }
    }
}