Java 类javax.print.attribute.ResolutionSyntax 实例源码

项目:openjdk-jdk10    文件:TestUnsupportedResolution.java   
public void printWorks(String[] args)
{
    PrinterJob job=PrinterJob.getPrinterJob();
    job.setPrintable(this);
    PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet();
    PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI);
    if (args.length > 0 && (args[0].compareTo("600") == 0)) {
        pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI);
        System.out.println("Adding 600 Dpi attribute");
    } else {
        System.out.println("Adding 300 Dpi attribute");
    }
    PrintService ps = job.getPrintService();
    boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null);
    System.out.println("Is "+pr+" supported by "+ps+"?    "+resolutionSupported);
    if (resolutionSupported) {
        System.out.println("Resolution is supported.\nTest is not applicable, PASSED");
    }
    settings.add(pr);
    if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) {
        settings.add(Fidelity.FIDELITY_TRUE);
        System.out.println("Adding Fidelity.FIDELITY_TRUE attribute");
   }

   if (job.printDialog(settings))
   {
        try {
            job.print(settings);
        } catch (PrinterException e) {
            e.printStackTrace();
        }
    }
}
项目:openjdk9    文件:TestUnsupportedResolution.java   
public void printWorks(String[] args)
{
    PrinterJob job=PrinterJob.getPrinterJob();
    job.setPrintable(this);
    PrintRequestAttributeSet settings=new HashPrintRequestAttributeSet();
    PrinterResolution pr = new PrinterResolution(300, 300, ResolutionSyntax.DPI);
    if (args.length > 0 && (args[0].compareTo("600") == 0)) {
        pr = new PrinterResolution(600, 600, ResolutionSyntax.DPI);
        System.out.println("Adding 600 Dpi attribute");
    } else {
        System.out.println("Adding 300 Dpi attribute");
    }
    PrintService ps = job.getPrintService();
    boolean resolutionSupported = ps.isAttributeValueSupported(pr, null, null);
    System.out.println("Is "+pr+" supported by "+ps+"?    "+resolutionSupported);
    if (resolutionSupported) {
        System.out.println("Resolution is supported.\nTest is not applicable, PASSED");
    }
    settings.add(pr);
    if (args.length > 0 && (args[0].equalsIgnoreCase("fidelity"))) {
        settings.add(Fidelity.FIDELITY_TRUE);
        System.out.println("Adding Fidelity.FIDELITY_TRUE attribute");
   }

   if (job.printDialog(settings))
   {
        try {
            job.print(settings);
        } catch (PrinterException e) {
            e.printStackTrace();
        }
    }
}
项目:javify    文件:IppRequest.java   
/**
 * Writes an attribute in ResolutionSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(ResolutionSyntax attribute) throws IOException
{
  String name = ((Attribute) attribute).getName();
  out.writeByte(IppValueTag.RESOLUTION);
  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(9); // length fixed to 9
  out.writeInt(attribute.getCrossFeedResolution(ResolutionSyntax.DPI));
  out.writeInt(attribute.getFeedResolution(ResolutionSyntax.DPI));
  out.writeByte(ResolutionSyntax.DPI);
}
项目:javify    文件:IppRequest.java   
/**
 * Writes the given attribute groups of the given map instance
 * (key=group, values=set of attributes) into the supplied data
 * output stream.
 *
 * @param attributes the set with the attributes.
 *
 * @throws IOException if thrown by the used DataOutputStream.
 * @throws IppException if unknown attributes occur.
 */
public void writeAttributes(AttributeSet attributes)
    throws IOException, IppException
{
  Attribute[] attributeArray = attributes.toArray();
  for (int i = 0; i < attributeArray.length; i++)
    {
      logger.log(Component.IPP, "Attribute: Name: <" + attributeArray[i]
        .getCategory().getName() + "> Value: <"
        + attributeArray[i].toString() + ">");

      if (attributeArray[i] instanceof IntegerSyntax)
        write((IntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof TextSyntax)
        write((TextSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof DateTimeSyntax)
        write((DateTimeSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof ResolutionSyntax)
        write((ResolutionSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof SetOfIntegerSyntax)
        write((SetOfIntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof EnumSyntax)
        write((EnumSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof URISyntax)
        write((URISyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof CharsetSyntax)
        write((CharsetSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof NaturalLanguageSyntax)
        write((NaturalLanguageSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof RequestedAttributes)
        write((RequestedAttributes) attributeArray[i]);
      else
        throw new IppException("Unknown syntax type");
    }
}
项目:jvm-stm    文件:IppRequest.java   
/**
 * Writes an attribute in ResolutionSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(ResolutionSyntax attribute) throws IOException
{
  String name = ((Attribute) attribute).getName();
  out.writeByte(IppValueTag.RESOLUTION);
  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(9); // length fixed to 9
  out.writeInt(attribute.getCrossFeedResolution(ResolutionSyntax.DPI));
  out.writeInt(attribute.getFeedResolution(ResolutionSyntax.DPI));
  out.writeByte(ResolutionSyntax.DPI);
}
项目:jvm-stm    文件:IppRequest.java   
/**
 * Writes the given attribute groups of the given map instance
 * (key=group, values=set of attributes) into the supplied data
 * output stream.
 * 
 * @param attributes the set with the attributes.
 * 
 * @throws IOException if thrown by the used DataOutputStream.
 * @throws IppException if unknown attributes occur.
 */
public void writeAttributes(AttributeSet attributes)
    throws IOException, IppException
{
  Attribute[] attributeArray = attributes.toArray();
  for (int i = 0; i < attributeArray.length; i++)
    {
      logger.log(Component.IPP, "Attribute: Name: <" + attributeArray[i]
        .getCategory().getName() + "> Value: <" 
        + attributeArray[i].toString() + ">");          

      if (attributeArray[i] instanceof IntegerSyntax)
        write((IntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof TextSyntax)
        write((TextSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof DateTimeSyntax)
        write((DateTimeSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof ResolutionSyntax)
        write((ResolutionSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof SetOfIntegerSyntax)
        write((SetOfIntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof EnumSyntax)
        write((EnumSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof URISyntax)
        write((URISyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof CharsetSyntax)
        write((CharsetSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof NaturalLanguageSyntax)
        write((NaturalLanguageSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof RequestedAttributes)
        write((RequestedAttributes) attributeArray[i]);
      else
        throw new IppException("Unknown syntax type");
    }
}
项目:cn1    文件:DevmodeStructWrapper.java   
public PrinterResolution getPrinterResolution() {
    final int x = getDmPrintQuality(structPtr);
    final int y = getDmYResolution(structPtr);

    if (y > 0) {
        return new PrinterResolution(x > 0 ? x : y, y, ResolutionSyntax.DPI);
    }

    return null;
}
项目:cn1    文件:WinPrinterFactory.java   
public static PrinterResolution[] getSupportedPrinterResolutions(
                final long handle) throws PrintException {
    final int[] res = getSupportedResolutions(handle);
    final PrinterResolution[] resolutions = new PrinterResolution[res.length / 2];

    for (int i = 0; i < res.length; i += 2) {
        resolutions[i / 2] = new PrinterResolution(res[i], res[i + 1],
                        ResolutionSyntax.DPI);
    }
    return resolutions;
}
项目:JamVM-PH    文件:IppRequest.java   
/**
 * Writes an attribute in ResolutionSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(ResolutionSyntax attribute) throws IOException
{
  String name = ((Attribute) attribute).getName();
  out.writeByte(IppValueTag.RESOLUTION);
  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(9); // length fixed to 9
  out.writeInt(attribute.getCrossFeedResolution(ResolutionSyntax.DPI));
  out.writeInt(attribute.getFeedResolution(ResolutionSyntax.DPI));
  out.writeByte(ResolutionSyntax.DPI);
}
项目:JamVM-PH    文件:IppRequest.java   
/**
 * Writes the given attribute groups of the given map instance
 * (key=group, values=set of attributes) into the supplied data
 * output stream.
 * 
 * @param attributes the set with the attributes.
 * 
 * @throws IOException if thrown by the used DataOutputStream.
 * @throws IppException if unknown attributes occur.
 */
public void writeAttributes(AttributeSet attributes)
    throws IOException, IppException
{
  Attribute[] attributeArray = attributes.toArray();
  for (int i = 0; i < attributeArray.length; i++)
    {
      logger.log(Component.IPP, "Attribute: Name: <" + attributeArray[i]
        .getCategory().getName() + "> Value: <" 
        + attributeArray[i].toString() + ">");          

      if (attributeArray[i] instanceof IntegerSyntax)
        write((IntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof TextSyntax)
        write((TextSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof DateTimeSyntax)
        write((DateTimeSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof ResolutionSyntax)
        write((ResolutionSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof SetOfIntegerSyntax)
        write((SetOfIntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof EnumSyntax)
        write((EnumSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof URISyntax)
        write((URISyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof CharsetSyntax)
        write((CharsetSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof NaturalLanguageSyntax)
        write((NaturalLanguageSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof RequestedAttributes)
        write((RequestedAttributes) attributeArray[i]);
      else
        throw new IppException("Unknown syntax type");
    }
}
项目:toolkit    文件:PageSetupPanel.java   
private static String generateResolutionTitle(PrinterResolution res) {
    StringBuilder buffer = new StringBuilder();
    int x = res.getCrossFeedResolution(ResolutionSyntax.DPI);
    int y = res.getFeedResolution(ResolutionSyntax.DPI);

    buffer.append(Integer.toString(x));
    if (x != y) {
        buffer.append(" x "); //$NON-NLS-1$
        buffer.append(Integer.toString(y));
    }
    buffer.append(DPI);
    return buffer.toString();
}
项目:birt    文件:DimensionUtil.java   
/**
 * Validates the dpi value. If the value is invalid, try to use the JVM
 * defined value and model defined default value.
 * 
 * @param dpi
 *            the dpi value
 * @return the validated dpi value
 */
private static int validateDPI( int dpi )
{
    if ( dpi <= 0 )
        // Try to use JVM defined value if the dpi value is invalid.
        dpi = ResolutionSyntax.DPI;
    if ( dpi <= 0 )
        // Use the default value if the JVM defined is invalid.
        dpi = DEFAULT_DPI;
    return dpi;
}
项目:classpath    文件:IppRequest.java   
/**
 * Writes an attribute in ResolutionSyntax into the stream.
 * @param attribute the attribute
 * @throws IOException if thrown by the stream
 */
private void write(ResolutionSyntax attribute) throws IOException
{
  String name = ((Attribute) attribute).getName();
  out.writeByte(IppValueTag.RESOLUTION);
  out.writeShort(name.length());
  out.write(name.getBytes());
  out.writeShort(9); // length fixed to 9
  out.writeInt(attribute.getCrossFeedResolution(ResolutionSyntax.DPI));
  out.writeInt(attribute.getFeedResolution(ResolutionSyntax.DPI));
  out.writeByte(ResolutionSyntax.DPI);
}
项目:classpath    文件:IppRequest.java   
/**
 * Writes the given attribute groups of the given map instance
 * (key=group, values=set of attributes) into the supplied data
 * output stream.
 *
 * @param attributes the set with the attributes.
 *
 * @throws IOException if thrown by the used DataOutputStream.
 * @throws IppException if unknown attributes occur.
 */
public void writeAttributes(AttributeSet attributes)
    throws IOException, IppException
{
  Attribute[] attributeArray = attributes.toArray();
  for (int i = 0; i < attributeArray.length; i++)
    {
      logger.log(Component.IPP, "Attribute: Name: <" + attributeArray[i]
        .getCategory().getName() + "> Value: <"
        + attributeArray[i].toString() + ">");

      if (attributeArray[i] instanceof IntegerSyntax)
        write((IntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof TextSyntax)
        write((TextSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof DateTimeSyntax)
        write((DateTimeSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof ResolutionSyntax)
        write((ResolutionSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof SetOfIntegerSyntax)
        write((SetOfIntegerSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof EnumSyntax)
        write((EnumSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof URISyntax)
        write((URISyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof CharsetSyntax)
        write((CharsetSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof NaturalLanguageSyntax)
        write((NaturalLanguageSyntax) attributeArray[i]);
      else if (attributeArray[i] instanceof RequestedAttributes)
        write((RequestedAttributes) attributeArray[i]);
      else
        throw new IppException("Unknown syntax type");
    }
}
项目:freeVM    文件:DevmodeStructWrapper.java   
public PrinterResolution getPrinterResolution() {
    final int x = getDmPrintQuality(structPtr);
    final int y = getDmYResolution(structPtr);

    if (y > 0) {
        return new PrinterResolution(x > 0 ? x : y, y, ResolutionSyntax.DPI);
    }

    return null;
}
项目:freeVM    文件:WinPrinterFactory.java   
public static PrinterResolution[] getSupportedPrinterResolutions(
                final long handle) throws PrintException {
    final int[] res = getSupportedResolutions(handle);
    final PrinterResolution[] resolutions = new PrinterResolution[res.length / 2];

    for (int i = 0; i < res.length; i += 2) {
        resolutions[i / 2] = new PrinterResolution(res[i], res[i + 1],
                        ResolutionSyntax.DPI);
    }
    return resolutions;
}
项目:cn1    文件:DevmodeStructWrapper.java   
public void setPrinterResolution(final PrinterResolution res) {
    setDmPrintQuality(structPtr, (short) res
                    .getCrossFeedResolution(ResolutionSyntax.DPI));
    setDmYResolution(structPtr, (short) res
                    .getFeedResolution(ResolutionSyntax.DPI));
}
项目:cn1    文件:IppAttributeUtils.java   
public static Object getIppValue(Attribute attr, byte ippvtag) {
    Object o = null;

    switch (ippvtag) {
    // integer values for the "value-tag" field.
    case IppAttribute.TAG_BOOLEAN:
    case IppAttribute.TAG_INTEGER:
    case IppAttribute.TAG_ENUM:
        if (attr instanceof IntegerSyntax) {
            o = new Integer(((IntegerSyntax) attr).getValue());
        } else if (attr instanceof EnumSyntax) {
            o = new Integer(((EnumSyntax) attr).getValue());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax
                || attr instanceof TextSyntax || attr instanceof URISyntax) {
            // TODO - process other attr's types
        }
        break;
    // octetString values for the "value-tag" field.
    case IppAttribute.TAG_DATETIME:
    case IppAttribute.TAG_RESOLUTION:
    case IppAttribute.TAG_RANGEOFINTEGER:
    case IppAttribute.TAG_OCTETSTRINGUNSPECIFIEDFORMAT:
    case IppAttribute.TAG_TEXTWITHLANGUAGE:
    case IppAttribute.TAG_NAMEWITHLANGUAGE:
        if (attr instanceof IntegerSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((IntegerSyntax) attr).toString());
        } else if (attr instanceof EnumSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((EnumSyntax) attr).toString());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((TextSyntax) attr).toString());
        } else if (attr instanceof URISyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((URISyntax) attr).toString());
        }
        break;
    // character-string values for the "value-tag" field
    case IppAttribute.TAG_TEXTWITHOUTLANGUAGE:
    case IppAttribute.TAG_NAMEWITHOUTLANGUAGE:
    case IppAttribute.TAG_KEYWORD:
    case IppAttribute.TAG_URI:
    case IppAttribute.TAG_URISCHEME:
    case IppAttribute.TAG_CHARSET:
    case IppAttribute.TAG_NATURAL_LANGUAGE:
    case IppAttribute.TAG_MIMEMEDIATYPE:
        if (attr instanceof IntegerSyntax) {
            o = ((IntegerSyntax) attr).toString();
        } else if (attr instanceof EnumSyntax) {
            o = ((EnumSyntax) attr).toString();
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            o = ((TextSyntax) attr).toString();
        } else if (attr instanceof URISyntax) {
            o = ((URISyntax) attr).toString();
        }
        break;
    default:
        break;
    }

    return o;
}
项目:birt    文件:DimensionUtilTest.java   
/**
 * Tests for dimension merging.
 */
public void testMerge( ) throws Exception
{
    DimensionValue in = DimensionValue.parse( "1in" );
    DimensionValue cm = DimensionValue.parse( "1cm" );
    DimensionValue mm = DimensionValue.parse( "10mm" );
    DimensionValue percentage = DimensionValue.parse( "25%" );
    DimensionValue px = DimensionValue.parse( "10px" );
    DimensionValue ex = DimensionValue.parse( "10ex" );

    // Merge between same absolute unit.
    assertEquals( "2in", DimensionUtil.mergeDimension( in, in ).toString( ) );
    assertEquals( "2cm", DimensionUtil.mergeDimension( cm, cm ).toString( ) );
    assertEquals( "20mm", DimensionUtil.mergeDimension( mm, mm ).toString( ) );
    // Merge between different absolute units.
    assertEquals( "2cm", DimensionUtil.mergeDimension( cm, mm ).toString( ) );
    assertEquals( "20mm", DimensionUtil.mergeDimension( mm, cm ).toString( ) );
    // Merge between same relative unit.
    assertEquals( "50%", DimensionUtil.mergeDimension( percentage,
            percentage ).toString( ) );
    assertEquals( "20px", DimensionUtil.mergeDimension( px, px ).toString( ) );
    assertEquals( "20ex", DimensionUtil.mergeDimension( ex, ex ).toString( ) );
    // Merge between absolute unit and pixel
    assertEquals( "2in", DimensionUtil.mergeDimension( in, px, 10 )
            .toString( ) );
    if ( ResolutionSyntax.DPI > 0 )
    {
        // Try default dpi value
        assertEquals( DimensionUtil.mergeDimension( px, in,
                ResolutionSyntax.DPI ).toString( ), DimensionUtil
                .mergeDimension( px, in ).toString( ) );
    }
    // Merge between different relative unit.
    assertNull( DimensionUtil.mergeDimension( percentage, ex ) );
    assertNull( DimensionUtil.mergeDimension( percentage, px ) );
    assertNull( DimensionUtil.mergeDimension( px, ex ) );
    // Merge between absolute unit and relative unit.
    assertNull( DimensionUtil.mergeDimension( cm, percentage ) );
    assertNull( DimensionUtil.mergeDimension( cm, ex ) );
    assertNull( DimensionUtil.mergeDimension( mm, percentage ) );
    assertNull( DimensionUtil.mergeDimension( mm, ex ) );
}
项目:freeVM    文件:IppAttributeUtils.java   
public static Object getIppValue(Attribute attr, byte ippvtag) {
    Object o = null;

    switch (ippvtag) {
    // integer values for the "value-tag" field.
    case IppAttribute.TAG_BOOLEAN:
    case IppAttribute.TAG_INTEGER:
    case IppAttribute.TAG_ENUM:
        if (attr instanceof IntegerSyntax) {
            o = new Integer(((IntegerSyntax) attr).getValue());
        } else if (attr instanceof EnumSyntax) {
            o = new Integer(((EnumSyntax) attr).getValue());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax
                || attr instanceof TextSyntax || attr instanceof URISyntax) {
            // TODO - process other attr's types
        }
        break;
    // octetString values for the "value-tag" field.
    case IppAttribute.TAG_DATETIME:
    case IppAttribute.TAG_RESOLUTION:
    case IppAttribute.TAG_RANGEOFINTEGER:
    case IppAttribute.TAG_OCTETSTRINGUNSPECIFIEDFORMAT:
    case IppAttribute.TAG_TEXTWITHLANGUAGE:
    case IppAttribute.TAG_NAMEWITHLANGUAGE:
        if (attr instanceof IntegerSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((IntegerSyntax) attr).toString());
        } else if (attr instanceof EnumSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((EnumSyntax) attr).toString());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((TextSyntax) attr).toString());
        } else if (attr instanceof URISyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((URISyntax) attr).toString());
        }
        break;
    // character-string values for the "value-tag" field
    case IppAttribute.TAG_TEXTWITHOUTLANGUAGE:
    case IppAttribute.TAG_NAMEWITHOUTLANGUAGE:
    case IppAttribute.TAG_KEYWORD:
    case IppAttribute.TAG_URI:
    case IppAttribute.TAG_URISCHEME:
    case IppAttribute.TAG_CHARSET:
    case IppAttribute.TAG_NATURAL_LANGUAGE:
    case IppAttribute.TAG_MIMEMEDIATYPE:
        if (attr instanceof IntegerSyntax) {
            o = ((IntegerSyntax) attr).toString();
        } else if (attr instanceof EnumSyntax) {
            o = ((EnumSyntax) attr).toString();
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            o = ((TextSyntax) attr).toString();
        } else if (attr instanceof URISyntax) {
            o = ((URISyntax) attr).toString();
        }
        break;
    default:
        break;
    }

    return o;
}
项目:freeVM    文件:DevmodeStructWrapper.java   
public void setPrinterResolution(final PrinterResolution res) {
    setDmPrintQuality(structPtr, (short) res
                    .getCrossFeedResolution(ResolutionSyntax.DPI));
    setDmYResolution(structPtr, (short) res
                    .getFeedResolution(ResolutionSyntax.DPI));
}
项目:freeVM    文件:IppAttributeUtils.java   
public static Object getIppValue(Attribute attr, byte ippvtag) {
    Object o = null;

    switch (ippvtag) {
    // integer values for the "value-tag" field.
    case IppAttribute.TAG_BOOLEAN:
    case IppAttribute.TAG_INTEGER:
    case IppAttribute.TAG_ENUM:
        if (attr instanceof IntegerSyntax) {
            o = new Integer(((IntegerSyntax) attr).getValue());
        } else if (attr instanceof EnumSyntax) {
            o = new Integer(((EnumSyntax) attr).getValue());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax
                || attr instanceof TextSyntax || attr instanceof URISyntax) {
            // TODO - process other attr's types
        }
        break;
    // octetString values for the "value-tag" field.
    case IppAttribute.TAG_DATETIME:
    case IppAttribute.TAG_RESOLUTION:
    case IppAttribute.TAG_RANGEOFINTEGER:
    case IppAttribute.TAG_OCTETSTRINGUNSPECIFIEDFORMAT:
    case IppAttribute.TAG_TEXTWITHLANGUAGE:
    case IppAttribute.TAG_NAMEWITHLANGUAGE:
        if (attr instanceof IntegerSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((IntegerSyntax) attr).toString());
        } else if (attr instanceof EnumSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((EnumSyntax) attr).toString());
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((TextSyntax) attr).toString());
        } else if (attr instanceof URISyntax) {
            // TODO - it seems that this needs to be fixed
            o = new Integer(((URISyntax) attr).toString());
        }
        break;
    // character-string values for the "value-tag" field
    case IppAttribute.TAG_TEXTWITHOUTLANGUAGE:
    case IppAttribute.TAG_NAMEWITHOUTLANGUAGE:
    case IppAttribute.TAG_KEYWORD:
    case IppAttribute.TAG_URI:
    case IppAttribute.TAG_URISCHEME:
    case IppAttribute.TAG_CHARSET:
    case IppAttribute.TAG_NATURAL_LANGUAGE:
    case IppAttribute.TAG_MIMEMEDIATYPE:
        if (attr instanceof IntegerSyntax) {
            o = ((IntegerSyntax) attr).toString();
        } else if (attr instanceof EnumSyntax) {
            o = ((EnumSyntax) attr).toString();
        } else if (attr instanceof DateTimeSyntax
                || attr instanceof ResolutionSyntax
                || attr instanceof SetOfIntegerSyntax
                || attr instanceof Size2DSyntax) {
            // TODO - process other attr's types
        } else if (attr instanceof TextSyntax) {
            o = ((TextSyntax) attr).toString();
        } else if (attr instanceof URISyntax) {
            o = ((URISyntax) attr).toString();
        }
        break;
    default:
        break;
    }

    return o;
}