jdk/src/share/classes/javax/print/attribute/DocAttributeSet.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
child 5506 202f599c92aa
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
 * Copyright 2000-2001 Sun Microsystems, Inc.  All Rights Reserved.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
package javax.print.attribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
 * Interface DocAttributeSet specifies the interface for a set of doc
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * attributes, i.e. printing attributes that implement interface {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * DocAttribute DocAttribute}. In the Print Service API, the client uses a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * DocAttributeSet to specify the characteristics of an individual doc and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * the print job settings to be applied to an individual doc.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * A DocAttributeSet is just an {@link AttributeSet AttributeSet} whose
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * constructors and mutating operations guarantee an additional invariant,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * namely that all attribute values in the DocAttributeSet must be instances
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * of interface {@link DocAttribute DocAttribute}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * The {@link #add(Attribute) <CODE>add(Attribute)</CODE>}, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * {@link #addAll(AttributeSet) <CODE>addAll(AttributeSet)</CODE>} operations
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * are respecified below to guarantee this additional invariant.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * @author  Alan Kaminsky
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
public interface DocAttributeSet extends AttributeSet {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
     * Adds the specified attribute value to this attribute set if it is not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
     * already present, first removing any existing value in the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
     * attribute category as the specified attribute value (optional
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
     * operation).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
     * @param  attribute  Attribute value to be added to this attribute set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
     * @return  <tt>true</tt> if this attribute set changed as a result of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
     *          the call, i.e., the given attribute value was not already a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
     *          member of this attribute set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
     * @throws  UnmodifiableSetException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
     *     (unchecked exception) Thrown if this attribute set does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
     *     support the <CODE>add()</CODE> operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
     * @throws  ClassCastException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
     *     (unchecked exception) Thrown if the <CODE>attribute</CODE> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
     *     not an instance of interface
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
     *     {@link DocAttribute DocAttribute}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * @throws  NullPointerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     *    (unchecked exception) Thrown if the <CODE>attribute</CODE> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
    public boolean add(Attribute attribute);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     * Adds all of the elements in the specified set to this attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
     * The outcome is  the same as if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
     * {@link #add(Attribute) <CODE>add(Attribute)</CODE>}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
     * operation had been applied to this attribute set successively with
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * each element from the specified set. If none of the categories in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * specified set  are the same as any categories in this attribute set,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * the <tt>addAll()</tt> operation effectively modifies this attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * set so that its value is the <i>union</i> of the two sets.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     * The behavior of the <CODE>addAll()</CODE> operation is unspecified if
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
     * the specified set is modified while the operation is in progress.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
     * If the <CODE>addAll()</CODE> operation throws an exception, the effect
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * on this attribute set's state is implementation dependent; elements
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * from the specified set before the point of the exception may or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * may not have been added to this attribute set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     * @param  attributes  whose elements are to be added to this attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
     *            set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
     * @return  <tt>true</tt> if this attribute set changed as a result of
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     *          the call.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     * @throws  UnmodifiableSetException
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     *     (Unchecked exception) Thrown if this attribute set does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     *     support the <tt>addAll()</tt> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
     * @throws  ClassCastException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
     *     (Unchecked exception) Thrown if some element in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
     *     set is not an instance of interface {@link DocAttribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
     *     DocAttribute}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
     * @throws  NullPointerException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
     *     (Unchecked exception) Thrown if the specified  set is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
     * @see #add(Attribute)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
   public boolean addAll(AttributeSet attributes);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
}