Fidelity.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* Fidelity.java --
  2. Copyright (C) 2004, 2005 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  15. 02110-1301 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package javax.print.attribute.standard;
  32. import javax.print.attribute.Attribute;
  33. import javax.print.attribute.EnumSyntax;
  34. import javax.print.attribute.PrintJobAttribute;
  35. import javax.print.attribute.PrintRequestAttribute;
  36. /**
  37. * The <code>Fidelity</code> attribute specifies how a print job is handled
  38. * if the supplied attributes are not fully supported.
  39. * <p>
  40. * There may be conflicts between the client requested attributes and the
  41. * attributes supported by the printer object. Such situations are controlled
  42. * through the client by providing this attribute to indicate the wanted
  43. * conflict handling mechanism:
  44. * <ul>
  45. * <li>{@link #FIDELITY_TRUE}: Reject the job since the job can not be
  46. * processed exactly as specified by the attributes of the client.</li>
  47. * <li>{@link #FIDELITY_FALSE}: The Printer may make any changes necessary
  48. * to proceed with processing the Job as good as possible.</li>
  49. * </ul>
  50. * </p>
  51. * <p>
  52. * <b>IPP Compatibility:</b> Fidelity is an IPP 1.1 attribute. The IPP name
  53. * is "ipp-attribute-fidelity". The IPP specification treats Fidelity as a
  54. * boolean type which is not available in the Java Print Service API. The IPP
  55. * boolean value "true" corresponds to <code>FIDELITY_TRUE</code> and "false"
  56. * to <code>FIDELITY_FALSE</code>.
  57. * </p>
  58. *
  59. * @author Michael Koch (konqueror@gmx.de)
  60. * @author Wolfgang Baer (WBaer@gmx.de)
  61. */
  62. public final class Fidelity extends EnumSyntax
  63. implements PrintJobAttribute, PrintRequestAttribute
  64. {
  65. private static final long serialVersionUID = 6320827847329172308L;
  66. /**
  67. * Requests that the job is printed exactly as specified,
  68. * or rejected otherwise.
  69. */
  70. public static final Fidelity FIDELITY_TRUE = new Fidelity(0);
  71. /**
  72. * Requests that the job is printed as exactly as reasonable. This means
  73. * that the print service may choose to substitute the default value
  74. * associated with that attribute, or use some other supported value that
  75. * is similar to the unsupported requested value.
  76. */
  77. public static final Fidelity FIDELITY_FALSE = new Fidelity(1);
  78. private static final String[] stringTable = { "true", "false" };
  79. private static final Fidelity[] enumValueTable = { FIDELITY_TRUE,
  80. FIDELITY_FALSE };
  81. /**
  82. * Constructs a <code>Fidelity</code> object.
  83. *
  84. * @param value the value
  85. */
  86. protected Fidelity(int value)
  87. {
  88. super(value);
  89. }
  90. /**
  91. * Returns category of this class.
  92. *
  93. * @return The class <code>Fidelity</code> itself.
  94. */
  95. public Class< ? extends Attribute> getCategory()
  96. {
  97. return Fidelity.class;
  98. }
  99. /**
  100. * Returns the name of this attribute.
  101. *
  102. * @return The name "ipp-attribute-fidelity".
  103. */
  104. public String getName()
  105. {
  106. return "ipp-attribute-fidelity";
  107. }
  108. /**
  109. * Returns a table with the enumeration values represented as strings
  110. * for this object.
  111. *
  112. * @return The enumeration values as strings.
  113. */
  114. protected String[] getStringTable()
  115. {
  116. return stringTable;
  117. }
  118. /**
  119. * Returns a table with the enumeration values for this object.
  120. *
  121. * @return The enumeration values.
  122. */
  123. protected EnumSyntax[] getEnumValueTable()
  124. {
  125. return enumValueTable;
  126. }
  127. }