1. /*
  2. * @(#)Chromaticity.java 1.9 04/05/05
  3. *
  4. * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.print.attribute.standard;
  8. import javax.print.attribute.Attribute;
  9. import javax.print.attribute.EnumSyntax;
  10. import javax.print.attribute.DocAttribute;
  11. import javax.print.attribute.PrintRequestAttribute;
  12. import javax.print.attribute.PrintJobAttribute;
  13. /**
  14. * Class Chromaticity is a printing attribute class, an enumeration, that
  15. * specifies monochrome or color printing. This is used by a print client
  16. * to specify how the print data should be generated or processed. It is not
  17. * descriptive of the color capabilities of the device. Query the service's
  18. * {@link ColorSupported ColorSupported} attribute to determine if the device
  19. * can be verified to support color printing.
  20. * <P>
  21. * The table below shows the effects of specifying a Chromaticity attribute of
  22. * {@link #MONOCHROME <CODE>MONOCHROME</CODE>} or {@link #COLOR
  23. * <CODE>COLOR</CODE>} for a monochrome or color document.
  24. * <P>
  25. * <TABLE BORDER=1 CELLPADDING=2 CELLSPACING=1 SUMMARY="Shows effects of specifying MONOCHROME or COLOR Chromaticity attributes">
  26. * <TR BGCOLOR="#E5E5E5">
  27. * <TH>
  28. * Chromaticity<BR>Attribute
  29. * </TH>
  30. * <TH>
  31. * Effect on<BR>Monochrome Document
  32. * </TH>
  33. * <TH>
  34. * Effect on<BR>Color Document
  35. * </TH>
  36. * </TR>
  37. * <TR>
  38. * <TD>
  39. * {@link #MONOCHROME <CODE>MONOCHROME</CODE>}
  40. * </TD>
  41. * <TD>
  42. * Printed as is, in monochrome
  43. * </TD>
  44. * <TD>
  45. * Printed in monochrome, with colors converted to shades of gray
  46. * </TD>
  47. * </TR>
  48. * <TR>
  49. * <TD>
  50. * {@link #COLOR <CODE>COLOR</CODE>}
  51. * </TD>
  52. * <TD>
  53. * Printed as is, in monochrome
  54. * </TD>
  55. * <TD>
  56. * Printed as is, in color
  57. * </TD>
  58. * </TR>
  59. * </TABLE>
  60. * <P>
  61. * <P>
  62. * <B>IPP Compatibility:</B> Chromaticity is not an IPP attribute at present.
  63. * <P>
  64. *
  65. * @author Alan Kaminsky
  66. */
  67. public final class Chromaticity extends EnumSyntax
  68. implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  69. private static final long serialVersionUID = 4660543931355214012L;
  70. /**
  71. * Monochrome printing.
  72. */
  73. public static final Chromaticity MONOCHROME = new Chromaticity(0);
  74. /**
  75. * Color printing.
  76. */
  77. public static final Chromaticity COLOR = new Chromaticity(1);
  78. /**
  79. * Construct a new chromaticity enumeration value with the given integer
  80. * value.
  81. *
  82. * @param value Integer value.
  83. */
  84. protected Chromaticity(int value) {
  85. super(value);
  86. }
  87. private static final String[] myStringTable = {"monochrome",
  88. "color"};
  89. private static final Chromaticity[] myEnumValueTable = {MONOCHROME,
  90. COLOR};
  91. /**
  92. * Returns the string table for class Chromaticity.
  93. */
  94. protected String[] getStringTable() {
  95. return myStringTable;
  96. }
  97. /**
  98. * Returns the enumeration value table for class Chromaticity.
  99. */
  100. protected EnumSyntax[] getEnumValueTable() {
  101. return myEnumValueTable;
  102. }
  103. /**
  104. * Get the printing attribute class which is to be used as the "category"
  105. * for this printing attribute value.
  106. * <P>
  107. * For class Chromaticity, the category is the class Chromaticity itself.
  108. *
  109. * @return Printing attribute class (category), an instance of class
  110. * {@link java.lang.Class java.lang.Class}.
  111. */
  112. public final Class<? extends Attribute> getCategory() {
  113. return Chromaticity.class;
  114. }
  115. /**
  116. * Get the name of the category of which this attribute value is an
  117. * instance.
  118. * <P>
  119. * For class Chromaticity, the category name is <CODE>"chromaticity"</CODE>.
  120. *
  121. * @return Attribute category name.
  122. */
  123. public final String getName() {
  124. return "chromaticity";
  125. }
  126. }