< prev index next >

src/java.desktop/share/classes/javax/print/attribute/DocAttributeSet.java

Print this page


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

  26 package javax.print.attribute;
  27 
  28 /**
  29  * Interface {@code DocAttributeSet} specifies the interface for a set of doc
  30  * attributes, i.e. printing attributes that implement interface
  31  * {@link DocAttribute DocAttribute}. In the Print Service API, the client uses
  32  * a {@code DocAttributeSet} to specify the characteristics of an individual doc
  33  * and the print job settings to be applied to an individual doc.
  34  * <p>
  35  * A {@code DocAttributeSet} is just an {@link AttributeSet AttributeSet} whose
  36  * constructors and mutating operations guarantee an additional invariant,
  37  * namely that all attribute values in the {@code DocAttributeSet} must be
  38  * instances of interface {@link DocAttribute DocAttribute}. The
  39  * {@link #add(Attribute) add(Attribute)}, and
  40  * {@link #addAll(AttributeSet) addAll(AttributeSet)} operations are respecified
  41  * below to guarantee this additional invariant.
  42  *
  43  * @author Alan Kaminsky
  44  */
  45 public interface DocAttributeSet extends AttributeSet {
  46 

  47     /**
  48      * Adds the specified attribute value to this attribute set if it is not
  49      * already present, first removing any existing value in the same attribute
  50      * category as the specified attribute value (optional operation).
  51      *
  52      * @param  attribute attribute value to be added to this attribute set
  53      * @return {@code true} if this attribute set changed as a result of the
  54      *         call, i.e., the given attribute value was not already a member of
  55      *         this attribute set
  56      * @throws UnmodifiableSetException if this attribute set does not support
  57      *         the {@code add()} operation
  58      * @throws ClassCastException if the {@code attribute} is not an instance of
  59      *         interface {@link DocAttribute DocAttribute}
  60      * @throws NullPointerException if the {@code attribute} is {@code null}







  61      */
  62     public boolean add(Attribute attribute);
  63 
  64     /**
  65      * Adds all of the elements in the specified set to this attribute. The
  66      * outcome is the same as if the {@link #add(Attribute) add(Attribute)}
  67      * operation had been applied to this attribute set successively with each
  68      * element from the specified set. If none of the categories in the
  69      * specified set are the same as any categories in this attribute set, the
  70      * {@code addAll()} operation effectively modifies this attribute set so
  71      * that its value is the <i>union</i> of the two sets.
  72      * <p>
  73      * The behavior of the {@code addAll()} operation is unspecified if the
  74      * specified set is modified while the operation is in progress.
  75      * <p>
  76      * If the {@code addAll()} operation throws an exception, the effect on this
  77      * attribute set's state is implementation dependent; elements from the
  78      * specified set before the point of the exception may or may not have been
  79      * added to this attribute set.
  80      *
  81      * @param  attributes whose elements are to be added to this attribute set
  82      * @return {@code true} if this attribute set changed as a result of the
  83      *         call
  84      * @throws UnmodifiableSetException if this attribute set does not support
  85      *         the {@code addAll()} method
  86      * @throws ClassCastException if some element in the specified set is not an
  87      *         instance of interface {@link DocAttribute DocAttribute}
  88      * @throws NullPointerException if the specified set is {@code null}









  89      * @see #add(Attribute)
  90      */
  91     public boolean addAll(AttributeSet attributes);
  92 }
< prev index next >