< prev index next >

src/java.desktop/share/classes/javax/print/attribute/standard/Media.java

Print this page




  32 
  33 /**
  34  * Class Media is a printing attribute class that specifies the
  35  * medium on which to print.
  36  * <p>
  37  * Media may be specified in different ways.
  38  * <ul>
  39  * <li> it may be specified by paper source - eg paper tray
  40  * <li> it may be specified by a standard size - eg "A4"
  41  * <li> it may be specified by a name - eg "letterhead"
  42  * </ul>
  43  * Each of these corresponds to the IPP "media" attribute.
  44  * The current API does not support describing media by characteristics
  45  * (eg colour, opacity).
  46  * This may be supported in a later revision of the specification.
  47  * <p>
  48  * A Media object is constructed with a value which represents
  49  * one of the ways in which the Media attribute can be specified.
  50  * <p>
  51  * <B>IPP Compatibility:</B>  The category name returned by
  52  * <CODE>getName()</CODE> is the IPP attribute name.  The enumeration's
  53  * integer value is the IPP enum value.  The <code>toString()</code> method
  54  * returns the IPP string representation of the attribute value.
  55  *
  56  * @author Phil Race
  57  */
  58 public abstract class Media extends EnumSyntax
  59     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  60 
  61     private static final long serialVersionUID = -2823970704630722439L;
  62 
  63     /**
  64      * Constructs a new media attribute specified by name.
  65      *
  66      * @param value         a value
  67      */
  68     protected Media(int value) {
  69            super (value);
  70     }
  71 
  72     /**
  73      * Returns whether this media attribute is equivalent to the passed in
  74      * object. To be equivalent, all of the following conditions must be true:
  75      * <OL TYPE=1>
  76      * <LI>
  77      * <CODE>object</CODE> is not null.
  78      * <LI>
  79      * <CODE>object</CODE> is of the same subclass of Media as this object.
  80      * <LI>
  81      * The values are equal.
  82      * </OL>
  83      *
  84      * @param  object  Object to compare to.
  85      *
  86      * @return  True if <CODE>object</CODE> is equivalent to this media
  87      *          attribute, false otherwise.
  88      */
  89     public boolean equals(Object object) {
  90         return(object != null && object instanceof Media &&
  91                object.getClass() == this.getClass() &&
  92                ((Media)object).getValue() == this.getValue());
  93     }
  94 
  95     /**
  96      * Get the printing attribute class which is to be used as the "category"
  97      * for this printing attribute value.
  98      * <P>
  99      * For class Media and any vendor-defined subclasses, the category is
 100      * class Media itself.
 101      *
 102      * @return  Printing attribute class (category), an instance of class
 103      *          {@link java.lang.Class java.lang.Class}.
 104      */
 105     public final Class<? extends Attribute> getCategory() {
 106         return Media.class;
 107     }
 108 
 109     /**
 110      * Get the name of the category of which this attribute value is an
 111      * instance.
 112      * <P>
 113      * For class Media and any vendor-defined subclasses, the category name is
 114      * <CODE>"media"</CODE>.
 115      *
 116      * @return  Attribute category name.
 117      */
 118     public final String getName() {
 119         return "media";
 120     }
 121 
 122 }


  32 
  33 /**
  34  * Class Media is a printing attribute class that specifies the
  35  * medium on which to print.
  36  * <p>
  37  * Media may be specified in different ways.
  38  * <ul>
  39  * <li> it may be specified by paper source - eg paper tray
  40  * <li> it may be specified by a standard size - eg "A4"
  41  * <li> it may be specified by a name - eg "letterhead"
  42  * </ul>
  43  * Each of these corresponds to the IPP "media" attribute.
  44  * The current API does not support describing media by characteristics
  45  * (eg colour, opacity).
  46  * This may be supported in a later revision of the specification.
  47  * <p>
  48  * A Media object is constructed with a value which represents
  49  * one of the ways in which the Media attribute can be specified.
  50  * <p>
  51  * <B>IPP Compatibility:</B>  The category name returned by
  52  * {@code getName()} is the IPP attribute name.  The enumeration's
  53  * integer value is the IPP enum value.  The {@code toString()} method
  54  * returns the IPP string representation of the attribute value.
  55  *
  56  * @author Phil Race
  57  */
  58 public abstract class Media extends EnumSyntax
  59     implements DocAttribute, PrintRequestAttribute, PrintJobAttribute {
  60 
  61     private static final long serialVersionUID = -2823970704630722439L;
  62 
  63     /**
  64      * Constructs a new media attribute specified by name.
  65      *
  66      * @param value         a value
  67      */
  68     protected Media(int value) {
  69            super (value);
  70     }
  71 
  72     /**
  73      * Returns whether this media attribute is equivalent to the passed in
  74      * object. To be equivalent, all of the following conditions must be true:
  75      * <OL TYPE=1>
  76      * <LI>
  77      * {@code object} is not null.
  78      * <LI>
  79      * {@code object} is of the same subclass of Media as this object.
  80      * <LI>
  81      * The values are equal.
  82      * </OL>
  83      *
  84      * @param  object  Object to compare to.
  85      *
  86      * @return  True if {@code object} is equivalent to this media
  87      *          attribute, false otherwise.
  88      */
  89     public boolean equals(Object object) {
  90         return(object != null && object instanceof Media &&
  91                object.getClass() == this.getClass() &&
  92                ((Media)object).getValue() == this.getValue());
  93     }
  94 
  95     /**
  96      * Get the printing attribute class which is to be used as the "category"
  97      * for this printing attribute value.
  98      * <P>
  99      * For class Media and any vendor-defined subclasses, the category is
 100      * class Media itself.
 101      *
 102      * @return  Printing attribute class (category), an instance of class
 103      *          {@link java.lang.Class java.lang.Class}.
 104      */
 105     public final Class<? extends Attribute> getCategory() {
 106         return Media.class;
 107     }
 108 
 109     /**
 110      * Get the name of the category of which this attribute value is an
 111      * instance.
 112      * <P>
 113      * For class Media and any vendor-defined subclasses, the category name is
 114      * {@code "media"}.
 115      *
 116      * @return  Attribute category name.
 117      */
 118     public final String getName() {
 119         return "media";
 120     }
 121 
 122 }
< prev index next >