From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository. --- .../classpath/javax/print/attribute/Attribute.java | 66 ++ .../javax/print/attribute/AttributeSet.java | 196 +++++ .../print/attribute/AttributeSetUtilities.java | 495 ++++++++++++ .../javax/print/attribute/DateTimeSyntax.java | 115 +++ .../javax/print/attribute/DocAttribute.java | 60 ++ .../javax/print/attribute/DocAttributeSet.java | 82 ++ .../javax/print/attribute/EnumSyntax.java | 242 ++++++ .../javax/print/attribute/HashAttributeSet.java | 419 ++++++++++ .../javax/print/attribute/HashDocAttributeSet.java | 100 +++ .../print/attribute/HashPrintJobAttributeSet.java | 100 +++ .../attribute/HashPrintRequestAttributeSet.java | 100 +++ .../attribute/HashPrintServiceAttributeSet.java | 100 +++ .../javax/print/attribute/IntegerSyntax.java | 127 +++ .../javax/print/attribute/PrintJobAttribute.java | 60 ++ .../print/attribute/PrintJobAttributeSet.java | 82 ++ .../print/attribute/PrintRequestAttribute.java | 55 ++ .../print/attribute/PrintRequestAttributeSet.java | 82 ++ .../print/attribute/PrintServiceAttribute.java | 60 ++ .../print/attribute/PrintServiceAttributeSet.java | 82 ++ .../javax/print/attribute/ResolutionSyntax.java | 271 +++++++ .../javax/print/attribute/SetOfIntegerSyntax.java | 436 ++++++++++ .../javax/print/attribute/Size2DSyntax.java | 283 +++++++ .../print/attribute/SupportedValuesAttribute.java | 59 ++ .../javax/print/attribute/TextSyntax.java | 137 ++++ .../classpath/javax/print/attribute/URISyntax.java | 116 +++ .../print/attribute/UnmodifiableSetException.java | 69 ++ .../classpath/javax/print/attribute/package.html | 78 ++ .../print/attribute/standard/Chromaticity.java | 134 ++++ .../print/attribute/standard/ColorSupported.java | 127 +++ .../print/attribute/standard/Compression.java | 130 +++ .../javax/print/attribute/standard/Copies.java | 115 +++ .../print/attribute/standard/CopiesSupported.java | 130 +++ .../attribute/standard/DateTimeAtCompleted.java | 110 +++ .../attribute/standard/DateTimeAtCreation.java | 110 +++ .../attribute/standard/DateTimeAtProcessing.java | 110 +++ .../print/attribute/standard/Destination.java | 122 +++ .../print/attribute/standard/DocumentName.java | 116 +++ .../javax/print/attribute/standard/Fidelity.java | 146 ++++ .../javax/print/attribute/standard/Finishings.java | 287 +++++++ .../print/attribute/standard/JobHoldUntil.java | 116 +++ .../print/attribute/standard/JobImpressions.java | 128 +++ .../standard/JobImpressionsCompleted.java | 119 +++ .../standard/JobImpressionsSupported.java | 114 +++ .../javax/print/attribute/standard/JobKOctets.java | 128 +++ .../attribute/standard/JobKOctetsProcessed.java | 120 +++ .../attribute/standard/JobKOctetsSupported.java | 114 +++ .../print/attribute/standard/JobMediaSheets.java | 125 +++ .../standard/JobMediaSheetsCompleted.java | 114 +++ .../standard/JobMediaSheetsSupported.java | 114 +++ .../attribute/standard/JobMessageFromOperator.java | 113 +++ .../javax/print/attribute/standard/JobName.java | 111 +++ .../attribute/standard/JobOriginatingUserName.java | 110 +++ .../print/attribute/standard/JobPriority.java | 115 +++ .../attribute/standard/JobPrioritySupported.java | 117 +++ .../javax/print/attribute/standard/JobSheets.java | 127 +++ .../javax/print/attribute/standard/JobState.java | 176 ++++ .../print/attribute/standard/JobStateReason.java | 300 +++++++ .../print/attribute/standard/JobStateReasons.java | 154 ++++ .../javax/print/attribute/standard/Media.java | 123 +++ .../javax/print/attribute/standard/MediaName.java | 120 +++ .../attribute/standard/MediaPrintableArea.java | 312 ++++++++ .../javax/print/attribute/standard/MediaSize.java | 883 +++++++++++++++++++++ .../print/attribute/standard/MediaSizeName.java | 497 ++++++++++++ .../javax/print/attribute/standard/MediaTray.java | 141 ++++ .../standard/MultipleDocumentHandling.java | 147 ++++ .../attribute/standard/NumberOfDocuments.java | 108 +++ .../standard/NumberOfInterveningJobs.java | 109 +++ .../javax/print/attribute/standard/NumberUp.java | 113 +++ .../attribute/standard/NumberUpSupported.java | 146 ++++ .../attribute/standard/OrientationRequested.java | 161 ++++ .../attribute/standard/OutputDeviceAssigned.java | 116 +++ .../attribute/standard/PDLOverrideSupported.java | 130 +++ .../javax/print/attribute/standard/PageRanges.java | 172 ++++ .../print/attribute/standard/PagesPerMinute.java | 110 +++ .../attribute/standard/PagesPerMinuteColor.java | 109 +++ .../attribute/standard/PresentationDirection.java | 177 +++++ .../print/attribute/standard/PrintQuality.java | 141 ++++ .../print/attribute/standard/PrinterInfo.java | 110 +++ .../attribute/standard/PrinterIsAcceptingJobs.java | 132 +++ .../print/attribute/standard/PrinterLocation.java | 110 +++ .../attribute/standard/PrinterMakeAndModel.java | 110 +++ .../standard/PrinterMessageFromOperator.java | 113 +++ .../print/attribute/standard/PrinterMoreInfo.java | 112 +++ .../standard/PrinterMoreInfoManufacturer.java | 116 +++ .../print/attribute/standard/PrinterName.java | 112 +++ .../attribute/standard/PrinterResolution.java | 113 +++ .../print/attribute/standard/PrinterState.java | 147 ++++ .../attribute/standard/PrinterStateReason.java | 331 ++++++++ .../attribute/standard/PrinterStateReasons.java | 203 +++++ .../javax/print/attribute/standard/PrinterURI.java | 112 +++ .../print/attribute/standard/QueuedJobCount.java | 111 +++ .../standard/ReferenceUriSchemesSupported.java | 166 ++++ .../attribute/standard/RequestingUserName.java | 110 +++ .../javax/print/attribute/standard/Severity.java | 135 ++++ .../print/attribute/standard/SheetCollate.java | 136 ++++ .../javax/print/attribute/standard/Sides.java | 147 ++++ .../javax/print/attribute/standard/package.html | 60 ++ 97 files changed, 14725 insertions(+) create mode 100644 libjava/classpath/javax/print/attribute/Attribute.java create mode 100644 libjava/classpath/javax/print/attribute/AttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/AttributeSetUtilities.java create mode 100644 libjava/classpath/javax/print/attribute/DateTimeSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/DocAttribute.java create mode 100644 libjava/classpath/javax/print/attribute/DocAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/EnumSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/HashAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/HashDocAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/IntegerSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/PrintJobAttribute.java create mode 100644 libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/PrintRequestAttribute.java create mode 100644 libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/PrintServiceAttribute.java create mode 100644 libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java create mode 100644 libjava/classpath/javax/print/attribute/ResolutionSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/Size2DSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java create mode 100644 libjava/classpath/javax/print/attribute/TextSyntax.java create mode 100644 libjava/classpath/javax/print/attribute/URISyntax.java create mode 100644 libjava/classpath/javax/print/attribute/UnmodifiableSetException.java create mode 100644 libjava/classpath/javax/print/attribute/package.html create mode 100644 libjava/classpath/javax/print/attribute/standard/Chromaticity.java create mode 100644 libjava/classpath/javax/print/attribute/standard/ColorSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Compression.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Copies.java create mode 100644 libjava/classpath/javax/print/attribute/standard/CopiesSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/DateTimeAtCompleted.java create mode 100644 libjava/classpath/javax/print/attribute/standard/DateTimeAtCreation.java create mode 100644 libjava/classpath/javax/print/attribute/standard/DateTimeAtProcessing.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Destination.java create mode 100644 libjava/classpath/javax/print/attribute/standard/DocumentName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Fidelity.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Finishings.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobHoldUntil.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobImpressions.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobImpressionsSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobKOctets.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobKOctetsProcessed.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobKOctetsSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobMediaSheets.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobMediaSheetsSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobMessageFromOperator.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobOriginatingUserName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobPriority.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobPrioritySupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobSheets.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobState.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobStateReason.java create mode 100644 libjava/classpath/javax/print/attribute/standard/JobStateReasons.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Media.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MediaName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MediaPrintableArea.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MediaSize.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MediaSizeName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MediaTray.java create mode 100644 libjava/classpath/javax/print/attribute/standard/MultipleDocumentHandling.java create mode 100644 libjava/classpath/javax/print/attribute/standard/NumberOfDocuments.java create mode 100644 libjava/classpath/javax/print/attribute/standard/NumberOfInterveningJobs.java create mode 100644 libjava/classpath/javax/print/attribute/standard/NumberUp.java create mode 100644 libjava/classpath/javax/print/attribute/standard/NumberUpSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/OrientationRequested.java create mode 100644 libjava/classpath/javax/print/attribute/standard/OutputDeviceAssigned.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PDLOverrideSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PageRanges.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PagesPerMinute.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PagesPerMinuteColor.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PresentationDirection.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrintQuality.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterInfo.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterIsAcceptingJobs.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterLocation.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterMakeAndModel.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterMessageFromOperator.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterMoreInfo.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterResolution.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterState.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterStateReason.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java create mode 100644 libjava/classpath/javax/print/attribute/standard/PrinterURI.java create mode 100644 libjava/classpath/javax/print/attribute/standard/QueuedJobCount.java create mode 100644 libjava/classpath/javax/print/attribute/standard/ReferenceUriSchemesSupported.java create mode 100644 libjava/classpath/javax/print/attribute/standard/RequestingUserName.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Severity.java create mode 100644 libjava/classpath/javax/print/attribute/standard/SheetCollate.java create mode 100644 libjava/classpath/javax/print/attribute/standard/Sides.java create mode 100644 libjava/classpath/javax/print/attribute/standard/package.html (limited to 'libjava/classpath/javax/print/attribute') diff --git a/libjava/classpath/javax/print/attribute/Attribute.java b/libjava/classpath/javax/print/attribute/Attribute.java new file mode 100644 index 000000000..0fc7e4df6 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/Attribute.java @@ -0,0 +1,66 @@ +/* Attribute.java -- + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * Base interface of every printing attribute of the Java Print Service API. + * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface Attribute extends Serializable +{ + /** + * Returns the category of the printing attribute which is the specific + * attribute class implementing this interface. + * + * @return The concrete {@link Class} instance of the attribute class. + */ + Class< ? extends Attribute> getCategory (); + + /** + * Returns the descriptive name of the attribute category. + * + * Implementations of the Attribute interfaces providing equal + * category values have to return equal name values. + * + * @return The name of the attribute category. + */ + String getName (); +} diff --git a/libjava/classpath/javax/print/attribute/AttributeSet.java b/libjava/classpath/javax/print/attribute/AttributeSet.java new file mode 100644 index 000000000..d2111410f --- /dev/null +++ b/libjava/classpath/javax/print/attribute/AttributeSet.java @@ -0,0 +1,196 @@ +/* AttributeSet.java -- + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * AttributeSet is the top-level interface for sets of printing + * attributes in the Java Print Service API. + *

+ * There are no duplicate values allowed in an attribute set and there is + * at most one attribute object contained per category type. Based on the + * {@link java.util.Map} interface the values of attribute sets are objects + * of type {@link javax.print.attribute.Attribute} and the entries are the + * categories as {@link java.lang.Class} instances. + *

+ *

+ * The following specialized types of AttributeSet are available: + *

+ *

+ *

+ * Attribute sets may be unmodifiable depending on the context of usage. If + * used as read-only attribute set modifying operations throw an + * {@link javax.print.attribute.UnmodifiableSetException}. + *

+ *

+ * The Java Print Service API provides implementation classes for the existing + * attribute set interfaces but applications may use their own implementations. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute to the set. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + boolean addAll (AttributeSet attributes); + + /** + * Removes all attributes from this attribute set. + * + * @throws UnmodifiableSetException if the set does not support modification. + */ + void clear (); + + /** + * Checks if this attributes set contains an attribute with the given + * category. + * + * @param category the category to test for. + * @return true if an attribute of the category is contained + * in the set, false otherwise. + */ + boolean containsKey (Class category); + + /** + * Checks if this attribute set contains the given attribute. + * + * @param attribute the attribute to test for. + * @return true if the attribute is contained in the set, + * false otherwise. + */ + boolean containsValue (Attribute attribute); + + /** + * Tests this set for equality with the given object. true is + * returned, if the given object is also of type AttributeSet + * and the contained attributes are the same as in this set. + * + * @param obj the Object to test. + * @return true if equal, false otherwise. + */ + boolean equals (Object obj); + + /** + * Returns the attribute object contained in this set for the given attribute + * category. + * + * @param category the category of the attribute. A Class + * instance of a class implementing the Attribute interface. + * @return The attribute for this category or null if no + * attribute is contained for the given category. + * @throws NullPointerException if category is null. + * @throws ClassCastException if category is not implementing + * Attribute. + */ + Attribute get (Class category); + + /** + * Returns the hashcode value. The hashcode value is the sum of all hashcodes + * of the attributes contained in this set. + * + * @return The hashcode for this attribute set. + */ + int hashCode (); + + /** + * Checks if the attribute set is empty. + * + * @return true if the attribute set is empty, false otherwise. + */ + boolean isEmpty (); + + /** + * Removes the given attribute from the set. If the given attribute is null + * nothing is done and false is returned. + * + * @param attribute the attribute to remove. + * @return true if removed, false in all other cases. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean remove (Attribute attribute); + + /** + * Removes the attribute entry of the given category from the set. If the given + * category is null nothing is done and false is returned. + * + * @param category the category of the entry to be removed. + * @return true if an attribute is removed, false in all other cases. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean remove (Class category); + + /** + * Returns the number of elements in this attribute set. + * + * @return The number of elements. + */ + int size (); + + /** + * Returns the content of the attribute set as an array + * + * @return An array of attributes. + */ + Attribute[] toArray (); +} diff --git a/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java new file mode 100644 index 000000000..4b7378af5 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/AttributeSetUtilities.java @@ -0,0 +1,495 @@ +/* AttributeSetUtilities.java -- + Copyright (C) 2003, 2004, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * AttributeSetUtilities provides static methods for working + * with AttributeSets. + *

+ * For every type of an attribute set available in the Java Print Service API + * are methods provided to get an unmodifiable view of an attribute set. + * This unmodifiable view provides a read-only version of the attribute + * set which throws {@link javax.print.attribute.UnmodifiableSetException}s + * if state changing methods are invoked. + *

+ *

+ * Methods for getting a synchronized view of an attribute set are also + * available. This view provides synchronized (thread safe) access to the + * underlying wrapped attribute set. + *

+ *

+ * Three static methods for the implementation of own AttributeSets + * are provided, which verify that: + *

+ * + */ +public final class AttributeSetUtilities +{ + /** + * This class isn't intended to be instantiated. + */ + private AttributeSetUtilities() + { + // only static methods + } + + private static class UnmodifiableAttributeSet + implements AttributeSet, Serializable + { + private AttributeSet attrset; + + public UnmodifiableAttributeSet(AttributeSet attributeSet) + { + if (attributeSet == null) + throw new NullPointerException("attributeSet may not be null"); + + this.attrset = attributeSet; + } + + public boolean add(Attribute attribute) + { + throw new UnmodifiableSetException(); + } + + public boolean addAll(AttributeSet attributes) + { + throw new UnmodifiableSetException(); + } + + public void clear() + { + throw new UnmodifiableSetException(); + } + + public boolean containsKey(Class category) + { + return attrset.containsKey(category); + } + + public boolean containsValue(Attribute attribute) + { + return attrset.containsValue(attribute); + } + + public boolean equals(Object obj) + { + return attrset.equals(obj); + } + + public Attribute get(Class interfaceName) + { + return attrset.get(interfaceName); + } + + public int hashCode() + { + return attrset.hashCode(); + } + + public boolean isEmpty() + { + return attrset.isEmpty(); + } + + public boolean remove(Class category) + { + throw new UnmodifiableSetException(); + } + + public boolean remove(Attribute attribute) + { + throw new UnmodifiableSetException(); + } + + public int size() + { + return attrset.size(); + } + + public Attribute[] toArray() + { + return attrset.toArray(); + } + } + + private static class UnmodifiableDocAttributeSet + extends UnmodifiableAttributeSet + implements DocAttributeSet, Serializable + { + public UnmodifiableDocAttributeSet(DocAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class UnmodifiablePrintJobAttributeSet + extends UnmodifiableAttributeSet + implements PrintJobAttributeSet, Serializable + { + public UnmodifiablePrintJobAttributeSet(PrintJobAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class UnmodifiablePrintRequestAttributeSet + extends UnmodifiableAttributeSet + implements PrintRequestAttributeSet, Serializable + { + public UnmodifiablePrintRequestAttributeSet(PrintRequestAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class UnmodifiablePrintServiceAttributeSet + extends UnmodifiableAttributeSet + implements PrintServiceAttributeSet, Serializable + { + public UnmodifiablePrintServiceAttributeSet(PrintServiceAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class SynchronizedAttributeSet + implements AttributeSet, Serializable + { + private AttributeSet attrset; + + public SynchronizedAttributeSet(AttributeSet attributeSet) + { + if (attributeSet == null) + throw new NullPointerException("attributeSet may not be null"); + + attrset = attributeSet; + } + + public synchronized boolean add(Attribute attribute) + { + return attrset.add(attribute); + } + + public synchronized boolean addAll(AttributeSet attributes) + { + return attrset.addAll(attributes); + } + + public synchronized void clear() + { + attrset.clear(); + } + + public synchronized boolean containsKey(Class category) + { + return attrset.containsKey(category); + } + + public synchronized boolean containsValue(Attribute attribute) + { + return attrset.containsValue(attribute); + } + + public synchronized boolean equals(Object obj) + { + return attrset.equals(obj); + } + + public synchronized Attribute get(Class interfaceName) + { + return attrset.get(interfaceName); + } + + public synchronized int hashCode() + { + return attrset.hashCode(); + } + + public synchronized boolean isEmpty() + { + return attrset.isEmpty(); + } + + public synchronized boolean remove(Class category) + { + return attrset.remove(category); + } + + public synchronized boolean remove(Attribute attribute) + { + return attrset.remove(attribute); + } + + public synchronized int size() + { + return attrset.size(); + } + + public synchronized Attribute[] toArray() + { + return attrset.toArray(); + } + } + + private static class SynchronizedDocAttributeSet + extends SynchronizedAttributeSet + implements DocAttributeSet, Serializable + { + public SynchronizedDocAttributeSet(DocAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class SynchronizedPrintJobAttributeSet + extends SynchronizedAttributeSet + implements PrintJobAttributeSet, Serializable + { + public SynchronizedPrintJobAttributeSet(PrintJobAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class SynchronizedPrintRequestAttributeSet + extends SynchronizedAttributeSet + implements PrintRequestAttributeSet, Serializable + { + public SynchronizedPrintRequestAttributeSet(PrintRequestAttributeSet attributeSet) + { + super(attributeSet); + } + } + + private static class SynchronizedPrintServiceAttributeSet + extends SynchronizedAttributeSet + implements PrintServiceAttributeSet, Serializable + { + public SynchronizedPrintServiceAttributeSet(PrintServiceAttributeSet attributeSet) + { + super(attributeSet); + } + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @param attributeSet the set to synchronize. + * @return The sychronized attribute set. + */ + public static AttributeSet synchronizedView(AttributeSet attributeSet) + { + return new SynchronizedAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @param attributeSet the set to synchronize. + * @return The sychronized attribute set. + */ + public static DocAttributeSet synchronizedView(DocAttributeSet attributeSet) + { + return new SynchronizedDocAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @param attributeSet the set to synchronize. + * @return The sychronized attribute set. + */ + public static PrintJobAttributeSet synchronizedView(PrintJobAttributeSet attributeSet) + { + return new SynchronizedPrintJobAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @param attributeSet the set to synchronize. + * @return The sychronized attribute set. + */ + public static PrintRequestAttributeSet synchronizedView(PrintRequestAttributeSet attributeSet) + { + return new SynchronizedPrintRequestAttributeSet(attributeSet); + } + + /** + * Returns a synchronized view of the given attribute set. + * + * @param attributeSet the set to synchronize. + * @return The sychronized attribute set. + */ + public static PrintServiceAttributeSet synchronizedView(PrintServiceAttributeSet attributeSet) + { + return new SynchronizedPrintServiceAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @param attributeSet the set to make unmodifiable. + * @return The unmodifiable attribute set. + */ + public static AttributeSet unmodifiableView(AttributeSet attributeSet) + { + return new UnmodifiableAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @param attributeSet the set to make unmodifiable. + * @return The unmodifiable attribute set. + */ + public static DocAttributeSet unmodifiableView(DocAttributeSet attributeSet) + { + return new UnmodifiableDocAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @param attributeSet the set to make unmodifiable. + * @return The unmodifiable attribute set. + */ + public static PrintJobAttributeSet unmodifiableView(PrintJobAttributeSet attributeSet) + { + return new UnmodifiablePrintJobAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @param attributeSet the set to make unmodifiable. + * @return The unmodifiable attribute set. + */ + public static PrintRequestAttributeSet unmodifiableView(PrintRequestAttributeSet attributeSet) + { + return new UnmodifiablePrintRequestAttributeSet(attributeSet); + } + + /** + * Returns an unmodifiable view of the given attribute set. + * + * @param attributeSet the set to make unmodifiable. + * @return The unmodifiable attribute set. + */ + public static PrintServiceAttributeSet unmodifiableView(PrintServiceAttributeSet attributeSet) + { + return new UnmodifiablePrintServiceAttributeSet(attributeSet); + } + + /** + * Verifies that the given object is a Class that + * implements the given interface name and returns it casted. + * + * @param object the object to test. + * @param interfaceName the Class to verify against. + * @return object casted to Class + * + * @exception ClassCastException if object is not a Class + * that implements interfaceName + * @exception NullPointerException if object is null + */ + public static Class verifyAttributeCategory(Object object, + Class interfaceName) + { + if (object == null) + throw new NullPointerException("object may not be null"); + + Class clazz = (Class) object; + + if (interfaceName.isAssignableFrom(clazz)) + return clazz; + + throw new ClassCastException(); + } + + /** + * Verifies that the given object is an attribute of the given interface. + * and returns it casted to the interface type. + * + * @param object the object to test. + * @param interfaceName the Class to verify against. + * @return the object casted to Attribute + * + * @exception ClassCastException if object is no instance of interfaceName. + * @exception NullPointerException if object is null + */ + public static Attribute verifyAttributeValue(Object object, + Class interfaceName) + { + if (object == null) + throw new NullPointerException("object may not be null"); + + if (interfaceName.isInstance(object)) + return (Attribute) object; + + throw new ClassCastException(); + } + + /** + * Verifies that the category of attribute is equals to the given category + * class. + * + * @param category the category to test. + * @param attribute the attribute to verify. + * + * @exception IllegalArgumentException if the categories are not equal + * @exception NullPointerException if category is null + */ + public static void verifyCategoryForValue(Class category, + Attribute attribute) + { + if (category == null || attribute == null) + throw new NullPointerException("category or attribute may not be null"); + + if (!category.equals(attribute.getCategory())) + throw new IllegalArgumentException + ("category of attribute not equal to category"); + } +} diff --git a/libjava/classpath/javax/print/attribute/DateTimeSyntax.java b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java new file mode 100644 index 000000000..7d587dbd8 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/DateTimeSyntax.java @@ -0,0 +1,115 @@ +/* DateTimeSyntax.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; +import java.util.Date; + +/** + * DateTimeSyntax is the abstract base class of all attribute + * classes having a date and a time as value. + * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class DateTimeSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -1400819079791208582L; + + private Date value; + + /** + * Creates a DateTimeSyntax with a given value. + * + * @param value the date for this syntax + * + * @exception NullPointerException if value is null + */ + protected DateTimeSyntax(Date value) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + } + + /** + * Returns the date value of this object. + * + * @return The date value. + */ + public Date getValue() + { + return value; + } + + /** + * Tests if the given object is equal to this one. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof DateTimeSyntax)) + return false; + + return value.equals(((DateTimeSyntax) obj).getValue()); + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value.hashCode(); + } + + /** + * Returns the string representation for this object. + * + * @return The string representation. + */ + public String toString() + { + return value.toString(); + } +} diff --git a/libjava/classpath/javax/print/attribute/DocAttribute.java b/libjava/classpath/javax/print/attribute/DocAttribute.java new file mode 100644 index 000000000..56114f73e --- /dev/null +++ b/libjava/classpath/javax/print/attribute/DocAttribute.java @@ -0,0 +1,60 @@ +/* DocAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * Marker interface for all attribute classes describing attributes of + * a {@link javax.print.Doc} object. + *

+ * Instances of implementing attribute classes may be collected in a + * {@link javax.print.attribute.DocAttributeSet}. + *

+ * Attributes attached to a {@link javax.print.Doc} instance specify how the + * data should be printed. + * For example {@link javax.print.attribute.standard.Chromaticity} can be + * used to specify that a doc should be printed in color or monochrome. + *

+ * + * @see javax.print.attribute.DocAttributeSet + * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface DocAttribute extends Attribute +{ + // Marker interface +} diff --git a/libjava/classpath/javax/print/attribute/DocAttributeSet.java b/libjava/classpath/javax/print/attribute/DocAttributeSet.java new file mode 100644 index 000000000..35a2676b1 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/DocAttributeSet.java @@ -0,0 +1,82 @@ +/* DocAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * DocAttributeSet specifies an attribute set which only + * allows printing attributes of type + * {@link javax.print.attribute.DocAttribute}. + *

+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are + * respecified in this interface to indicate that only + * DocAttribute instances are allowed in this set. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface DocAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if attribute is not of type + * DocAttribute. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if one of the attributes is not of type + * DocAttribute. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + boolean addAll (AttributeSet attributes); +} diff --git a/libjava/classpath/javax/print/attribute/EnumSyntax.java b/libjava/classpath/javax/print/attribute/EnumSyntax.java new file mode 100644 index 000000000..e848dfcc3 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/EnumSyntax.java @@ -0,0 +1,242 @@ +/* EnumSyntax.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.InvalidObjectException; +import java.io.ObjectStreamException; +import java.io.Serializable; + +/** + * EnumSyntax is the abstract base class of all enumeration + * classes in the Java Print Service API. + *

+ * Every enumeration class which extends from EnumSyntax provides several + * enumeration objects as singletons of its class. + *

+ *

+ * Notes for implementing subclasses: + *

+ *

+ * Example: + *
+ * public class PrinterState extends EnumSyntax
+ * {
+ *   public static final PrinterState IDLE = new PrinterState(1);
+ *   public static final PrinterState PROCESSING = new PrinterState(2);
+ *   public static final PrinterState STOPPED = new PrinterState(3);
+ *
+ *   protected PrinterState(int value)
+ *   {
+ *     super(value);
+ *   }
+ *
+ *   // Overridden because values start not at zero !
+ *   protected int getOffset()
+ *   {
+ *     return 1;
+ *   }
+ *
+ *   private static final String[] stringTable = { "idle", "processing",
+ *                                                 "stopped" };
+ *
+ *   protected String[] getStringTable()
+ *   {
+ *     return stringTable;
+ *   }
+ *
+ *   private static final PrinterState[] enumValueTable = { IDLE,
+ *                                             PROCESSING, STOPPED};
+ *
+ *   protected EnumSyntax[] getEnumValueTable()
+ *   {
+ *     return enumValueTable;
+ *   }
+ * }
+ * 
+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public abstract class EnumSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -2739521845085831642L; + + private int value; + + /** + * Creates a EnumSyntax object. + * + * @param value the value to set. + */ + protected EnumSyntax(int value) + { + this.value = value; + } + + /** + * Returns the value of this enumeration object. + * + * @return The value. + */ + public int getValue() + { + return value; + } + + /** + * Clones this object. + * + * @return A clone of this object. + */ + public Object clone() + { + try + { + return super.clone(); + } + catch (CloneNotSupportedException e) + { + // Cannot happen as we implement java.lang.Cloneable. + return null; + } + } + + /** + * Returns the hashcode for this object. + * The hashcode is the value of this enumeration object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value; + } + + /** + * Returns the string representation for this object. + * The string value from getStringTable() method is returned + * if subclasses override this method. Otherwise the value of this object + * as a string is returned. + * + * @return The string representation. + */ + public String toString() + { + int index = value - getOffset(); + String[] table = getStringTable(); + + if (table != null + && index >= 0 + && index < table.length) + return table[index]; + + return "" + value; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * The default implementation just returns null. Subclasses should + * override this method. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return null; + } + + /** + * Needed for singelton semantics during deserialisation. + * + * Subclasses must not override this class. Subclasses have to override + * getEnumValueTable() and should override + * getStringTable() for correct serialization. + * + * @return The Object at index value - getOffset() + * in getEnumValueTable. + * @throws ObjectStreamException if getEnumValueTable() returns null. + */ + protected Object readResolve() throws ObjectStreamException + { + EnumSyntax[] table = getEnumValueTable(); + if (table == null) + throw new InvalidObjectException("Null enumeration value table " + + "for class " + + this.getClass().toString()); + + return table[value - getOffset()]; + } + + /** + * Returns a table with the enumeration values for this object. + * + * The default implementation just returns null. Subclasses have to + * to override this method for serialization. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return null; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * + * The default implementation returns 0. This is enough if enumerations + * start with a zero value. Otherwise subclasses need to override this + * method for serialization and return the lowest value they use. + * . + * @return The lowest used value used. + */ + protected int getOffset() + { + return 0; + } +} diff --git a/libjava/classpath/javax/print/attribute/HashAttributeSet.java b/libjava/classpath/javax/print/attribute/HashAttributeSet.java new file mode 100644 index 000000000..39d00528d --- /dev/null +++ b/libjava/classpath/javax/print/attribute/HashAttributeSet.java @@ -0,0 +1,419 @@ +/* HashAttributeSet.java -- + Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; +import java.util.HashMap; +import java.util.Iterator; + +/** + * HashAttributeSet provides an implementation of + * {@link javax.print.attribute.AttributeSet}. + */ +public class HashAttributeSet implements AttributeSet, Serializable +{ + private static final long serialVersionUID = 5311560590283707917L; + + private Class myInterface; + private transient HashMap attributeMap = new HashMap(); + + /** + * Creates an empty HashAttributeSet object. + */ + public HashAttributeSet() + { + this(Attribute.class); + } + + /** + * Creates a HashAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the set + * + * @exception NullPointerException if attribute is null + */ + public HashAttributeSet(Attribute attribute) + { + this(attribute, Attribute.class); + } + + /** + * Creates a HashAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * + * @exception NullPointerException if one of the attributes of the given + * array is null. + */ + public HashAttributeSet(Attribute[] attributes) + { + this(attributes, Attribute.class); + } + + /** + * Creates a HashAttributeSet object with attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + */ + public HashAttributeSet(AttributeSet attributes) + { + this(attributes, Attribute.class); + } + + /** + * Creates an empty HashAttributeSet object. + * + * @param interfaceName the interface that all members must implement + * + * @exception NullPointerException if interfaceName is null + */ + protected HashAttributeSet(Class interfaceName) + { + if (interfaceName == null) + throw new NullPointerException("interfaceName may not be null"); + + myInterface = interfaceName; + } + + /** + * Creates a HashAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the set. + * @param interfaceName the interface that all members must implement. + * + * @exception ClassCastException if attribute is not an interface of + * interfaceName + * @exception NullPointerException if attribute or interfaceName is null + */ + protected HashAttributeSet(Attribute attribute, Class interfaceName) + { + this(interfaceName); + + if (attribute == null) + throw new NullPointerException(); + + addInternal(attribute, interfaceName); + } + + /** + * Creates a HashAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * @param interfaceName the interface that all members must implement. + * + * @exception ClassCastException if any element of attributes is not an + * interface of interfaceName + * @exception NullPointerException if attributes or interfaceName is null + */ + protected HashAttributeSet(Attribute[] attributes, Class interfaceName) + { + this(interfaceName); + + if (attributes != null) + { + for (int index = 0; index < attributes.length; index++) + addInternal(attributes[index], interfaceName); + } + } + + /** + * Creates a HashAttributeSet object with attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + * @param interfaceName the interface that all members must implement. + * + * @exception ClassCastException if any element of attributes is not an + * interface of interfaceName + */ + protected HashAttributeSet(AttributeSet attributes, Class interfaceName) + { + this(interfaceName); + + if (attributes != null) + addAllInternal(attributes, interfaceName); + } + + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute to the set. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + public boolean add(Attribute attribute) + { + return addInternal(attribute, myInterface); + } + + private boolean addInternal(Attribute attribute, Class interfaceName) + { + if (attribute == null) + throw new NullPointerException("attribute may not be null"); + + AttributeSetUtilities.verifyAttributeCategory(interfaceName, + myInterface); + + Object old = attributeMap.put + (attribute.getCategory(), AttributeSetUtilities.verifyAttributeValue + (attribute, interfaceName)); + return !attribute.equals(old); + } + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + public boolean addAll(AttributeSet attributes) + { + return addAllInternal(attributes, myInterface); + } + + private boolean addAllInternal(AttributeSet attributes, Class interfaceName) + { + boolean modified = false; + Attribute[] array = attributes.toArray(); + + for (int index = 0; index < array.length; index++) + if (addInternal(array[index], interfaceName)) + modified = true; + + return modified; + } + + /** + * Removes all attributes from this attribute set. + * + * @throws UnmodifiableSetException if the set does not support modification. + */ + public void clear() + { + attributeMap.clear(); + } + + /** + * Checks if this attributes set contains an attribute with the given + * category. + * + * @param category the category to test for. + * @return true if an attribute of the category is contained + * in the set, false otherwise. + */ + public boolean containsKey(Class category) + { + return attributeMap.containsKey(category); + } + + /** + * Checks if this attribute set contains the given attribute. + * + * @param attribute the attribute to test for. + * @return true if the attribute is contained in the set, + * false otherwise. + */ + public boolean containsValue(Attribute attribute) + { + return attributeMap.containsValue(attribute); + } + + /** + * Tests this set for equality with the given object. true is + * returned, if the given object is also of type AttributeSet + * and the contained attributes are the same as in this set. + * + * @param obj the Object to test. + * @return true if equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof HashAttributeSet)) + return false; + + return attributeMap.equals(((HashAttributeSet) obj).attributeMap); + } + + /** + * Returns the attribute object contained in this set for the given attribute + * category. + * + * @param category the category of the attribute. A Class + * instance of a class implementing the Attribute interface. + * @return The attribute for this category or null if no + * attribute is contained for the given category. + * @throws NullPointerException if category is null. + * @throws ClassCastException if category is not implementing + * Attribute. + */ + public Attribute get(Class category) + { + if (category == null) + throw new NullPointerException("category may not be null"); + + return (Attribute) attributeMap.get(category); + } + + /** + * Returns the hashcode value. The hashcode value is the sum of all hashcodes + * of the attributes contained in this set. + * + * @return The hashcode for this attribute set. + */ + public int hashCode() + { + int hashcode = 0; + Iterator it = attributeMap.values().iterator(); + while (it.hasNext()) + hashcode = hashcode + it.next().hashCode(); + + return hashcode; + } + + /** + * Checks if the attribute set is empty. + * + * @return true if the attribute set is empty, false otherwise. + */ + public boolean isEmpty() + { + return attributeMap.isEmpty(); + } + + /** + * Removes the given attribute from the set. If the given attribute is null + * nothing is done and false is returned. + * + * @param attribute the attribute to remove. + * @return true if removed, false in all other cases. + * @throws UnmodifiableSetException if the set does not support modification. + */ + public boolean remove(Attribute attribute) + { + if (attribute == null) + return false; + + return attributeMap.remove(attribute.getCategory()) != null; + } + + /** + * Removes the attribute entry of the given category from the set. If the given + * category is null nothing is done and false is returned. + * + * @param category the category of the entry to be removed. + * @return true if an attribute is removed, false in all other cases. + * @throws UnmodifiableSetException if the set does not support modification. + */ + public boolean remove(Class category) + { + if (category == null) + return false; + + return attributeMap.remove(category) != null; + } + + /** + * Returns the number of elements in this attribute set. + * + * @return The number of elements. + */ + public int size() + { + return attributeMap.size(); + } + + /** + * Returns the content of the attribute set as an array + * + * @return An array of attributes. + */ + public Attribute[] toArray() + { + int index = 0; + Iterator it = attributeMap.values().iterator(); + Attribute[] array = new Attribute[size()]; + + while (it.hasNext()) + { + array[index] = (Attribute) it.next(); + index++; + } + + return array; + } + + // Implemented as specified in serialized form + private void readObject(ObjectInputStream s) + throws ClassNotFoundException, IOException + { + myInterface = (Class) s.readObject(); + int size = s.readInt(); + attributeMap = new HashMap(size); + for (int i=0; i < size; i++) + add((Attribute) s.readObject()); + } + + private void writeObject(ObjectOutputStream s) throws IOException + { + s.writeObject(myInterface); + s.writeInt(size()); + Iterator it = attributeMap.values().iterator(); + while (it.hasNext()) + s.writeObject(it.next()); + } +} diff --git a/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java new file mode 100644 index 000000000..73c25863e --- /dev/null +++ b/libjava/classpath/javax/print/attribute/HashDocAttributeSet.java @@ -0,0 +1,100 @@ +/* HashDocAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * HashDocAttributeSet provides an implementation of + * {@link javax.print.attribute.DocAttributeSet}. + */ +public class HashDocAttributeSet extends HashAttributeSet + implements DocAttributeSet, Serializable +{ + private static final long serialVersionUID = -1128534486061432528L; + + /** + * Creates an empty HashDocAttributeSet object. + */ + public HashDocAttributeSet() + { + super(DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashDocAttributeSet(DocAttribute attribute) + { + super(attribute, DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * + * @exception NullPointerException if one of the attributes of the given + * array is null. + */ + public HashDocAttributeSet(DocAttribute[] attributes) + { + super(attributes, DocAttribute.class); + } + + /** + * Creates a HashDocAttributeSet object with the attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + * @exception ClassCastException if any element of attributes is not + * an instance of DocAttribute + */ + public HashDocAttributeSet(DocAttributeSet attributes) + { + super(attributes, DocAttribute.class); + } +} diff --git a/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java new file mode 100644 index 000000000..ddeda3b47 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/HashPrintJobAttributeSet.java @@ -0,0 +1,100 @@ +/* HashPrintJobAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * HashPrintJobAttributeSet provides an implementation of + * {@link javax.print.attribute.PrintJobAttributeSet}. + */ +public class HashPrintJobAttributeSet extends HashAttributeSet + implements Serializable, PrintJobAttributeSet +{ + private static final long serialVersionUID = -4204473656070350348L; + + /** + * Creates an empty HashPrintJobAttributeSet object. + */ + public HashPrintJobAttributeSet() + { + super(PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintJobAttributeSet(PrintJobAttribute attribute) + { + super(attribute, PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * + * @exception NullPointerException if one of the attributes of the given + * array is null. + */ + public HashPrintJobAttributeSet(PrintJobAttribute[] attributes) + { + super(attributes, PrintJobAttribute.class); + } + + /** + * Creates a HashPrintJobAttributeSet object with the attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + * @exception ClassCastException if any element of attributes is not + * an instance of PrintJobAttribute + */ + public HashPrintJobAttributeSet(PrintJobAttributeSet attributes) + { + super(attributes, PrintJobAttribute.class); + } +} diff --git a/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java new file mode 100644 index 000000000..61c2537df --- /dev/null +++ b/libjava/classpath/javax/print/attribute/HashPrintRequestAttributeSet.java @@ -0,0 +1,100 @@ +/* HashPrintRequestAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * HashPrintRequestAttributeSet provides an implementation of + * {@link javax.print.attribute.PrintRequestAttributeSet}. + */ +public class HashPrintRequestAttributeSet extends HashAttributeSet + implements Serializable, PrintRequestAttributeSet +{ + private static final long serialVersionUID = 2364756266107751933L; + + /** + * Creates an empty HashPrintRequestAttributeSet object. + */ + public HashPrintRequestAttributeSet() + { + super(PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintRequestAttributeSet(PrintRequestAttribute attribute) + { + super(attribute, PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * + * @exception NullPointerException if one of the attributes of the given + * array is null. + */ + public HashPrintRequestAttributeSet(PrintRequestAttribute[] attributes) + { + super(attributes, PrintRequestAttribute.class); + } + + /** + * Creates a HashPrintRequestAttributeSet object with the attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + * @exception ClassCastException if any element of attributes is not + * an instance of PrintRequestAttribute + */ + public HashPrintRequestAttributeSet(PrintRequestAttributeSet attributes) + { + super(attributes, PrintRequestAttribute.class); + } +} diff --git a/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java new file mode 100644 index 000000000..bc934def2 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/HashPrintServiceAttributeSet.java @@ -0,0 +1,100 @@ +/* HashPrintServiceAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * HashPrintServiceAttributeSet provides an implementation of + * {@link javax.print.attribute.PrintServiceAttributeSet}. + */ +public class HashPrintServiceAttributeSet extends HashAttributeSet + implements Serializable, PrintServiceAttributeSet +{ + private static final long serialVersionUID = 6642904616179203070L; + + /** + * Creates an empty HashPrintServiceAttributeSet object. + */ + public HashPrintServiceAttributeSet() + { + super(PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the given + * attribute in it. + * + * @param attribute the attribute to put into the attribute set + * + * @exception NullPointerException if attribute is null + */ + public HashPrintServiceAttributeSet(PrintServiceAttribute attribute) + { + super(attribute, PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the given + * attributes in it. + * + * @param attributes the array of attributes to put into the set. If + * null an empty set is created. + * + * @exception NullPointerException if one of the attributes of the given + * array is null. + */ + public HashPrintServiceAttributeSet(PrintServiceAttribute[] attributes) + { + super(attributes, PrintServiceAttribute.class); + } + + /** + * Creates a HashPrintServiceAttributeSet object with the attributes + * of the given attributes set in it. + * + * @param attributes the attributes set to put into the set. If + * null an empty set is created. + * @exception ClassCastException if any element of attributes is not + * an instance of PrintServiceAttribute + */ + public HashPrintServiceAttributeSet(PrintServiceAttributeSet attributes) + { + super(attributes, PrintServiceAttribute.class); + } +} diff --git a/libjava/classpath/javax/print/attribute/IntegerSyntax.java b/libjava/classpath/javax/print/attribute/IntegerSyntax.java new file mode 100644 index 000000000..b53faa20a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/IntegerSyntax.java @@ -0,0 +1,127 @@ +/* IntegerSyntax.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * IntegerSyntax is the abstract base class of all attribute + * classes having an integer as value. + * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class IntegerSyntax implements Cloneable, Serializable +{ + private int value; + + /** + * Creates a IntegerSyntax with the given value. + * + * @param value the integer to set + */ + protected IntegerSyntax(int value) + { + this.value = value; + } + + /** + * Creates a IntegerSyntax with the given integer value + * and checks if the value lies inside the given bounds.. + * + * @param value the integer to set + * @param lowerBound the lower bound for the value + * @param upperBound the upper bound for the value + * + * @exception IllegalArgumentException if value < lowerBound + * or value > upperBound + */ + protected IntegerSyntax(int value, int lowerBound, int upperBound) + { + if (value < lowerBound + || value > upperBound) + throw new IllegalArgumentException("value not in range"); + + this.value = value; + } + + /** + * Returns the value of this object. + * + * @return The integer value. + */ + public int getValue() + { + return value; + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof IntegerSyntax)) + return false; + + return value == ((IntegerSyntax) obj).getValue(); + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value; + } + + /** + * Returns the string representation for this object. + * + * @return The string representation. + */ + public String toString() + { + return "" + value; + } +} diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttribute.java b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java new file mode 100644 index 000000000..5954824d0 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintJobAttribute.java @@ -0,0 +1,60 @@ +/* PrintJobAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * Marker interface for all attribute classes describing attributes or the + * status of a ({@link javax.print.DocPrintJob} object. + *

+ * Instances of implementing attribute classes may be collected in a + * {@link javax.print.attribute.PrintJobAttributeSet}. + *

+ * A print service uses attributes of this type to inform about the status + * of a print job. + * For example {@link javax.print.attribute.standard.DateTimeAtProcessing} + * is used to report at which date and time a job has started processing. + *

+ * + * @see javax.print.attribute.PrintJobAttributeSet + * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintJobAttribute extends Attribute +{ + // Marker interface +} diff --git a/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java new file mode 100644 index 000000000..232f4b36a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintJobAttributeSet.java @@ -0,0 +1,82 @@ +/* PrintJobAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * PrintJobAttributeSet specifies an attribute set which only + * allows printing attributes of type + * {@link javax.print.attribute.PrintJobAttribute}. + *

+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are + * respecified in this interface to indicate that only + * PrintJobAttribute instances are allowed in this set. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintJobAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if attribute is not of type + * PrintJobAttribute. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if one of the attributes is not of type + * PrintJobAttribute. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + boolean addAll (AttributeSet attributes); +} diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java new file mode 100644 index 000000000..037838ca8 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintRequestAttribute.java @@ -0,0 +1,55 @@ +/* PrintRequestAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * Marker interface for all attribute classes which specify a requested + * attribute of {@link javax.print.DocPrintJob} object. + *

+ * Instances of implementing attribute classes may be collected in a + * {@link javax.print.attribute.PrintRequestAttributeSet}. + *

+ * + * @see javax.print.attribute.PrintRequestAttributeSet + * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintRequestAttribute extends Attribute +{ + // Marker interface +} diff --git a/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java new file mode 100644 index 000000000..60098064f --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintRequestAttributeSet.java @@ -0,0 +1,82 @@ +/* PrintRequestAttributeSet.java -- + Copyright (C) 2002, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * PrintRequestAttributeSet specifies an attribute set which only + * allows printing attributes of type + * {@link javax.print.attribute.PrintRequestAttribute}. + *

+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are + * respecified in this interface to indicate that only + * PrintRequestAttribute instances are allowed in this set. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintRequestAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if attribute is not of type + * PrintRequestAttribute. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if one of the attributes is not of type + * PrintRequestAttribute. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + boolean addAll (AttributeSet attributes); +} diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java new file mode 100644 index 000000000..82d26922a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintServiceAttribute.java @@ -0,0 +1,60 @@ +/* PrintServiceAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * Marker interface for all attribute classes describing parameters + * or the status of a {@link javax.print.PrintService}. + *

+ * Instances of implementing attribute classes may be collected in a + * {@link javax.print.attribute.PrintServiceAttributeSet}. + *

+ * A print service uses attributes of this type to inform about the status + * or the specific capabilities of itself. + * For example {@link javax.print.attribute.standard.PagesPerMinute} is used + * to specify the average printable pages per minute of the print service. + *

+ * + * @see javax.print.attribute.PrintServiceAttributeSet + * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintServiceAttribute extends Attribute +{ + // Marker interface +} diff --git a/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java new file mode 100644 index 000000000..418a59950 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/PrintServiceAttributeSet.java @@ -0,0 +1,82 @@ +/* PrintServiceAttributeSet.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * PrintServiceAttributeSet specifies an attribute set which only + * allows printing attributes of type + * {@link javax.print.attribute.PrintServiceAttribute}. + *

+ * The methods {@link #add(Attribute)} and {@link #addAll(AttributeSet)} are + * respecified in this interface to indicate that only + * PrintServiceAttribute instances are allowed in this set. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface PrintServiceAttributeSet extends AttributeSet +{ + /** + * Adds the specified attribute value to this attribute set + * if it is not already present. + * + * This operation removes any existing attribute of the same category + * before adding the given attribute. + * + * @param attribute the attribute to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if attribute is not of type + * PrintServiceAttribute. + * @throws NullPointerException if the attribute is null. + * @throws UnmodifiableSetException if the set does not support modification. + */ + boolean add (Attribute attribute); + + /** + * Adds all of the elements in the specified set to this attribute set. + * + * @param attributes the set of attributes to add. + * @return true if the set is changed, false otherwise. + * @throws ClassCastException if one of the attributes is not of type + * PrintServiceAttribute. + * @throws UnmodifiableSetException if the set does not support modification. + * + * @see #add(Attribute) + */ + boolean addAll (AttributeSet attributes); +} diff --git a/libjava/classpath/javax/print/attribute/ResolutionSyntax.java b/libjava/classpath/javax/print/attribute/ResolutionSyntax.java new file mode 100644 index 000000000..54468d087 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/ResolutionSyntax.java @@ -0,0 +1,271 @@ +/* ResolutionSyntax.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * ResolutionSyntax is the abstract base class of all attribute + * classes which provide a resolution as value (e.g. printer resolution). + *

+ * A ResolutionSyntax instance consists of two integer values + * describing the resolution in feed and cross feed direction. The units of + * the given values is determined by two defined constants: + *

+ *

+ *

+ * A resolutions attribute is constructed by two values for the resolution and + * one of the two constants defining the actual units of the given values. + *

+ *

+ * There are different methods provided to return the resolution values in + * either of the both units and to compare if a resolution is less than or + * equal to a given other resolution attribute. + *

+ *

+ * Internal storage:
+ * The resolutions are stored internally as dots per 100 inches (dphi). The + * values of the provided constants for dots per inch (value 100) and dots + * per centimeter (value 254) are used as conversion factors to the internal + * storage units. To get the internal dphi values a multiplication of a given + * resolution value with its units constant value is needed. Retrieving the + * resolution for specific units is done by dividing the internal stored + * value through the units constant value. Clients are therefore able to + * provide their own resolution units by supplying other conversion factors. + * Subclasses of ResolutionSyntax have access to the internal + * resolution values through the protected methods + * {@link #getCrossFeedResolutionDphi()} and {@link #getFeedResolutionDphi()}. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class ResolutionSyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = 2706743076526672017L; + + /** + * Constant for units of dots per centimeter. + */ + public static final int DPCM = 254; + + /** + * Constant for units of dots per inch + */ + public static final int DPI = 100; + + private int crossFeedResolution; + private int feedResolution; + + /** + * Creates a ResolutionSyntax object with the given arguments. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * + * @exception IllegalArgumentException if preconditions fail + */ + public ResolutionSyntax(int crossFeedResolution, int feedResolution, + int units) + { + if (crossFeedResolution < 1 + || feedResolution < 1 + || units < 1) + throw new IllegalArgumentException("no argument may be less than 1"); + + this.crossFeedResolution = crossFeedResolution * units; + this.feedResolution = feedResolution * units; + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof ResolutionSyntax)) + return false; + + ResolutionSyntax tmp = (ResolutionSyntax) obj; + + return (crossFeedResolution == tmp.getCrossFeedResolutionDphi() + && feedResolution == tmp.getFeedResolutionDphi()); + } + + /** + * Returns the cross feed resolution for the given units. + * + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * @return The resolution for the given units. + * + * @exception IllegalArgumentException if units < 1 + */ + public int getCrossFeedResolution(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return crossFeedResolution / units; + } + + /** + * Returns the raw cross feed resolution in dots per 100 inches. + * + * @return The raw resolution. + */ + protected int getCrossFeedResolutionDphi() + { + return crossFeedResolution; + } + + /** + * Returns the feed resolution for the given units. + * + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * @return The resolution for the given units. + * + * @exception IllegalArgumentException if units < 1 + */ + public int getFeedResolution(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return feedResolution / units; + } + + /** + * Returns the raw feed resolution in dots per 100 inches. + * + * @return The raw resolution. + */ + protected int getFeedResolutionDphi() + { + return feedResolution; + } + + /** + * Returns the resolution as two field array. Index 0 is the cross feed + * resolution, index 1 the feed resolution. + * + * @param units the units to use + * + * @return The array with the resolutions. + */ + public int[] getResolution(int units) + { + int[] resolution = new int[2]; + resolution[0] = getCrossFeedResolution(units); + resolution[1] = getFeedResolution(units); + return resolution; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return crossFeedResolution + feedResolution; + } + + /** + * Checks if the given resolution attribute is a lower or equal + * to this resolution object. + * + * @param other the resolution to check against + * + * @return true if other resolution attribute describes + * a lower or equal resolution, false otherwise. + */ + public boolean lessThanOrEquals(ResolutionSyntax other) + { + if (other == null) + throw new NullPointerException("other may not be null"); + + return (crossFeedResolution <= other.getCrossFeedResolutionDphi() + && feedResolution <= other.getFeedResolutionDphi()); + } + + /** + * Returns the string representation for this object. + *

+ * The returned string is in the form "CxF dphi" with C standing + * for the cross feed and F for the feed direction resolution. + * Units used are dots per 100 inches (dphi). + *

+ * @return The string representation. + */ + public String toString() + { + return toString(1, "dphi"); + } + + /** + * Returns the string representation for this object. + *

+ * The returned string is in the form "CxF U" with C standing + * for the cross feed and F for the feed direction resolution. + * U denotes the units name if one is supplied. + *

+ * + * @param units the units to use + * @param unitsName the name of the units. If null + * it is ommitted from the string representation. + * + * @return The string representation. + */ + public String toString(int units, String unitsName) + { + if (unitsName == null) + return getCrossFeedResolution(units) + "x" + getFeedResolution(units); + + return ("" + getCrossFeedResolution(units) + + "x" + getFeedResolution(units) + + " " + unitsName); + } +} diff --git a/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java new file mode 100644 index 000000000..b1e0af1a7 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/SetOfIntegerSyntax.java @@ -0,0 +1,436 @@ +/* SetOfIntegerSyntax.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; +import java.text.CharacterIterator; +import java.text.StringCharacterIterator; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Comparator; + +/** + * SetOfIntegerSyntax is the abstract base class of all attribute + * classes which provide a set of non-negative integers as value (e.g. the + * page ranges to print) represented as single values or ranges of values. + *

+ * A SetOfIntegerSyntax instance consists of an integer array of + * ranges. Ranges may have the same lower and upper bound representing a single + * integer value. Ranges with a lower bound greater than the upper bound are + * null ranges and discarded. Ranges may overlap in their values. In no case + * negative integers are allowed. + *

+ *

+ * There are several constructors available: + *

+ *

+ *

+ * Internal storage:
+ * The set of integers are stored internally in a normalized array form. + * In the normalized array form the set of integer ranges are represented + * in as few ranges as possible and overlapping ranges are merged. The ranges + * are always represented as an integer array of length two with ranges + * stored in {lower bound, upper bound} form. The ranges are stored in + * ascending order, without any null ranges. + *

+ * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class SetOfIntegerSyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = 3666874174847632203L; + + private int[][] members; + + private static int[][] normalize(int[][] values, int size) + { + // Sort into increasing order. First the first index is + // compared, then the second. + Arrays.sort(values, 0, size, new Comparator() + { + public int compare(Object o1, Object o2) + { + int[] v1 = (int[]) o1; + int[] v2 = (int[]) o2; + if (v1[0] == v2[0]) + return v1[1] - v2[1]; + return v1[0] - v2[0]; + } + }); + + // Now coalesce overlapping ranges. + int outIndex = 0; + for (int i = 0; i < size; ++i) + { + // Note that we compare with values[i][1]+1, since + // we can coalesce {0,1} with {2,x}. + int save = i; + while (i + 1 < size && values[i + 1][0] <= values[i][1] + 1) + { + values[i][1] = Math.max(values[i][1], values[i + 1][1]); + ++i; + } + values[outIndex++] = values[save]; + } + + int[][] result = new int[outIndex][]; + System.arraycopy(values, 0, result, 0, outIndex); + + return result; + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param member the member value + * + * @exception IllegalArgumentException if member is < 0 + */ + protected SetOfIntegerSyntax(int member) + { + if (member < 0) + throw new IllegalArgumentException("member may not be less than 0"); + + this.members = new int[][]{{member, member}}; + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param members the members to use in this set. If + * null an empty set is created. + * + * @exception IllegalArgumentException if any element is invalid + * @exception NullPointerException if any element of members is null + */ + protected SetOfIntegerSyntax(int[][] members) + { + int[][] newMembers; + int outIndex = 0; + if (members == null) + newMembers = new int[0][]; + else + { + newMembers = new int[members.length][]; + for (int index = 0; index < members.length; index++) + { + int lower; + int upper; + + if (members[index].length == 1) + { + lower = members[index][0]; + upper = members[index][0]; + } + else if (members[index].length == 2) + { + lower = members[index][0]; + upper = members[index][1]; + } + else + throw new IllegalArgumentException("invalid member element"); + + // We only want to reject non-null ranges where lower<0. + if (lower <= upper && lower < 0) + throw new IllegalArgumentException("invalid member element"); + + if (lower <= upper) + { + int[] range = new int[2]; + range[0] = lower; + range[1] = upper; + newMembers[outIndex++] = range; + } + } + } + + this.members = normalize(newMembers, outIndex); + } + + private boolean skipWhitespace(StringCharacterIterator i) + { + while (Character.isWhitespace(i.current())) + i.next(); + return i.current() == CharacterIterator.DONE; + } + + private boolean skipNumber(StringCharacterIterator i) + { + boolean readAny = false; + while (Character.isDigit(i.current())) + { + readAny = true; + i.next(); + } + return readAny; + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param s the members to use in this set in string form. If + * null an empty set is created. + * + * @exception IllegalArgumentException if any element is invalid + */ + protected SetOfIntegerSyntax(String s) + { + if (s == null) + this.members = normalize(new int[0][], 0); + else + { + ArrayList vals = new ArrayList(); + + StringCharacterIterator it = new StringCharacterIterator(s); + + while (true) + { + // Skip whitespace. + if (skipWhitespace(it)) + break; + + // Parse integer. + int index = it.getIndex(); + if (! skipNumber(it)) + throw new IllegalArgumentException(); + int[] item = new int[2]; + item[0] = Integer.parseInt(s.substring(index, it.getIndex())); + + if (! skipWhitespace(it)) + { + char c = it.current(); + if (c == ':' || c == '-') + { + it.next(); + if (skipWhitespace(it)) + throw new IllegalArgumentException(); + index = it.getIndex(); + if (! skipNumber(it)) + throw new IllegalArgumentException(); + item[1] = Integer.parseInt(s.substring(index, it.getIndex())); + } + else + item[1] = item[0]; + } + else + item[1] = item[0]; + + if (item[0] <= item[1]) + vals.add(item); + + if (skipWhitespace(it)) + break; + if (it.current() != ',') + throw new IllegalArgumentException(); + it.next(); + } + + members = normalize((int[][]) vals.toArray(new int[0][]), vals.size()); + } + } + + /** + * Creates a SetOfIntegerSyntax object. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 0 + */ + protected SetOfIntegerSyntax(int lowerBound, int upperBound) + { + // We only want to reject non-null ranges where lower<0. + if (lowerBound <= upperBound + && lowerBound < 0) + throw new IllegalArgumentException(); + + members = (lowerBound <= upperBound ? new int[][]{{lowerBound, upperBound}} + : new int[0][]); + } + + /** + * Checks if this set contains the given value. + * + * @param value the value to test for + * + * @return true if this set contains value, false otherwise + */ + public boolean contains(int value) + { + // This only works on a normalized member array. + for (int index = 0; index < members.length; index++) + { + if (value < members[index][0]) + return false; + else if (value <= members[index][1]) + return true; + } + + return false; + } + + /** + * Checks if this set contains the given value. + * + * @param value the value to test for + * + * @return true if this set contains value, false otherwise + */ + public boolean contains(IntegerSyntax value) + { + return contains(value.getValue()); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof SetOfIntegerSyntax)) + return false; + SetOfIntegerSyntax other = (SetOfIntegerSyntax) obj; + if (other.members.length != members.length) + return false; + for (int i = 0; i < members.length; ++i) + { + if (members[i][0] != other.members[i][0] + || members[i][1] != other.members[i][1]) + return false; + } + return true; + } + + /** + * Returns an array describing the members included in this set. + * + * @return The members in normalized array form. + */ + public int[][] getMembers() + { + return (int[][]) members.clone(); + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + int result = 0; + for (int i = 0; i < members.length; ++i) + result += members[i][0] + members[i][1]; + return result; + } + + /** + * Returns the smallest value that is greater than x which is in this set. + * + * @param x an integer value + * + * @return The next smallest integer value, or -1 if there + * is no greater integer in the set. + */ + public int next(int x) + { + for (int i = 0; i < members.length; ++i) + { + if (x >= members[i][1]) + continue; + if (x < members[i][0]) + return members[i][0]; + // X is in this range. + return x + 1; + } + return -1; + } + + /** + * Returns the string representation for this object. + * The value is a zero length string for an empty set, or a comma seperated + * list of ranges and single values in the form "1-2,5-7,10". + * + * @return The string representation. + */ + public String toString() + { + StringBuilder sb = new StringBuilder(); + for (int i = 0; i < members.length; ++i) + { + if (i > 0) + sb.append(','); + sb.append(members[i][0]); + if (members[i][0] != members[i][1]) + { + sb.append('-'); + sb.append(members[i][1]); + } + } + return sb.toString(); + } +} diff --git a/libjava/classpath/javax/print/attribute/Size2DSyntax.java b/libjava/classpath/javax/print/attribute/Size2DSyntax.java new file mode 100644 index 000000000..b9e0e25db --- /dev/null +++ b/libjava/classpath/javax/print/attribute/Size2DSyntax.java @@ -0,0 +1,283 @@ +/* Size2DSyntax.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; + +/** + * Size2DSyntax is the abstract base class of all attribute + * classes which provide a two dimensional size as value (e.g. the size of + * a media like Letter or A4). + *

+ * A Size2DSyntax instance consists of two integer values + * describing the size in the x and y dimension. The units of + * the given values is determined by two defined constants: + *

+ *

+ *

+ * A size 2D attribute is constructed by two values for the size of the x and + * y dimension and the actual units of the given values as defined by the + * constants. + *

+ *

+ * There are different methods provided to return the size values for the + * dimensions in either of the two predefined units or with a given client + * supplied units conversion factor. + *

+ *

+ * Internal storage:
+ * The size of the x,y dimensions are stored internally in micrometers. The + * values of the provided constants for inch (value 25400) and millimeters + * (value 1000) are used as conversion factors to the internal storage units. + * To get the internal micrometers values a multiplication of a given + * size value with its units constant value is done. Retrieving the size value + * for specific units is done by dividing the internal stored value by the + * units constant value. Clients are therefore able to provide their own + * size units by supplying other conversion factors. + * Subclasses of Size2DSyntax have access to the internal + * size values through the protected methods + * {@link #getXMicrometers()} and {@link #getYMicrometers()}. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class Size2DSyntax implements Cloneable, Serializable +{ + /** + * Constant for the units of inches. + * The actual value is the conversion factor to micrometers. + */ + public static final int INCH = 25400; + + /** + * Constant for the units of millimeters. + * The actual value is the conversion factor to micrometers. + */ + public static final int MM = 1000; + + /** x size in micrometers. */ + private int x; + /** y size in micrometers. */ + private int y; + + /** + * Creates a Size2DSyntax object with the given arguments. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + */ + protected Size2DSyntax(float x, float y, int units) + { + if (x < 0.0f || y < 0.0f) + throw new IllegalArgumentException("x and/or y may not be less than 0"); + + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + this.x = (int) (x * units + 0.5f); + this.y = (int) (y * units + 0.5f); + } + + /** + * Creates a Size2DSyntax object with the given arguments. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + */ + protected Size2DSyntax(int x, int y, int units) + { + if (x < 0 || y < 0) + throw new IllegalArgumentException("x and/or y may not be less then 0"); + + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + this.x = x * units; + this.y = y * units; + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof Size2DSyntax)) + return false; + + Size2DSyntax tmp = (Size2DSyntax) obj; + + return (x == tmp.getXMicrometers() + && y == tmp.getYMicrometers()); + } + + /** + * Returns the size described in this object as a two field array. + * Index 0 contains the size in x direction, index 1 the size in + * y direction. + * + * @param units the units to use + * + * @return The array with the size dimensions. + * + * @exception IllegalArgumentException if units < 1 + */ + public float[] getSize(int units) + { + float[] size = new float[2]; + size[0] = getX(units); + size[1] = getY(units); + return size; + } + + /** + * Returns the size in x direction. + * + * @param units the units to use + * + * @return The size in x direction. + * + * @exception IllegalArgumentException if units < 1 + */ + public float getX(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return ((float) x) / ((float) units); + } + + /** + * Returns the size in x direction in mircometers. + * To be used by sublcasses that need access to the internal storage value. + * + * @return The size in x direction in micrometers. + */ + protected int getXMicrometers() + { + return x; + } + + /** + * Return the size in y direction. + * + * @param units the units to use + * + * @return The size in y direction. + * + * @exception IllegalArgumentException if units < 1 + */ + public float getY(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + return ((float) y) / ((float) units); + } + + /** + * Returns the size in y direction in mircometers. + * To be used by sublcasses that need access to the internal storage value. + * + * @return The size in y direction in micrometers. + */ + protected int getYMicrometers() + { + return y; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return x + y; + } + + /** + * Returns the string representation for this object. + *

+ * The returned string is in the form "XxY um" with X standing + * for size in x and Y for the size in y direction. The used + * micrometers units is indicated by the appended "um" notation. + *

+ * + * @return The string representation in micrometers. + */ + public String toString() + { + return getXMicrometers() + "x" + getYMicrometers() + " um"; + } + + /** + * Returns the string representation for this object. + *

+ * The returned string is in the form "XxY U" with X standing + * for size in x and Y for the size in y direction. U denotes + * the units name if one is supplied. The values are given as + * floating point values. + *

+ * + * @param units the units to use + * @param unitsName the name of the units. If null + * it is ommitted from the string representation. + * + * @return The string representation. + */ + public String toString(int units, String unitsName) + { + if (unitsName == null) + return getX(units) + "x" + getY(units); + + return getX(units) + "x" + getY(units) + " " + unitsName; + } +} diff --git a/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java new file mode 100644 index 000000000..5380b4609 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/SupportedValuesAttribute.java @@ -0,0 +1,59 @@ +/* SupportedValuesAttribute.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +/** + * Marker interface for all attribute classes specifying the + * supported/allowed values for another printing attribute class. + *

+ * A {@link javax.print.PrintService} instance for example provides + * printing attribute classes implementing this interface to indicate + * that a specific attribute type is supported and if the supported values. + *

+ * E.g. a {@link javax.print.attribute.standard.JobPrioritySupported} + * instance indicates that the attribute class + * {@link javax.print.attribute.standard.JobPriority} is supported and + * provides the number of the possible priority levels. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public interface SupportedValuesAttribute extends Attribute +{ + // Marker interface +} diff --git a/libjava/classpath/javax/print/attribute/TextSyntax.java b/libjava/classpath/javax/print/attribute/TextSyntax.java new file mode 100644 index 000000000..43e3a9d30 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/TextSyntax.java @@ -0,0 +1,137 @@ +/* TextSyntax.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; +import java.util.Locale; + +/** + * TextSyntax is the abstract base class of all attribute + * classes which provide a string as value (e.g. the location of the printer). + *

+ * A TextSyntax instance consists of a string value and a + * locale which indicates the language of the locale of the string. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class TextSyntax implements Cloneable, Serializable +{ + private static final long serialVersionUID = -8130648736378144102L; + + private String value; + private Locale locale; + + /** + * Creates a TextSyntax object with the given value + * and locale. + * + * @param value the value for this syntax + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if value is null + */ + protected TextSyntax(String value, Locale locale) + { + if (value == null) + throw new NullPointerException("value may not be null"); + + this.value = value; + this.locale = (locale == null ? Locale.getDefault() : locale); + } + + /** + * Returns the value of this syntax object. + * + * @return The value. + */ + public String getValue() + { + return value; + } + + /** + * Returns the locale of this syntax object. + * + * @return The locale. + */ + public Locale getLocale() + { + return locale; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return value.hashCode() ^ locale.hashCode(); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof TextSyntax)) + return false; + + TextSyntax tmp = (TextSyntax) obj; + + return (value.equals(tmp.getValue()) + && locale.equals(tmp.getLocale())); + } + + /** + * Returns a string representing the object. The returned + * string is the underlying text value of this object. + * + * @return The string representation. + */ + public String toString() + { + return getValue(); + } +} diff --git a/libjava/classpath/javax/print/attribute/URISyntax.java b/libjava/classpath/javax/print/attribute/URISyntax.java new file mode 100644 index 000000000..a0903a46c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/URISyntax.java @@ -0,0 +1,116 @@ +/* URISyntax.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute; + +import java.io.Serializable; +import java.net.URI; + +/** + * URISyntax is the abstract base class of all attribute + * classes having an Uniform Resource Identifier URI as value. + * + * @author Michael Koch (konqueror@gmx.de) + */ +public abstract class URISyntax + implements Cloneable, Serializable +{ + private static final long serialVersionUID = -7842661210486401678L; + + private URI uri; + + /** + * Creates a URISyntax object. + * + * @param uri the URI value for the syntax + * + * @exception NullPointerException if uri is null + */ + protected URISyntax(URI uri) + { + if (uri == null) + throw new NullPointerException("uri may not be null"); + + this.uri = uri; + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof URISyntax)) + return false; + + return uri.equals(((URISyntax) obj).getURI()); + } + + /** + * Returns the URI value of this syntax object. + * + * @return The URI. + */ + public URI getURI() + { + return uri; + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return uri.hashCode(); + } + + /** + * Returns the string representation for this object. + * + * @return The string representation. + */ + public String toString() + { + return uri.toString(); + } +} diff --git a/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java new file mode 100644 index 000000000..6712266b9 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/UnmodifiableSetException.java @@ -0,0 +1,69 @@ +/* UnmodifiableSetException.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute; + +/** + * Exception which is thrown if an operation on an unmodifiable set + * is invoked. + * + * @author Michael Koch (konqueror@gmx.de) + * + * @since 1.4 + */ +public class UnmodifiableSetException extends RuntimeException +{ + /** + * Creates a UnmodifiableSetException. + */ + public UnmodifiableSetException() + { + super(); + } + + /** + * Creates a UnmodifiableSetException + * with the given message. + * + * @param message the message of the exception + */ + public UnmodifiableSetException(String message) + { + super(message); + } +} diff --git a/libjava/classpath/javax/print/attribute/package.html b/libjava/classpath/javax/print/attribute/package.html new file mode 100644 index 000000000..0ab01ab1b --- /dev/null +++ b/libjava/classpath/javax/print/attribute/package.html @@ -0,0 +1,78 @@ + + + + +GNU Classpath - javax.print.attribute + + +

Provides classes and interfaces describing the roles and +syntax of attribute objects in the Java Print Service API.

+

+The package contains the base attribute interface and several subinterfaces +describing the different attribute roles of printing attributes. Furthermore, +abstract classes defining the syntax of attributes are provided. For +collections of attributes based on their roles different set interfaces and +implementing classes are available. +

+Existing attribute roles are: +

+

+Every attribute is of a certain syntax which defines its type and the +representation of its value. The different syntax types are provided as +abstract syntax classes (e.g. IntegerSyntax). Concrete attribute +implementations are subclasses of these abstract syntax classes. +

+Attributes may be collected as sets of attributes. Different interfaces for +attribute collections per role and implementations based on a HashMap are +provided (for example +HashPrintJobAttributeSet for the print job attributes). +

+

+Since: 1.4 +

+ + diff --git a/libjava/classpath/javax/print/attribute/standard/Chromaticity.java b/libjava/classpath/javax/print/attribute/standard/Chromaticity.java new file mode 100644 index 000000000..619341f31 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Chromaticity.java @@ -0,0 +1,134 @@ +/* Chromaticity.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The Chromaticity printing attribute specifies if print data + * should be printed in monochrome or color. + *

+ * The attribute interacts with the document to be printed. If the document + * to be printed is a monochrome document it will be printed monochrome + * regardless of the value of this attribute category. However if it is a + * color document supplying the attribute value MONOCHROME + * will prepare the document to be printed in monochrome instead of color. + *

+ *

+ * This printing attribute has nothing to do with the capabilities of the + * printer device. To check if a specific printer service supports printing + * in color you have to use the attribute + * {@link javax.print.attribute.standard.ColorSupported} + *

+ *

+ * IPP Compatibility: Chromaticity is not an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class Chromaticity extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = 4660543931355214012L; + + /** Specifies monochrome printing. */ + public static final Chromaticity MONOCHROME = new Chromaticity(0); + + /** Specifies color printing. */ + public static final Chromaticity COLOR = new Chromaticity(1); + + private static final String[] stringTable = { "monochrome", "color" }; + private static final Chromaticity[] enumValueTable = { MONOCHROME, COLOR }; + + /** + * Creates a Chromaticity object. + * + * @param value the enum value + */ + protected Chromaticity(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class Chromaticity itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Chromaticity.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "chromaticity". + */ + public String getName() + { + return "chromaticity"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + +} diff --git a/libjava/classpath/javax/print/attribute/standard/ColorSupported.java b/libjava/classpath/javax/print/attribute/standard/ColorSupported.java new file mode 100644 index 000000000..2fa8fd728 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/ColorSupported.java @@ -0,0 +1,127 @@ +/* ColorSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintServiceAttribute; + + +/** + * The ColorSupported printing attribute specifies if a + * printing device is capable of color printing. + *

+ * This attributes just tells if a printer device supports color printing + * but does not specify how a specific print job is printed. Therefore the + * attribute {@link javax.print.attribute.standard.Chromaticity} exists. + *

+ *

+ * IPP Compatibility: ColorSupported is an IPP 1.1 attribute. The IPP + * specification treats ColorSupported as a boolean type which is not available + * in the Java Print Service API. The IPP boolean value true corresponds + * to SUPPORTED and "false" to NOT_SUPPORTED. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class ColorSupported extends EnumSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -2700555589688535545L; + + /** The printer does not support printing in color. */ + public static final ColorSupported NOT_SUPPORTED = new ColorSupported(0); + + /** The printer supports printing in color. */ + public static final ColorSupported SUPPORTED = new ColorSupported(1); + + private static final String[] stringTable = { "not-supported", "supported" }; + private static final ColorSupported[] enumValueTable = { NOT_SUPPORTED, + SUPPORTED }; + + /** + * Constructs a ColorSupported object. + * + * @param value the enum value + */ + protected ColorSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class ColorSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return ColorSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "color-supported". + */ + public String getName() + { + return "color-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Compression.java b/libjava/classpath/javax/print/attribute/standard/Compression.java new file mode 100644 index 000000000..412ed5af9 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Compression.java @@ -0,0 +1,130 @@ +/* Compression.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The Compression printing attribute specifies if and how the + * supplied print data is compressed. + *

+ * If this attribute is ommitted from the attributes set of the print + * data it is assumed that no compression is done. + *

+ *

+ * IPP Compatibility: Compression is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public class Compression extends EnumSyntax + implements DocAttribute +{ + private static final long serialVersionUID = -5716748913324997674L; + + /** The print data is not compressed. */ + public static final Compression NONE = new Compression(0); + + /** The print data is ZIP compressed. */ + public static final Compression DEFLATE = new Compression(1); + + /** The print data is GNU Zip compressed. */ + public static final Compression GZIP = new Compression(2); + + /** The print data is UNIX compressed. */ + public static final Compression COMPRESS = new Compression(3); + + private static final String[] stringTable = { "none", "deflate", + "gzip", "compress" }; + private static final Compression[] enumValueTable = { NONE, DEFLATE, + GZIP, COMPRESS }; + + /** + * Constructs a Compression object. + * + * @param value the enum value + */ + protected Compression(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class Compression itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Compression.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "compression". + */ + public final String getName() + { + return "compression"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Copies.java b/libjava/classpath/javax/print/attribute/standard/Copies.java new file mode 100644 index 000000000..c4bc2496a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Copies.java @@ -0,0 +1,115 @@ +/* Copies.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The Copies printing attribute specifies the number + * of copies to be printed. + *

+ * Note: The effect of this attribute on jobs with multiple documents + * is controlled by the job attribute + * {@link javax.print.attribute.standard.MultipleDocumentHandling}. + *

+ *

+ * IPP Compatibility: Copies is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.MultipleDocumentHandling + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class Copies extends IntegerSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -6426631521680023833L; + + /** + * Creates a Copies object. + * + * @param value the number of copies + * + * @exception IllegalArgumentException if value < 1 + */ + public Copies(int value) + { + super(value); + + if (value < 1) + throw new IllegalArgumentException("value may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof Copies)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class Copies itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Copies.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "copies". + */ + public String getName() + { + return "copies"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/CopiesSupported.java b/libjava/classpath/javax/print/attribute/standard/CopiesSupported.java new file mode 100644 index 000000000..d8af8eb57 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/CopiesSupported.java @@ -0,0 +1,130 @@ +/* CopiesSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.SetOfIntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The CopiesSupported attribute specifies the supported + * value or range of values for the + * {@link javax.print.attribute.standard.Copies} attribute. + *

+ * IPP Compatibility: CopiesSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class CopiesSupported extends SetOfIntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = 6927711687034846001L; + + /** + * Constructs a CopiesSupported object with + * the given value. This means that only this value is + * supported for copies. + * + * @param member the member value + * @exception IllegalArgumentException if member is < 1 + */ + public CopiesSupported(int member) + { + super(member); + + if (member < 1) + throw new IllegalArgumentException("member may not be less than 1"); + } + + /** + * Constructs a CopiesSupported object with + * the given range of values. This means that values for + * copies are supported inside the specified range. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound < 1 + */ + public CopiesSupported(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerBound may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof CopiesSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class CopiesSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return CopiesSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "copies-supported". + */ + public String getName() + { + return "copies-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/DateTimeAtCompleted.java b/libjava/classpath/javax/print/attribute/standard/DateTimeAtCompleted.java new file mode 100644 index 000000000..285fc0d3f --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/DateTimeAtCompleted.java @@ -0,0 +1,110 @@ +/* DateTimeAtCompleted.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Date; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The DateTimeAtCompleted attribute specifies the date and + * the time at which a print job completed (or was canceled or aborted). + *

+ * IPP Compatibility: DateTimeAtCompleted is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.DateTimeAtCreation + * @see javax.print.attribute.standard.DateTimeAtProcessing + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class DateTimeAtCompleted extends DateTimeSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 6497399708058490000L; + + /** + * Creates a DateTimeAtCompleted object. + * + * @param value the date at completion time + * + * @exception NullPointerException if value is null + */ + public DateTimeAtCompleted(Date value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof DateTimeAtCompleted)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class DateTimeAtCompleted itself. + */ + public Class< ? extends Attribute> getCategory() + { + return DateTimeAtCompleted.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "date-time-at-completed". + */ + public String getName() + { + return "date-time-at-completed"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/DateTimeAtCreation.java b/libjava/classpath/javax/print/attribute/standard/DateTimeAtCreation.java new file mode 100644 index 000000000..60b885ad1 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/DateTimeAtCreation.java @@ -0,0 +1,110 @@ +/* DateTimeAtCreation.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Date; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The DateTimeAtCreation attribute specifies the + * date and the time at which a print job was created. + *

+ * IPP Compatibility: DateTimeAtCreation is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.DateTimeAtCompleted + * @see javax.print.attribute.standard.DateTimeAtProcessing + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class DateTimeAtCreation extends DateTimeSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = -2923732231056647903L; + + /** + * Creates a DateTimeAtCreation object. + * + * @param value the date at creation time + * + * @exception NullPointerException if value is null + */ + public DateTimeAtCreation(Date value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof DateTimeAtCreation)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class DateTimeAtCreation itself. + */ + public Class< ? extends Attribute> getCategory() + { + return DateTimeAtCreation.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "date-time-at-creation". + */ + public String getName() + { + return "date-time-at-creation"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/DateTimeAtProcessing.java b/libjava/classpath/javax/print/attribute/standard/DateTimeAtProcessing.java new file mode 100644 index 000000000..733c56589 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/DateTimeAtProcessing.java @@ -0,0 +1,110 @@ +/* DateTimeAtProcessing.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Date; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The DateTimeAtProcessing attribute specifies the date + * and the time at which a print job started processing. + *

+ * IPP Compatibility: DateTimeAtProcessing is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.DateTimeAtCompleted + * @see javax.print.attribute.standard.DateTimeAtCreation + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class DateTimeAtProcessing extends DateTimeSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = -3710068197278263244L; + + /** + * Creates a DateTimeAtProcessing object. + * + * @param value the date at processing time + * + * @exception NullPointerException if value is null + */ + public DateTimeAtProcessing(Date value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof DateTimeAtProcessing)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class DateTimeAtProcessing itself. + */ + public Class< ? extends Attribute> getCategory() + { + return DateTimeAtProcessing.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "date-time-at-processing". + */ + public String getName() + { + return "date-time-at-processing"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Destination.java b/libjava/classpath/javax/print/attribute/standard/Destination.java new file mode 100644 index 000000000..d37340a9e --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Destination.java @@ -0,0 +1,122 @@ +/* Destination.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.URISyntax; + +/** + * The Destination attribute provides a URI for an alternate + * destination of the printing output. + *

+ * As not an IPP attribute many print services will not support this + * attribute and only provide the printer device as a destination. + * An alternate output destination would be a file on the local harddisk + * given as a file scheme URI. + *

+ *

+ * If a print service does not support the destination attributes URI it + * will throw a PrintException. This exception may further implement the + * interface {@link javax.print.URIException}. + *

+ *

+ * IPP Compatibility: Destination is not an IPP 1.1 attribute. + *

+ * @see javax.print.PrintException + * @see javax.print.URIException + * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class Destination extends URISyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 6776739171700415321L; + + /** + * Constructs a Destination object. + * + * @param uri the URI of the output destination. + * @throws NullPointerException if the given uri is null. + */ + public Destination(URI uri) + { + super(uri); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof Destination)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class Destination itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Destination.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "spool-data-destination" + */ + public String getName() + { + return "spool-data-destination"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/DocumentName.java b/libjava/classpath/javax/print/attribute/standard/DocumentName.java new file mode 100644 index 000000000..f6f792725 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/DocumentName.java @@ -0,0 +1,116 @@ +/* DocumentName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The DocumentName printing attribute specifies a document name. + *

+ * The document name may be different than the name of the job. It must not be + * unique across multiple documents in the same print job. Normally, an + * application provides the document name for the user by using e.g. the file + * name or a name generated automatically by the application. + *

+ *

+ * IPP Compatibility: DocumentName is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobName + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class DocumentName extends TextSyntax + implements DocAttribute +{ + private static final long serialVersionUID = 7883105848533280430L; + + /** + * Creates a DocumentName object. + * + * @param documentName the document name + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if documentName is null + */ + public DocumentName(String documentName, Locale locale) + { + super(documentName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof DocumentName)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class DocumentName itself. + */ + public Class< ? extends Attribute> getCategory() + { + return DocumentName.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "document-name". + */ + public String getName() + { + return "document-name"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Fidelity.java b/libjava/classpath/javax/print/attribute/standard/Fidelity.java new file mode 100644 index 000000000..39d26a127 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Fidelity.java @@ -0,0 +1,146 @@ +/* Fidelity.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The Fidelity attribute specifies how a print job is handled + * if the supplied attributes are not fully supported. + *

+ * There may be conflicts between the client requested attributes and the + * attributes supported by the printer object. Such situations are controlled + * through the client by providing this attribute to indicate the wanted + * conflict handling mechanism: + *

+ *

+ *

+ * IPP Compatibility: Fidelity is an IPP 1.1 attribute. The IPP name + * is "ipp-attribute-fidelity". The IPP specification treats Fidelity as a + * boolean type which is not available in the Java Print Service API. The IPP + * boolean value "true" corresponds to FIDELITY_TRUE and "false" + * to FIDELITY_FALSE. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class Fidelity extends EnumSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 6320827847329172308L; + + /** + * Requests that the job is printed exactly as specified, + * or rejected otherwise. + */ + public static final Fidelity FIDELITY_TRUE = new Fidelity(0); + + /** + * Requests that the job is printed as exactly as reasonable. This means + * that the print service may choose to substitute the default value + * associated with that attribute, or use some other supported value that + * is similar to the unsupported requested value. + */ + public static final Fidelity FIDELITY_FALSE = new Fidelity(1); + + private static final String[] stringTable = { "true", "false" }; + private static final Fidelity[] enumValueTable = { FIDELITY_TRUE, + FIDELITY_FALSE }; + + /** + * Constructs a Fidelity object. + * + * @param value the value + */ + protected Fidelity(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class Fidelity itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Fidelity.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "ipp-attribute-fidelity". + */ + public String getName() + { + return "ipp-attribute-fidelity"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Finishings.java b/libjava/classpath/javax/print/attribute/standard/Finishings.java new file mode 100644 index 000000000..bb38cebc4 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Finishings.java @@ -0,0 +1,287 @@ +/* Finishings.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The Finishings attribute specifies the finishing operations + * that the Printer applies to every copy of each printed document in the Job. + *

+ * Standard enum values are: NONE, STAPLE, + * COVER, BIND, SADDLE_STITCH, + * EDGE_STITCH. + *

+ * The following values are more specific: + * STAPLE_TOP_LEFT, STAPLE_BOTTOM_LEFT, + * STAPLE_TOP_RIGHT, STAPLE_BOTTOM_RIGHT, + * EDGE_STITCH_LEFT, EDGE_STITCH_TOP, + * EDGE_STITCH_RIGHT, EDGE_STITCH_BOTTOM, + * STAPLE_DUAL_LEFT, STAPLE_DUAL_TOP, + * STAPLE_DUAL_RIGHT, STAPLE_DUAL_BOTTOM. + *

+ *

+ * Note: The effect of this attribute on jobs with multiple documents + * is controlled by the job attribute + * {@link javax.print.attribute.standard.MultipleDocumentHandling}. + *

+ *

+ * IPP Compatibility: Finishings is an IPP 1.1 attribute. Differences + * to the IPP specification are that in the Java Print Service API only one + * enum value is supported (in IPP a set of enums). Further the enum + * punch is not supported. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class Finishings extends EnumSyntax + implements DocAttribute, PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -627840419548391754L; + + /** + * Perform no finishings of the documents. + */ + public static final Finishings NONE = new Finishings(3); + + /** + * Selects binding of the documents with one or more staples. + */ + public static final Finishings STAPLE = new Finishings(4); + + /** + * Selects the use of a non-printed (or pre-printed) cover for + * the document. + */ + public static final Finishings COVER = new Finishings(6); + + /** + * Selects that a binding is to be applied to the document. + * The type and placement of the binding is site-defined. + */ + public static final Finishings BIND = new Finishings(7); + + /** + * Selects binding of the documents with one or more staples + * along the middle fold. + */ + public static final Finishings SADDLE_STITCH = new Finishings(8); + + /** + * Selects binding of the documents with one or more staples + * along one edge. + */ + public static final Finishings EDGE_STITCH = new Finishings(9); + + /** + * Selects binding of the documents with one or more staples + * in the top left corner. + */ + public static final Finishings STAPLE_TOP_LEFT = new Finishings(20); + + /** + * Selects binding of the documents with one or more staples in the bottom + * left corner. + */ + public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21); + + /** + * Selects binding of the documents with one or more staples in + * the top right corner. + */ + public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22); + + /** + * Selects binding of the documents with one or more staples in + * the bottom right corner. + */ + public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23); + + /** + * Selects binding of the documents with one or more staples + * along the left edge. + */ + public static final Finishings EDGE_STITCH_LEFT = new Finishings(24); + + /** + * Selects binding of the documents with one or more staples along + * the top edge. + */ + public static final Finishings EDGE_STITCH_TOP = new Finishings(25); + + /** + * Selects binding of the documents with one or more staples along + * the right edge. + */ + public static final Finishings EDGE_STITCH_RIGHT = new Finishings(26); + + /** + * Selects binding of the documents with one or more staples along + * the bottom edge. + */ + public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(27); + + /** + * Selects binding of the documents with two staples along the + * left edge assuming a portrait document. + */ + public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28); + + /** + * Selects binding of the documents with two staples along the + * top edge assuming a portrait document. + */ + public static final Finishings STAPLE_DUAL_TOP = new Finishings(29); + + /** + * Selects binding of the documents with two staples along the + * right edge assuming a portrait document. + */ + public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(30); + + /** + * Selects binding of the documents with two staples along the + * bottom edge assuming a portrait document. + */ + public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(31); + + private static final String[] stringTable = { "none", "staple", null, + "cover", "bind", "saddle-stitch", + "edge-stitch", null, null, null, + null, null, null, null, null, + null, null, "staple-top-left", + "staple-bottom-left", + "staple-top-right", + "staple-bottom-right", + "edge-stitch-left", + "edge-stitch-top", + "edge-stitch-right", + "edge-stitch-bottom", + "staple-dual-left", + "staple-dual-top", + "staple-dual-right", + "staple-dual-bottom" }; + + private static final Finishings[] enumValueTable = { NONE, STAPLE, null, + COVER, BIND, + SADDLE_STITCH, + EDGE_STITCH, null, + null, null, null, + null, null, null, + null, null, null, + STAPLE_TOP_LEFT, + STAPLE_BOTTOM_LEFT, + STAPLE_TOP_RIGHT, + STAPLE_BOTTOM_RIGHT, + EDGE_STITCH_LEFT, + EDGE_STITCH_TOP, + EDGE_STITCH_RIGHT, + EDGE_STITCH_BOTTOM, + STAPLE_DUAL_LEFT, + STAPLE_DUAL_TOP, + STAPLE_DUAL_RIGHT, + STAPLE_DUAL_BOTTOM }; + + /** + * Constructs a Finishings object. + * + * @param value the value + */ + protected Finishings(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return the class Finishings itself + */ + public Class< ? extends Attribute> getCategory() + { + return Finishings.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "finishings". + */ + public final String getName() + { + return "finishings"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobHoldUntil.java b/libjava/classpath/javax/print/attribute/standard/JobHoldUntil.java new file mode 100644 index 000000000..97d3c15ad --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobHoldUntil.java @@ -0,0 +1,116 @@ +/* JobHoldUntil.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Date; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DateTimeSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The JobHoldUntil attribute specifies the date + * and the time at which a print job must become a candidate + * for printing. + *

+ * IPP Compatibility: JobHoldUntil is an IPP 1.1 attribute. + * However the attribute in IPP is based on keywords of named + * time periods like day-time or evening. It will depend on the + * concrete implementation of a print service how a mapping of the + * detailed provided date and time of this attribute to the named + * keyword or an alternate extension attribute will be done. E.g. + * CUPS supports also a HH:MM format as extension to the keywords. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobHoldUntil extends DateTimeSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -1664471048860415024L; + + /** + * Creates a JobHoldUntil object. + * + * @param value the date to hold the job until + * + * @exception NullPointerException if value is null + */ + public JobHoldUntil(Date value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobHoldUntil)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobHoldUntil itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobHoldUntil.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-hold-until". + */ + public String getName() + { + return "job-hold-until"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobImpressions.java b/libjava/classpath/javax/print/attribute/standard/JobImpressions.java new file mode 100644 index 000000000..11d51cac8 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobImpressions.java @@ -0,0 +1,128 @@ +/* JobImpressions.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The JobImpressions printing attribute specifies + * the total size in number of impressions of the documents + * of a a print job. + *

+ * An impression is specified by the IPP specification as the image + * (possibly many print-stream pages in different configurations) + * imposed onto a single media sheet. This attribute must not include + * a multiplication factor from the number of copies which maybe specified + * in a Copies attribute. + *

+ *

+ * This attribute belongs to a group of job size attributes which are + * describing the size of a job to be printed. The values supplied by + * these attributes are intended to be used for routing and scheduling + * of jobs on the print service. A client may specify these attributes. + * If a clients supplies these attributes a print service may change + * the values if its be able to compute a more accurate value at the + * time of the job submission or also later. + *

+ *

+ * IPP Compatibility: JobImpressions is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobKOctets + * @see javax.print.attribute.standard.JobMediaSheets + * + * @author Michael Koch + */ +public final class JobImpressions extends IntegerSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 8225537206784322464L; + + /** + * Creates a JobImpressions object. + * + * @param value the number of impressions + * + * @exception IllegalArgumentException if value < 0 + */ + public JobImpressions(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobImpressions)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobImpressions itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobImpressions.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-impressions". + */ + public String getName() + { + return "job-impressions"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java b/libjava/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java new file mode 100644 index 000000000..d1594ea02 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobImpressionsCompleted.java @@ -0,0 +1,119 @@ +/* JobImpressionsCompleted.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The JobImpressionsCompleted printing attribute reports + * the number of impressions already processed. + *

+ * An impression is specified by the IPP specification as the image imposed + * onto a single media sheet. This attribute will not include a multiplication + * factor from the number of copies. + *

+ *

+ * This attribute belongs to a group of job progress attributes which are + * reporting on the progress of a print job. + *

+ *

+ * IPP Compatibility: JobImpressionsCompleted is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobMediaSheetsCompleted + * @see javax.print.attribute.standard.JobKOctetsProcessed + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobImpressionsCompleted extends IntegerSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 6722648442432393294L; + + /** + * Creates a JobImpressionsCompleted object. + * + * @param value the number of completed impressions + * + * @exception IllegalArgumentException if value < 0 + */ + public JobImpressionsCompleted(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobImpressionsCompleted)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobImpressionsCompleted itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobImpressionsCompleted.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-impressions-completed". + */ + public String getName() + { + return "job-impressions-completed"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobImpressionsSupported.java b/libjava/classpath/javax/print/attribute/standard/JobImpressionsSupported.java new file mode 100644 index 000000000..583db4e24 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobImpressionsSupported.java @@ -0,0 +1,114 @@ +/* JobImpressionsSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.SetOfIntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The JobImpressionsSupported printing attribute specifies the + * supported range of values for the + * {@link javax.print.attribute.standard.JobImpressions} attribute. + *

+ * IPP Compatibility: JobImpressionsSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobImpressionsSupported extends SetOfIntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = -4887354803843173692L; + + /** + * Constructs a JobImpressionsSupported object with the + * given range of supported job impressions values. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 1 + */ + public JobImpressionsSupported(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerBound may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof JobImpressionsSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobImpressionsSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobImpressionsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-impressions-supported". + */ + public String getName() + { + return "job-impressions-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobKOctets.java b/libjava/classpath/javax/print/attribute/standard/JobKOctets.java new file mode 100644 index 000000000..c4427eaa5 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobKOctets.java @@ -0,0 +1,128 @@ +/* JobKOctets.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The JobKOctets printing attribute specifies + * the total size of all the documents of a print job in K octets. + *

+ * The supplied value has to be rounded up, so that a range between + * 1 and 1024 octects is specified as 1 and a range between 1025 and + * 2048 octects as 2, etc. This attribute must not include a multiplication + * factor from the number of copies which maybe specified in a Copies + * attribute. + *

+ *

+ * This attribute belongs to a group of job size attributes which are + * describing the size of a job to be printed. The values supplied by + * these attributes are intended to be used for routing and scheduling + * of jobs on the print service. A client may specify these attributes. + * If a clients supplies these attributes a print service may change + * the values if its be able to compute a more accurate value at the + * time of the job submission or also later. + *

+ *

+ * IPP Compatibility: JobKOctets is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobMediaSheets + * @see javax.print.attribute.standard.JobImpressions + * + * @author Michael Koch + */ +public final class JobKOctets extends IntegerSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -8959710146498202869L; + + /** + * Creates a JobKOctets object. + * The value is in units of K (1024) octets rounded up to the next highest K. + * + * @param value the number of K octets + * + * @exception IllegalArgumentException if value < 0 + */ + public JobKOctets(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobKOctets)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobKOctets itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobKOctets.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-k-octets". + */ + public String getName() + { + return "job-k-octets"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobKOctetsProcessed.java b/libjava/classpath/javax/print/attribute/standard/JobKOctetsProcessed.java new file mode 100644 index 000000000..55bee6a05 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobKOctetsProcessed.java @@ -0,0 +1,120 @@ +/* JobKOctetsProcessed.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The JobKOctetsProcessed printing attribute reports + * the total number of octets already processed in K octets units. + *

+ * The supplied value will be rounded up to the next highest K octets. + * This attribute will not include a multiplication factor from the number + * of copies. + *

+ *

+ * This attribute belongs to a group of job progress attributes which are + * reporting on the progress of a print job. + *

+ *

+ * IPP Compatibility: JobKOctetsProcessed is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobMediaSheetsCompleted + * @see javax.print.attribute.standard.JobImpressionsCompleted + * + * @author Michael Koch + */ +public final class JobKOctetsProcessed extends IntegerSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = -6265238509657881806L; + + /** + * Creates a JobKOctetsProcessed object. + * The value is in units of K (1024) octets rounded up to the next highest K. + * + * @param value the number of processed K octets + * + * @exception IllegalArgumentException if value < 0 + */ + public JobKOctetsProcessed(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobKOctetsProcessed)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobKOctetsProcessed itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobKOctetsProcessed.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-k-octets-processed". + */ + public String getName() + { + return "job-k-octets-processed"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobKOctetsSupported.java b/libjava/classpath/javax/print/attribute/standard/JobKOctetsSupported.java new file mode 100644 index 000000000..6990a53ee --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobKOctetsSupported.java @@ -0,0 +1,114 @@ +/* JobKOctetsSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.SetOfIntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The JobKOctetsSupported printing attribute specifies the + * supported range of values for the + * {@link javax.print.attribute.standard.JobKOctets} attribute. + *

+ * IPP Compatibility: JobKOctetsSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobKOctetsSupported extends SetOfIntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = -2867871140549897443L; + + /** + * Constructs a JobKOctetsSupported object with the + * given range for supported K octets. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 1 + */ + public JobKOctetsSupported(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerBound may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof JobKOctetsSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobKOctetsSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobKOctetsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-k-octets-supported". + */ + public String getName() + { + return "job-k-octets-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobMediaSheets.java b/libjava/classpath/javax/print/attribute/standard/JobMediaSheets.java new file mode 100644 index 000000000..c92cf3040 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobMediaSheets.java @@ -0,0 +1,125 @@ +/* JobMediaSheets.java -- + Copyright (C) 2003, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The JobMediaSheets printing attribute specifies + * the total number of media sheets needed by a job. + *

+ * In contrary to the other job size attributes this attribute must include + * the multiplication factor from the number of copies if a Copies attribute + * was specified for the job. + *

+ *

+ * This attribute belongs to a group of job size attributes which are + * describing the size of a job to be printed. The values supplied by + * these attributes are intended to be used for routing and scheduling + * of jobs on the print service. A client may specify these attributes. + * If a clients supplies these attributes a print service may change + * the values if its be able to compute a more accurate value at the + * time of the job submission or also later. + *

+ *

+ * IPP Compatibility: JobMediaSheets is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobKOctets + * @see javax.print.attribute.standard.JobImpressions + * + * @author Michael Koch + */ +public class JobMediaSheets extends IntegerSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 408871131531979741L; + + /** + * Creates a JobMediaSheets object. + * + * @param value the number of media sheets for a print job + * + * @exception IllegalArgumentException if value < 0 + */ + public JobMediaSheets(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobMediaSheets)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobMediaSheets itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobMediaSheets.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-media-sheets". + */ + public final String getName() + { + return "job-media-sheets"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java b/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java new file mode 100644 index 000000000..5ec7d8d63 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsCompleted.java @@ -0,0 +1,114 @@ +/* JobMediaSheetsCompleted.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The JobMediaSheetsCompleted printing attribute reports + * the number of media sheets already processed. + *

+ * This attribute belongs to a group of job progress attributes which are + * reporting on the progress of a print job. + *

+ *

+ * IPP Compatibility: JobMediaSheetsCompleted is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobImpressionsCompleted + * @see javax.print.attribute.standard.JobKOctetsProcessed + * + * @author Michael Koch + */ +public final class JobMediaSheetsCompleted extends IntegerSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 1739595973810840475L; + + /** + * Creates a JobMediaSheetsCompleted object. + * + * @param value the number of completed media sheets + * + * @exception IllegalArgumentException if value < 0 + */ + public JobMediaSheetsCompleted(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobMediaSheetsCompleted)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobMediaSheetsCompleted itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobMediaSheetsCompleted.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-media-sheets-completed". + */ + public String getName() + { + return "job-media-sheets-completed"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsSupported.java b/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsSupported.java new file mode 100644 index 000000000..32d6ac54d --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobMediaSheetsSupported.java @@ -0,0 +1,114 @@ +/* JobMediaSheetsSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.SetOfIntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The JobMediaSheetsSupported printing attribute specifies the + * supported range of values for the + * {@link javax.print.attribute.standard.JobMediaSheets} attribute. + *

+ * IPP Compatibility: JobMediaSheetsSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobMediaSheetsSupported extends SetOfIntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = 2953685470388672940L; + + /** + * Constructs a JobMediaSheetsSupported object with the + * given range of supported job media sheets values. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 1 + */ + public JobMediaSheetsSupported(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerBound may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof JobMediaSheetsSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobMediaSheetsSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobMediaSheetsSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-media-sheets-supported". + */ + public String getName() + { + return "job-media-sheets-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobMessageFromOperator.java b/libjava/classpath/javax/print/attribute/standard/JobMessageFromOperator.java new file mode 100644 index 000000000..bf1dedb96 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobMessageFromOperator.java @@ -0,0 +1,113 @@ +/* JobMessageFromOperator.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The JobMessageFromOperator printing attribute provides + * a message from an operator or a system administrator related to the + * print job. This may include information why a certain action has been + * taken on the print job like a modification. + *

+ * IPP Compatibility: JobMessageFromOperator is an IPP 1.1 + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobMessageFromOperator extends TextSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = -4620751846003142047L; + + /** + * Creates a JobMessageFromOperator object. + * + * @param message the message + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if message is null. + */ + public JobMessageFromOperator(String message, Locale locale) + { + super(message, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobMessageFromOperator)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobMessageFromOperator itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobMessageFromOperator.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-message-from-operator". + */ + public String getName() + { + return "job-message-from-operator"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobName.java b/libjava/classpath/javax/print/attribute/standard/JobName.java new file mode 100644 index 000000000..dc84cb61e --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobName.java @@ -0,0 +1,111 @@ +/* JobName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The JobName printing attribute provides the name of a + * print job for identification. + *

+ * IPP Compatibility: JobName is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobName extends TextSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 4660359192078689545L; + + /** + * Creates a JobName object. + * + * @param jobName the job name. + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if jobName is null. + */ + public JobName(String jobName, Locale locale) + { + super(jobName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobName)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobName itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobName.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-name". + */ + public String getName() + { + return "job-name"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobOriginatingUserName.java b/libjava/classpath/javax/print/attribute/standard/JobOriginatingUserName.java new file mode 100644 index 000000000..c7246ddc5 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobOriginatingUserName.java @@ -0,0 +1,110 @@ +/* JobOriginatingUserName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The JobOriginatingUserName attribute specifies the name of + * the user which submitted the print job. + *

+ * IPP Compatibility: JobOriginatingUserName is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobOriginatingUserName extends TextSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = -8052537926362933477L; + + /** + * Creates a JobOriginatingUserName object. + * + * @param userName the user name + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if userName is null. + */ + public JobOriginatingUserName(String userName, Locale locale) + { + super(userName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobOriginatingUserName)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobOriginatingUserName itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobOriginatingUserName.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-originating-user-name". + */ + public String getName() + { + return "job-originating-user-name"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobPriority.java b/libjava/classpath/javax/print/attribute/standard/JobPriority.java new file mode 100644 index 000000000..0f669a06d --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobPriority.java @@ -0,0 +1,115 @@ +/* JobPriority.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The JobPriority printing attribute specifies + * the priority for scheduling a job on the print service. + *

+ * A client may specify any value between 1 (lowest priority) and 100 + * (highest priority). A print service prints jobs with a priority + * value of n before those with a priority value of n-1. + *

+ *

+ * IPP Compatibility: JobPriority is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobPriority extends IntegerSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -4599900369040602769L; + + /** + * Creates a JobPriority object. + * + * @param value the priority + * + * @exception IllegalArgumentException if value < 1 or value > 100 + */ + public JobPriority(int value) + { + super(value); + + if (value < 1 || value > 100) + throw new IllegalArgumentException("value out of range"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobPriority)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobPriority itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobPriority.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-priority". + */ + public String getName() + { + return "job-priority"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobPrioritySupported.java b/libjava/classpath/javax/print/attribute/standard/JobPrioritySupported.java new file mode 100644 index 000000000..b2e577283 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobPrioritySupported.java @@ -0,0 +1,117 @@ +/* JobPrioritySupported.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The JobPrioritySupported printing attribute provides + * the supported values for the JobPriority attribute. + *

+ * A client may specify any JobPriority value between 1 and 100. If a + * print service supports fewer priority levels it indicates the maximum + * levels through this attribute. The print service then automatically + * maps the job priority value provided by the client in an even distribution + * over the whole range of 1 to 100. + *

+ *

+ * IPP Compatibility: JobPrioritySupported is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobPriority + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class JobPrioritySupported extends IntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = 2564840378013555894L; + + /** + * Creates a JobPrioritySupported object. + * + * @param value the priority + * + * @exception IllegalArgumentException if value < 1 or value > 100 + */ + public JobPrioritySupported(int value) + { + super(value); + + if (value < 1 || value > 100) + throw new IllegalArgumentException("value out of range"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof JobPrioritySupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class JobPrioritySupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobPrioritySupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-priority-supported". + */ + public String getName() + { + return "job-priority-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobSheets.java b/libjava/classpath/javax/print/attribute/standard/JobSheets.java new file mode 100644 index 000000000..7d20692b9 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobSheets.java @@ -0,0 +1,127 @@ +/* JobSheets.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The JobSheets printing attribute specifies if a + * job start/end sheets should be printed. + *

+ * IPP Compatibility: JobSheets is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class JobSheets extends EnumSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -4735258056132519759L; + + /** + * No job sheet is printed. + */ + public static final JobSheets NONE = new JobSheets(0); + + /** + * The standard job sheet is printed. The sheet and if it + * is printed only as start sheet or also as end sheet is + * site specific. + */ + public static final JobSheets STANDARD = new JobSheets(1); + + private static final String[] stringTable = { "none", "standard" }; + + private static final JobSheets[] enumValueTable = { NONE, STANDARD }; + + /** + * Constructs a JobSheets object. + * + * @param value the enum value. + */ + protected JobSheets(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class JobSheets itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobSheets.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-sheets". + */ + public final String getName() + { + return "job-sheets"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobState.java b/libjava/classpath/javax/print/attribute/standard/JobState.java new file mode 100644 index 000000000..5efbe08ea --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobState.java @@ -0,0 +1,176 @@ +/* JobState.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; + + +/** + * The JobState printing attribute reports + * the current state of a job. + *

+ * The {@link javax.print.attribute.standard.JobStateReasons} + * attribute provides further detailed information about + * the given job state. Detailed information about the job + * state and job state reasons can be found in the RFC 2911. + *

+ *

+ * IPP Compatibility: JobState is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class JobState extends EnumSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 400465010094018920L; + + /** + * The job state is currently unknown. + */ + public static final JobState UNKNOWN = new JobState(0); + + /** + * The job is pending processing. + */ + public static final JobState PENDING = new JobState(3); + + /** + * The job is currently not a candidate for printing because + * of reasons reported by the job-state-reasons attribute. If + * the reasons are no longer present it will return to the + * pending state. + */ + public static final JobState PENDING_HELD = new JobState(4); + + /** + * The job is currently processed. + */ + public static final JobState PROCESSING = new JobState(5); + + /** + * The job's processing has stopped. The job-state-reasons + * attribute may indicate the reason(s). The job will return + * to the processing state if the reasons are no longer present. + */ + public static final JobState PROCESSING_STOPPED = new JobState(6); + + /** + * The job has been canceled by the client. + */ + public static final JobState CANCELED = new JobState(7); + + /** + * The job has been aborted by the system. + */ + public static final JobState ABORTED = new JobState(8); + + /** + * The job has completed successfully. + */ + public static final JobState COMPLETED = new JobState(9); + + + private static final String[] stringTable = { "unknown", null, null, + "pending", "pending-held", + "processing", + "processing-stopped", + "canceled", "aborted", + "completed"}; + + private static final JobState[] enumValueTable = { UNKNOWN, null, null, + PENDING, PENDING_HELD, + PROCESSING, + PROCESSING_STOPPED, + CANCELED, ABORTED, + COMPLETED }; + + /** + * Constructs a JobState object. + * + * @param value the enum value. + */ + protected JobState(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class JobState itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobState.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-state". + */ + public final String getName() + { + return "job-state"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobStateReason.java b/libjava/classpath/javax/print/attribute/standard/JobStateReason.java new file mode 100644 index 000000000..52aae1562 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobStateReason.java @@ -0,0 +1,300 @@ +/* JobStateReason.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The JobStateReason attribute provides additional + * information about the current state of a job. Its always part + * of the {@link javax.print.attribute.standard.JobStateReasons} + * printing attribute. + *

+ * IPP Compatibility: JobStateReason is not an IPP 1.1 + * attribute itself but used inside the JobStateReasons + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class JobStateReason extends EnumSyntax + implements Attribute +{ + private static final long serialVersionUID = -8765894420449009168L; + + /** + * The printer has accepted the job or is retrieving document + * data for processing. + */ + public static final JobStateReason JOB_INCOMING = new JobStateReason(0); + + /** + * The printer is expecting additional document data before it + * can move this job into the processing state. + */ + public static final JobStateReason JOB_DATA_INSUFFICIENT = new JobStateReason(1); + + /** + * The printer is unable to access one or more documents provided + * by reference in the print job. + */ + public static final JobStateReason DOCUMENT_ACCESS_ERROR = new JobStateReason(2); + + /** + * The printer has not received the whole job submission. This + * indicates no reason for the interruption. + */ + public static final JobStateReason SUBMISSION_INTERRUPTED = new JobStateReason(3); + + /** + * The printer transfers the job to the actual output device. + */ + public static final JobStateReason JOB_OUTGOING = new JobStateReason(4); + + /** + * The job was submitted with a JobHoldUntil attribute which + * specifies a time period still in the future and causes the job to + * be on hold. + */ + public static final JobStateReason JOB_HOLD_UNTIL_SPECIFIED = new JobStateReason(5); + + /** + * One or more resources needed by the job are not ready. E.g. needed + * media type. + */ + public static final JobStateReason RESOURCES_ARE_NOT_READY = new JobStateReason(6); + + /** + * The printer stopped partly. + */ + public static final JobStateReason PRINTER_STOPPED_PARTLY = new JobStateReason(7); + + /** + * The printer stopped complete. + */ + public static final JobStateReason PRINTER_STOPPED = new JobStateReason(8); + + /** + * The printer is currently interpreting the jobs document data. + * Detailed state of the job's processing state. + */ + public static final JobStateReason JOB_INTERPRETING = new JobStateReason(9); + + /** + * The printer has queued the document data. + * Detailed state of the job's processing state. + */ + public static final JobStateReason JOB_QUEUED = new JobStateReason(10); + + /** + * The printer is transforming the document data to another representation. + * Detailed state of the job's processing state. + */ + public static final JobStateReason JOB_TRANSFORMING = new JobStateReason(11); + + /** + * The job is queued for marking. + */ + public static final JobStateReason JOB_QUEUED_FOR_MARKER = new JobStateReason(12); + + /** + * The job is currently printing. + */ + public static final JobStateReason JOB_PRINTING = new JobStateReason(13); + + /** + * The job was canceled by the user (the owner of the job). + */ + public static final JobStateReason JOB_CANCELED_BY_USER = new JobStateReason(14); + + /** + * The job was canceled by the operator. + */ + public static final JobStateReason JOB_CANCELED_BY_OPERATOR = new JobStateReason(15); + + /** + * The job was canceled by an unidentified local user at the device. + */ + public static final JobStateReason JOB_CANCELED_AT_DEVICE = new JobStateReason(16); + + /** + * The job has been aborted by the system. + */ + public static final JobStateReason ABORTED_BY_SYSTEM = new JobStateReason(17); + + /** + * The printer aborted the job because of an unsupported compression while + * trying to decompress the document data. + */ + public static final JobStateReason UNSUPPORTED_COMPRESSION = new JobStateReason(18); + + /** + * The printer aborted the job because of a compression error while + * trying to decompress the document data. If this state is given the test + * for supported compression has already been passed. + */ + public static final JobStateReason COMPRESSION_ERROR = new JobStateReason(19); + + /** + * The printer aborted the job because of the document format is not supported. + * This may happen if a job is specified as application/octet-stream format. + */ + public static final JobStateReason UNSUPPORTED_DOCUMENT_FORMAT = new JobStateReason(20); + + /** + * The printer aborted the job because of an error in the document data. + */ + public static final JobStateReason DOCUMENT_FORMAT_ERROR = new JobStateReason(21); + + /** + * The client has either canceled the job or the printer aborted the job. + * However the printer still performs some action on the job e.g. to cleanup. + */ + public static final JobStateReason PROCESSING_TO_STOP_POINT = new JobStateReason(22); + + /** + * The printer is offline and therefore is not accepting jobs. + */ + public static final JobStateReason SERVICE_OFF_LINE = new JobStateReason(23); + + /** + * The printer completed the job successfully. + */ + public static final JobStateReason JOB_COMPLETED_SUCCESSFULLY = new JobStateReason(24); + + /** + * The printer completed the job with warnings. + */ + public static final JobStateReason JOB_COMPLETED_WITH_WARNINGS = new JobStateReason(25); + + /** + * The printer completed the job with errors. + */ + public static final JobStateReason JOB_COMPLETED_WITH_ERRORS = new JobStateReason(26); + + /** + * The job is retained and is able to be restared. + */ + public static final JobStateReason JOB_RESTARTABLE = new JobStateReason(27); + + /** + * The printer has forwarded the job to the actual output device. This device + * is not capable of reporting the state back so that the job state is set + * to completed by the printer. + */ + public static final JobStateReason QUEUED_IN_DEVICE = new JobStateReason(28); + + private static final String[] stringTable = + { "job-incoming", "job-data-insufficient", "document-access-error", + "submission-interrupted", "job-outgoing", "job-hold-until-specified", + "resources-are-not-ready", "printer-stopped-partly", "printer-stopped", + "job-interpreting", "job-queued", "job-transforming", + "job-queued-for-marker", "job-printing", "job-canceled-by-user", + "job-canceled-by-operator", "job-canceled-at-device", + "aborted-by-system", "unsupported-compression", "compression-error", + "unsupported-document-format", "document-format-error", + "processing-to-stop-point", "service-off-line", + "job-completed-successfully", "job-completed-with-warnings", + "job-completed-with-errors", "job-restartable", "queued-in-device" }; + + private static final JobStateReason[] enumValueTable = + { JOB_INCOMING, JOB_DATA_INSUFFICIENT, DOCUMENT_ACCESS_ERROR, + SUBMISSION_INTERRUPTED, JOB_OUTGOING, JOB_HOLD_UNTIL_SPECIFIED, + RESOURCES_ARE_NOT_READY, PRINTER_STOPPED_PARTLY, PRINTER_STOPPED, + JOB_INTERPRETING, JOB_QUEUED, JOB_TRANSFORMING, JOB_QUEUED_FOR_MARKER, + JOB_PRINTING, JOB_CANCELED_BY_USER, JOB_CANCELED_BY_OPERATOR, + JOB_CANCELED_AT_DEVICE, ABORTED_BY_SYSTEM, UNSUPPORTED_COMPRESSION, + COMPRESSION_ERROR, UNSUPPORTED_DOCUMENT_FORMAT, DOCUMENT_FORMAT_ERROR, + PROCESSING_TO_STOP_POINT, SERVICE_OFF_LINE, JOB_COMPLETED_SUCCESSFULLY, + JOB_COMPLETED_WITH_WARNINGS, JOB_COMPLETED_WITH_ERRORS, JOB_RESTARTABLE, + QUEUED_IN_DEVICE }; + + /** + * Constructs a JobStateReason object. + * + * @param value the enum value. + */ + protected JobStateReason(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class JobStateReason itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobStateReason.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-state-reason". + */ + public final String getName() + { + return "job-state-reason"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java b/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java new file mode 100644 index 000000000..af6eb5e90 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/JobStateReasons.java @@ -0,0 +1,154 @@ +/* JobStateReasons.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Collection; +import java.util.HashSet; +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; + +/** + * The JobStateReasons attribute provides the set of + * additional informations available about the current state of a print job. + *

+ * IPP Compatibility: JobStateReasons is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobState + * @see javax.print.attribute.standard.JobStateReason + * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class JobStateReasons extends HashSet + implements PrintJobAttribute +{ + private static final long serialVersionUID = 8849088261264331812L; + + /** + * Constructs an empty JobStateReasons attribute. + */ + public JobStateReasons() + { + super(); + } + + /** + * Constructs an empty JobStateReasons attribute + * with the given initial capacity and load factor. + * + * @param initialCapacity the intial capacity. + * @param loadFactor the load factor of the underlying HashSet. + * + * @throws IllegalArgumentException if initialCapacity < 0 + * @throws IllegalArgumentException if initialCapacity or loadFactor < 0 + */ + public JobStateReasons(int initialCapacity, float loadFactor) + { + super(initialCapacity, loadFactor); + } + + /** + * Constructs an empty JobStateReasons attribute + * with the given initial capacity and the default load factor. + * + * @param initialCapacity the intial capacity. + * + * @throws IllegalArgumentException if initialCapacity < 0 + */ + public JobStateReasons(int initialCapacity) + { + super(initialCapacity); + } + + /** + * Constructs a JobStateReasons attribute + * with the content of the given collection. + * + * @param collection the collection for the initial values. + * + * @throws NullPointerException if collection or any value is + * null. + * @throws ClassCastException if values of collection are not of type + * JobStateReason. + */ + public JobStateReasons(Collection collection) + { + super(collection.size(), 0.75f); + for (JobStateReason reason : collection) + add(reason); + } + + /** + * Adds the given job state reason object to the set. + * + * @param o the reason of type JobStateReason. + * @return true if set changed, false otherwise. + * + * @throws NullPointerException if given object is null. + * @throws ClassCastException if given object is not an instance of + * JobStateReason. + */ + public boolean add(JobStateReason o) + { + if (o == null) + throw new NullPointerException("reason is null"); + + return super.add(o); + } + + /** + * Returns category of this class. + * + * @return The class JobStateReasons itself. + */ + public Class< ? extends Attribute> getCategory() + { + return JobStateReasons.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "job-state-reasons". + */ + public String getName() + { + return "job-state-reasons"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Media.java b/libjava/classpath/javax/print/attribute/standard/Media.java new file mode 100644 index 000000000..dad8d35a0 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Media.java @@ -0,0 +1,123 @@ +/* Media.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The Media printing attribute specifies which + * type of media should be used for printing. + *

+ * The media to be used can be specified in three ways represented + * by the media subclasses {@link javax.print.attribute.standard.MediaTray}, + * {@link javax.print.attribute.standard.MediaName} and + * {@link javax.print.attribute.standard.MediaSizeName}: + *

    + *
  • Selection by paper source - selection of printer tray to be used.
  • + *
  • Selection by name - e.g. A4 paper.
  • + *
  • Selection by standard sizes - e.g. ISO A5, JIS B4.
  • + *
+ * Each of the sublcasses represents the IPP attribute media + * and provides predefined values to be used. + *

+ *

+ * IPP Compatibility: Media is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public abstract class Media extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = -2823970704630722439L; + + /** + * Constructs a Media object. + * + * @param value the enum value. + */ + protected Media(int value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * The objects are considered equal if both are of the same + * Media subclass, not null and the values are equal. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (obj == null) + return false; + + return (obj.getClass() == this.getClass() + && ((Media) obj).getValue() == this.getValue()); + } + + /** + * Returns category of this class. + * + * @return The class Media itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Media.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media". + */ + public final String getName() + { + return "media"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MediaName.java b/libjava/classpath/javax/print/attribute/standard/MediaName.java new file mode 100644 index 000000000..78a052f06 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MediaName.java @@ -0,0 +1,120 @@ +/* MediaName.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.EnumSyntax; + +/** + * MediaName is a subclass of the Media printing + * attribute and provides selection of media to be used by the means of + * defined names. The class pre-defines commonly available media names. + * This media type enumeration may be used in alternative to + * MediaSizeName/MediaTray. + *

+ * IPP Compatibility: MediaName is not an IPP 1.1 attribute on its own. + * It provides parts of the media attribute type values. + *

+ * + * @author Sven de Marothy + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class MediaName extends Media +{ + private static final long serialVersionUID = 4653117714524155448L; + + /** + * The North American letter white medium. + */ + public static final MediaName NA_LETTER_WHITE = new MediaName(0); + + /** + * The North American letter transparent medium. + */ + public static final MediaName NA_LETTER_TRANSPARENT = new MediaName(1); + + /** + * The ISO A4 white medium. + */ + public static final MediaName ISO_A4_WHITE = new MediaName(2); + + /** + * The ISO A4 transparent medium. + */ + public static final MediaName ISO_A4_TRANSPARENT = new MediaName(3); + + private static final String[] stringTable = { "na-letter-white", + "na-letter-transparent", + "iso-a4-white", + "iso-a4-transparent" }; + + private static final MediaName[] enumValueTable = { NA_LETTER_WHITE, + NA_LETTER_TRANSPARENT, + ISO_A4_WHITE, + ISO_A4_TRANSPARENT }; + + /** + * Creates a MediaName object. + * + * @param i the enum value. + */ + protected MediaName(int i) + { + super( i ); + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MediaPrintableArea.java b/libjava/classpath/javax/print/attribute/standard/MediaPrintableArea.java new file mode 100644 index 000000000..721999204 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MediaPrintableArea.java @@ -0,0 +1,312 @@ +/* MediaPrintableArea.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The MediaPrintableArea attribute specifies the area + * of a media sheet which is available for printing. + *

+ * Due to hardware limitation its not possible with most printers to use the + * whole area of a media sheet for printing. This attribute defines the area + * for printing through the values of the upper left corner position (x,y) + * on the sheet and the available width and height of the area. The units of + * the values are determined by two defined constants: + *

    + *
  • INCH - defines an inch
  • + *
  • MM - defines a millimeter
  • + *
+ *

+ *

+ * Internal storage:
+ * The values of x, y, width and height are stored internally in micrometers. + * The values of the provided constants for inch (value 25400) and millimeters + * (value 1000) are used as conversion factors to the internal storage units. + * To get the internal micrometers values a multiplication of a given + * size value with its units constant value is done. Retrieving the size value + * for specific units is done by dividing the internal stored value by the + * units constant value. + *

+ *

+ * IPP Compatibility: MediaPrintableArea is not an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class MediaPrintableArea + implements DocAttribute, PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -1597171464050795793L; + + /** + * Constant for the units of inches. + * The actual value is the conversion factor to micrometers. + */ + public static final int INCH = 25400; + + /** + * Constant for the units of millimeters. + * The actual value is the conversion factor to micrometers. + */ + public static final int MM = 1000; + + /** x in micrometers. */ + private int x; + /** y in micrometers. */ + private int y; + /** width in micrometers. */ + private int w; + /** height in micrometers. */ + private int h; + + /** + * Creates a new MediaPrintableArea object with the given + * float values for the given units. + * + * @param x start of the printable area on the sheet in x direction. + * @param y start of the printable area on the sheet in y direction. + * @param w the width of the printable area. + * @param h the height of the printable area. + * @param units the units of the given values. + * + * @throws IllegalArgumentException if x i< 0 or y i< 0 or w i<= 0 + * or h i<= 0 or units i< 1 + */ + public MediaPrintableArea(float x, float y, float w, float h, int units) + { + if (x < 0.0f || y < 0.0f || w <= 0.0f || h <= 0.0f) + throw new IllegalArgumentException(); + + this.x = (int) (x * units + 0.5f); + this.y = (int) (y * units + 0.5f); + this.w = (int) (w * units + 0.5f); + this.h = (int) (h * units + 0.5f); + } + + /** + * Creates a new MediaPrintableArea object with the given + * int values for the given units. + * + * @param x start of the printable area on the sheet in x direction. + * @param y start of the printable area on the sheet in y direction. + * @param w the width of the printable area. + * @param h the height of the printable area. + * @param units the units of the given values. + * + * @throws IllegalArgumentException if x i< 0 or y i< 0 or w i<= 0 + * or h i<= 0 or units i< 1 + */ + public MediaPrintableArea(int x, int y, int w, int h, int units) + { + if (x < 0 || y < 0 || w <= 0 || h <= 0) + throw new IllegalArgumentException(); + + this.x = x * units; + this.y = y * units; + this.w = w * units; + this.h = h * units; + } + + /** + * Returns category of this class. + * + * @return The class MediaPrintableArea itself. + */ + public Class< ? extends Attribute> getCategory() + { + return MediaPrintableArea.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media-printable-area". + */ + public String getName() + { + return "media-printable-area"; + } + + /** + * Returns the height of the printable area for the given units. + * + * @param units the units conversion factor. + * @return The height. + * + * @throws IllegalArgumentException if units is < 1 + */ + public float getHeight(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less than 1"); + + return h / ((float)units); + } + + /** + * Returns the width of the printable area for the given units. + * + * @param units the units conversion factor. + * @return The width. + * + * @throws IllegalArgumentException if units is < 1 + */ + public float getWidth(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less than 1"); + + return w / ((float)units); + } + + /** + * Returns the position in x direction of the printable area + * for the given units. + * + * @param units the units conversion factor. + * @return The position in x direction. + * + * @throws IllegalArgumentException if units is < 1 + */ + public float getX(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less than 1"); + + return x / ((float)units); + } + + /** + * Returns the position in y direction of the printable area + * for the given units. + * + * @param units the units conversion factor. + * @return The position in y direction. + * + * @throws IllegalArgumentException if units is < 1 + */ + public float getY(int units) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less than 1"); + + return y / ((float)units); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof MediaPrintableArea)) + return false; + + MediaPrintableArea tmp = (MediaPrintableArea) obj; + + return (x == tmp.getX(1) && y == tmp.getY(1) + && w == tmp.getWidth(1) && h == tmp.getHeight(1)); + } + + /** + * Returns the string representation for this object in units of millimeters.. + *

+ * The returned string is in the form "(x,y)->(width,height)mm". + *

+ * @return The string representation in millimeters. + */ + public String toString() + { + return toString(MM, "mm"); + } + + /** + * Returns the hashcode for this object. + * + * @return The hashcode. + */ + public int hashCode() + { + return x ^ y + w ^ h; + } + + /** + * Returns the string representation for this object in units of millimeters.. + *

+ * The returned string is in the form "(x,y)->(width,height)unitsName". + *

+ * @param units the units to use for conversion. + * @param unitsName the name of the used units, appended to the resulting + * string if not null. + * @return The string representation in millimeters. + * + * @throws IllegalArgumentException if units is < 1 + */ + public String toString(int units, String unitsName) + { + if (units < 1) + throw new IllegalArgumentException("units may not be less than 1"); + + String tmp = "(" + getX(units) + "," + getY(units) + ")->(" + + getWidth(units) + "," + getHeight(units) + ")"; + + return unitsName == null ? tmp : tmp + unitsName; + } + + /** + * Returns the printable area as an float[] with 4 values + * (order x, y, width, height) in the given units. + * + * @param units the units to use. + * @return The printable area as float array. + */ + public float[] getPrintableArea(int units) + { + return new float[] { getX(units), getY(units), + getWidth(units), getHeight(units) }; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MediaSize.java b/libjava/classpath/javax/print/attribute/standard/MediaSize.java new file mode 100644 index 000000000..7df22cd4c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MediaSize.java @@ -0,0 +1,883 @@ +/* MediaSize.java -- + Copyright (C) 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.ArrayList; + +import javax.print.attribute.Attribute; +import javax.print.attribute.Size2DSyntax; + +/** + * The MediaSize printing attribute class specifies the size + * of a printing media. The size is defined in portrait orientation with + * x at the bottom edge and y at the left edge. + *

+ * There are several media sizes predefined through the nested classes. Further + * sizes may be provided by the application. MediaSize is not used + * as a printing attribute currently. It may be used to get the actual sizes + * for a named media or to find a suitable MediaSizeName instance + * by querying with the needed sizes. + *

+ *

+ * IPP Compatibility: MediaSize is not an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.MediaSizeName + * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class MediaSize extends Size2DSyntax + implements Attribute +{ + private static final long serialVersionUID = -1967958664615414771L; + + private static ArrayList mediaCache; + + static + { + mediaCache = new ArrayList(); + + // We call one instance of every container class to make sure it gets + // loaded during class initialization and therefore all other static + // fields of this container class also. + + // This is needed to put all MediaSize instance into the mediaCache + // for use by the static methods in this class. + + MediaSize tmp = MediaSize.ISO.A0; + tmp = MediaSize.JIS.B0; + tmp = MediaSize.Engineering.A; + tmp = MediaSize.NA.LEGAL; + tmp = MediaSize.Other.EXECUTIVE; + } + + private MediaSizeName mediaName; + + /** + * Creates a MediaSize object. The created object will be added + * to an internal cache used in the static methods of this class for lookup + * of available MediaSize instances. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + * + * @see #findMedia(float, float, int) + * @see #getMediaSizeForName(MediaSizeName) + */ + public MediaSize(float x, float y, int units) + { + super(x, y, units); + mediaCache.add(this); + } + + /** + * Creates a MediaSize object associated with the given + * media name. The created object will be added to an internal cache used + * in the static methods of this class for lookup of available + * MediaSize instances. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * @param media the media name to associate + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + * + * @see #findMedia(float, float, int) + * @see #getMediaSizeForName(MediaSizeName) + */ + public MediaSize(float x, float y, int units, MediaSizeName media) + { + super(x, y, units); + mediaName = media; + mediaCache.add(this); + } + + /** + * Creates a MediaSize object. The created object will be added + * to an internal cache used in the static methods of this class for lookup + * of available MediaSize instances. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + * + * @see #findMedia(float, float, int) + * @see #getMediaSizeForName(MediaSizeName) + */ + public MediaSize(int x, int y, int units) + { + super(x, y, units); + mediaCache.add(this); + } + + /** + * Creates a MediaSize object associated with the given + * media name. The created object will be added to an internal cache used + * in the static methods of this class for lookup of available + * MediaSize instances. + * + * @param x the size in x direction + * @param y the size in y direction + * @param units the units to use for the sizes + * @param media the media name to associate + * + * @exception IllegalArgumentException if x or y < 0 or units < 1 + * + * @see #findMedia(float, float, int) + * @see #getMediaSizeForName(MediaSizeName) + */ + public MediaSize(int x, int y, int units, MediaSizeName media) + { + super(x, y, units); + mediaName = media; + mediaCache.add(this); + } + + /** + * Returns category of this class. + * + * @return The class MediaSize itself. + */ + public Class< ? extends Attribute> getCategory() + { + return MediaSize.class; + } + + + /** + * Searches for a MediaSize object with the given dimensions. + * If none is found with exact dimensions, the closest match is used. + * Afterwards the MediaSizeName of the found MediaSize object is + * returned - which might be null if none is specified. + * + * @param x the dimension for x + * @param y the dimension for y + * @param units the units to be used for comparison + * @return the corresponding MediaSizeName object, or null + */ + public static MediaSizeName findMedia(float x, float y, int units) + { + if (x <= 0.0f || y <= 0.0f) + throw new IllegalArgumentException( + "x and/or y may not be less or equal 0"); + + if (units < 1) + throw new IllegalArgumentException("units may not be less then 1"); + + MediaSize bestMatch = null; + int bestDistance = Integer.MAX_VALUE; + + int xMicro = (int) x * units; + int yMicro = (int) y * units; + + for (int i = 0; i < mediaCache.size(); i++) + { + MediaSize size = mediaCache.get(i); + int dist = (Math.abs(size.getXMicrometers() - xMicro) + + Math.abs(size.getYMicrometers() - yMicro)); + + if (dist < bestDistance) + { + bestMatch = size; + bestDistance = dist; + } + } + + return bestMatch.getMediaSizeName(); + } + + /** + * Returns the associated MediaSize instance for the + * given named media MediaSizeName instance. + * + * @param media the named media to search for. + * @return The corresponding MediaSize instance or + * null if none found. + */ + public static MediaSize getMediaSizeForName(MediaSizeName media) + { + for (int i = 0; i < mediaCache.size(); i++) + { + MediaSize size = mediaCache.get(i); + + if (size.getMediaSizeName().equals(media)) + return size; + } + + return null; + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (!(obj instanceof MediaSize)) + return false; + + MediaSize tmp = (MediaSize) obj; + return (tmp.getXMicrometers() == this.getXMicrometers() + && tmp.getYMicrometers() == this.getYMicrometers()); + } + + /** + * Returns the media name of this size. + * + * @return The media name. + */ + public MediaSizeName getMediaSizeName() + { + return mediaName; + } + + /** + * Returns the name of this attribute. + * + * @return The name "media-size". + */ + public final String getName() + { + return "media-size"; + } + + /** + * Container class for predefined ISO media sizes. + * + * @author Sven de Marothy (sven@physto.se) + */ + public static final class ISO + { + private ISO() + { + // prevent instantiation + } + + /** + * ISO A0 paper, 841 mm x 1189 mm. + */ + public static final MediaSize A0 = new MediaSize(841, 1189, + MediaSize.MM, + MediaSizeName.ISO_A0); + + /** + * ISO A1 paper, 594 mm x 841 mm + */ + public static final MediaSize A1 = new MediaSize(594, 841, MediaSize.MM, + MediaSizeName.ISO_A1); + + /** + * ISO A2 paper, 420 mm x 594 mm + */ + public static final MediaSize A2 = new MediaSize(420, 594, MediaSize.MM, MediaSizeName.ISO_A2); + + /** + * ISO A3 paper, 297 mm x 420 mm + */ + public static final MediaSize A3 = new MediaSize(297, 420, MediaSize.MM, MediaSizeName.ISO_A3); + + /** + * ISO A4 paper, 210 mm x 297 mm + */ + public static final MediaSize A4 = new MediaSize(210, 297, MediaSize.MM, MediaSizeName.ISO_A4); + + /** + * ISO A5 paper, 148 mm x 210 mm + */ + public static final MediaSize A5 = new MediaSize(148, 210, MediaSize.MM, MediaSizeName.ISO_A5); + + /** + * ISO A6 paper, 105 mm x 148 mm + */ + public static final MediaSize A6 = new MediaSize(105, 148, MediaSize.MM, MediaSizeName.ISO_A6); + + /** + * ISO A7 paper, 74 mm x 105 mm + */ + public static final MediaSize A7 = new MediaSize(74, 105, MediaSize.MM, MediaSizeName.ISO_A7); + + /** + * ISO A8 paper, 52 mm x 74 mm + */ + public static final MediaSize A8 = new MediaSize(52, 74, MediaSize.MM, MediaSizeName.ISO_A8); + + /** + * ISO A9 paper, 37 mm x 52 mm + */ + public static final MediaSize A9 = new MediaSize(37, 52, MediaSize.MM, MediaSizeName.ISO_A9); + + /** + * ISO A10 paper, 26 mm x 37 mm + */ + public static final MediaSize A10 = new MediaSize(26, 37, MediaSize.MM, MediaSizeName.ISO_A10); + + + /** + * ISO B0 paper, 1000 mm x 1414 mm + */ + public static final MediaSize B0 = new MediaSize(1000, 1414, MediaSize.MM, MediaSizeName.ISO_B0); + + /** + * ISO B1 paper, 707 mm x 1000 mm + */ + public static final MediaSize B1 = new MediaSize(707, 1000, MediaSize.MM, MediaSizeName.ISO_B1); + + /** + * ISO B2 paper, 500 mm x 707 mm + */ + public static final MediaSize B2 = new MediaSize(500, 707, MediaSize.MM, MediaSizeName.ISO_B2); + + /** + * ISO B3 paper, 353 mm x 500 mm + */ + public static final MediaSize B3 = new MediaSize(353, 500, MediaSize.MM, MediaSizeName.ISO_B3); + + /** + * ISO B4 paper, 250 mm x 353 mm + */ + public static final MediaSize B4 = new MediaSize(250, 353, MediaSize.MM, MediaSizeName.ISO_B4); + + /** + * ISO B5 paper, 176 mm x 250 mm + */ + public static final MediaSize B5 = new MediaSize(176, 250, MediaSize.MM, MediaSizeName.ISO_B5); + + /** + * ISO B6 paper, 125 mm x 176 mm + */ + public static final MediaSize B6 = new MediaSize(125, 176, MediaSize.MM, MediaSizeName.ISO_B6); + + /** + * ISO B7 paper, 88 mm x 125 mm + */ + public static final MediaSize B7 = new MediaSize(88, 125, MediaSize.MM, MediaSizeName.ISO_B7); + + /** + * ISO B8 paper, 62 mm x 88 mm + */ + public static final MediaSize B8 = new MediaSize(62, 88, MediaSize.MM, MediaSizeName.ISO_B8); + + /** + * ISO B9 paper, 44 mm x 62 mm + */ + public static final MediaSize B9 = new MediaSize(44, 62, MediaSize.MM, MediaSizeName.ISO_B9); + + /** + * ISO B10 paper, 31 mm x 44 mm + */ + public static final MediaSize B10 = new MediaSize(31, 44, MediaSize.MM, MediaSizeName.ISO_B10); + + /** + * ISO C3 envelope, 324 mm x 458 mm + */ + public static final MediaSize C3 = new MediaSize(324, 458, MediaSize.MM, MediaSizeName.ISO_C3); + + /** + * ISO C4 envelope, 229 mm x 324 mm + */ + public static final MediaSize C4 = new MediaSize(229, 324, MediaSize.MM, MediaSizeName.ISO_C4); + + /** + * ISO C5 envelope, 162 mm x 229 mm + */ + public static final MediaSize C5 = new MediaSize(162, 229, MediaSize.MM, MediaSizeName.ISO_C5); + + /** + * ISO C6 envelope, 114 mm x 162 mm + */ + public static final MediaSize C6 = new MediaSize(114, 162, MediaSize.MM, MediaSizeName.ISO_C6); + + /** + * ISO ISO Designated Long paper, 324 mm x 458 mm + */ + public static final MediaSize DESIGNATED_LONG = + new MediaSize(324, 458, MediaSize.MM, MediaSizeName.ISO_DESIGNATED_LONG); + } + + /** + * Container class for predefined North American media sizes. + * + * @author Sven de Marothy (sven@physto.se) + */ + public static final class NA + { + private NA() + { + // prevent instantiation + } + + /** + * US Legal paper size, 8.5 inch x 14 inch + */ + public static final MediaSize LEGAL = new MediaSize(8.5f, 14f, MediaSize.INCH, + MediaSizeName.NA_LEGAL); + + /** + * US Letter paper size, 8.5 inch x 11 inch + */ + public static final MediaSize LETTER = new MediaSize(8.5f, 11f, MediaSize.INCH, + MediaSizeName.NA_LETTER); + + /** + * 5 inch x 7 inch paper size. + */ + public static final MediaSize NA_5X7 = new MediaSize(5, 7, MediaSize.INCH, + MediaSizeName.NA_5X7); + + /** + * 8 inch x 10 inch paper size. + */ + public static final MediaSize NA_8X10 = new MediaSize(8, 10, MediaSize.INCH, + MediaSizeName.NA_8X10); + + /** + * 6 inch x 9 inch envelope size. + */ + public static final MediaSize NA_6X9_ENVELOPE = new MediaSize(6f, 9f, + MediaSize.INCH, + MediaSizeName.NA_6X9_ENVELOPE); + + /** + * 7 inch x 9 inch envelope size. + */ + public static final MediaSize NA_7X9_ENVELOPE = new MediaSize(7f, 9f, + MediaSize.INCH, + MediaSizeName.NA_7X9_ENVELOPE); + + /** + * 9 inch x 11 inch envelope size. + */ + public static final MediaSize NA_9x11_ENVELOPE = new MediaSize(9f, 11f, + MediaSize.INCH, + MediaSizeName.NA_9X11_ENVELOPE); + + /** + * 9 inch x 12 inch envelope size. + */ + public static final MediaSize NA_9x12_ENVELOPE = new MediaSize(9f, 12f, + MediaSize.INCH, + MediaSizeName.NA_9X12_ENVELOPE); + + + /** + * 10 inch x 13 inch envelope size. + */ + public static final MediaSize NA_10x13_ENVELOPE = new MediaSize(10f, 13f, + MediaSize.INCH, + MediaSizeName.NA_10X13_ENVELOPE); + + /** + * 10 inch x 14 inch envelope size. + */ + public static final MediaSize NA_10x14_ENVELOPE = new MediaSize(10f, 14f, + MediaSize.INCH, + MediaSizeName.NA_10X14_ENVELOPE); + + /** + * 10 inch x 15 inch envelope size. + */ + public static final MediaSize NA_10X15_ENVELOPE = new MediaSize(10f, 15f, + MediaSize.INCH, + MediaSizeName.NA_10X15_ENVELOPE); + + /** + * Number 9 envelope size. 4.5 inch x 10.375 inch + */ + public static final MediaSize NA_NUMBER_9_ENVELOPE = new MediaSize(3.875f, 8.875f, + MediaSize.INCH, + MediaSizeName.NA_NUMBER_9_ENVELOPE); + + /** + * Number 10 envelope size. 4.125 inch x 9.5 inch + */ + public static final MediaSize NA_NUMBER_10_ENVELOPE = + new MediaSize(4.125f, 9.5f, MediaSize.INCH, MediaSizeName.NA_NUMBER_10_ENVELOPE); + + /** + * Number 11 envelope size. 4.5 inch x 10.375 inch + */ + public static final MediaSize NA_NUMBER_11_ENVELOPE = new MediaSize(4.5f, 10.375f, MediaSize.INCH, + MediaSizeName.NA_NUMBER_11_ENVELOPE); + + /** + * Number 12 envelope size. 4.75 inch x 11 inch + */ + public static final MediaSize NA_NUMBER_12_ENVELOPE = new MediaSize(4.75f, 11f, + MediaSize.INCH, + MediaSizeName.NA_NUMBER_12_ENVELOPE); + + /** + * Number 14 envelope size. 5 inch x 11.5 inch + */ + public static final MediaSize NA_NUMBER_14_ENVELOPE = new MediaSize(5f, 11.5f, + MediaSize.INCH, + MediaSizeName.NA_NUMBER_14_ENVELOPE); + } + + /** + * Container class for predefined US Engineering media sizes. + * + * @author Sven de Marothy (sven@physto.se) + */ + public static final class Engineering + { + private Engineering() + { + // prevent instantiation + } + + /** + * ANSI A paper size. 8.5 inch x 11 inch + */ + public static final MediaSize A = new MediaSize(8.5f, 11f, + MediaSize.INCH, MediaSizeName.A); + + /** + * ANSI B paper size. 11 inch x 17 inch + */ + public static final MediaSize B = new MediaSize(11f, 17f, + MediaSize.INCH, MediaSizeName.B); + + /** + * ANSI C paper size. 17 inch x 22 inch + */ + public static final MediaSize C = new MediaSize(17f, 22f, + MediaSize.INCH, MediaSizeName.C); + + /** + * ANSI D paper size. 22 inch x 34 inch + */ + public static final MediaSize D = new MediaSize(22f, 34f, + MediaSize.INCH, MediaSizeName.D); + + /** + * ANSI E paper size. 33 inch x 44 inch + */ + public static final MediaSize E = new MediaSize(34f, 44f, + MediaSize.INCH, MediaSizeName.E); + } + + /** + * Container class for predefined Japanese JIS media sizes. + * + * @author Sven de Marothy (sven@physto.se) + */ + public static final class JIS + { + private JIS() + { + // prevent instantiation + } + + /** + * JIS B0 paper. 1030 mm x 1456 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B0 = new MediaSize(1030, 1456, MediaSize.MM, MediaSizeName.JIS_B0); + + /** + * JIS B1 paper. 1030 mm x 1456 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B1 = new MediaSize(728, 1030, MediaSize.MM, MediaSizeName.JIS_B1); + + /** + * JIS B2 paper. 515 mm x 728 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B2 = new MediaSize(515, 728, MediaSize.MM, MediaSizeName.JIS_B2); + + /** + * JIS B3 paper. 364 mm x 515 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B3 = new MediaSize(364, 515, MediaSize.MM, MediaSizeName.JIS_B3); + + /** + * JIS B4 paper. 257 mm x 364 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B4 = new MediaSize(257, 364, MediaSize.MM, MediaSizeName.JIS_B4); + + /** + * JIS B5 paper. 1030 mm x 1456 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B5 = new MediaSize(182, 257, MediaSize.MM, MediaSizeName.JIS_B5); + + /** + * JIS B6 paper. 128 mm x 182 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B6 = new MediaSize(128, 182, MediaSize.MM, MediaSizeName.JIS_B6); + + /** + * JIS B7 paper. 91 mm x 128 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B7 = new MediaSize(91, 128, MediaSize.MM, MediaSizeName.JIS_B7); + + /** + * JIS B8 paper. 64 mm x 91 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B8 = new MediaSize(64, 91, MediaSize.MM, MediaSizeName.JIS_B8); + + /** + * JIS B9 paper. 45 mm x 64 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B9 = new MediaSize(45, 64, MediaSize.MM, MediaSizeName.JIS_B9); + + /** + * JIS B10 paper. 32 mm x 45 mm + * Note: The JIS B-series is not identical to the ISO B-series. + */ + public static final MediaSize B10 = new MediaSize(32, 45, MediaSize.MM, MediaSizeName.JIS_B10); + + /** + * JIS chou #1 envelope size, 142 mm x 332 mm + */ + public static final MediaSize CHOU_1 = new MediaSize(142, 332, MediaSize.MM); + + /** + * JIS chou #2 envelope size, 119 mm x 227 mm + */ + public static final MediaSize CHOU_2 = new MediaSize(119, 227, MediaSize.MM); + + /** + * JIS chou #3 envelope size, 120 mm x 235 mm + */ + public static final MediaSize CHOU_3 = new MediaSize(120, 235, MediaSize.MM); + + /** + * JIS chou #4 envelope size, 90 mm x 205 mm + */ + public static final MediaSize CHOU_4 = new MediaSize(90, 205, MediaSize.MM); + + /** + * JIS chou #30 envelope size, 92 mm x 235 mm + */ + public static final MediaSize CHOU_30 = new MediaSize(92, 235, MediaSize.MM); + + /** + * JIS chou #40 envelope size, 90 mm x 225 mm + */ + public static final MediaSize CHOU_40 = new MediaSize(90, 225, MediaSize.MM); + + /** + * JIS kaku #0 envelope size, 287 mm x 382 mm + */ + public static final MediaSize KAKU_0 = new MediaSize(287, 382, MediaSize.MM); + + /** + * JIS kaku #1 envelope size, 270 mm x 382 mm + */ + public static final MediaSize KAKU_1 = new MediaSize(270, 382, MediaSize.MM); + + /** + * JIS kaku #2 envelope size, 240 mm x 332 mm + */ + public static final MediaSize KAKU_2 = new MediaSize(240, 332, MediaSize.MM); + + /** + * JIS kaku #20 envelope size, 229 mm x 324 mm + */ + public static final MediaSize KAKU_20 = new MediaSize(229, 324, MediaSize.MM); + + /** + * JIS kaku #3 envelope size, 216 mm x 227 mm + */ + public static final MediaSize KAKU_3 = new MediaSize(216, 227, MediaSize.MM); + + /** + * JIS kaku #4 envelope size, 197 mm x 267 mm + */ + public static final MediaSize KAKU_4 = new MediaSize(197, 267, MediaSize.MM); + + /** + * JIS kaku #5 envelope size, 190 mm x 240 mm + */ + public static final MediaSize KAKU_5 = new MediaSize(190, 240, MediaSize.MM); + + /** + * JIS kaku #6 envelope size, 162 mm x 229 mm + */ + public static final MediaSize KAKU_6 = new MediaSize(162, 229, MediaSize.MM); + + /** + * JIS kaku #7 envelope size, 142 mm x 205 mm + */ + public static final MediaSize KAKU_7 = new MediaSize(142, 205, MediaSize.MM); + + /** + * JIS kaku #8 envelope size, 119 mm x 197 mm + */ + public static final MediaSize KAKU_8 = new MediaSize(119, 197, MediaSize.MM); + + /** + * JIS kaku A4 envelope size, 228 mm x 312 mm + */ + public static final MediaSize KAKU_A4 = new MediaSize(228, 312, MediaSize.MM); + + /** + * JIS you #1 envelope size, 120 mm x 176 mm + */ + public static final MediaSize YOU_1 = new MediaSize(120, 176, MediaSize.MM); + + /** + * JIS you #2 envelope size, 114 mm x 162 mm + */ + public static final MediaSize YOU_2 = new MediaSize(114, 162, MediaSize.MM); + + /** + * JIS you #3 envelope size, 98 mm x 148 mm + */ + public static final MediaSize YOU_3 = new MediaSize(98, 148, MediaSize.MM); + + /** + * JIS you #4 envelope size, 105 mm x 235 mm + */ + public static final MediaSize YOU_4 = new MediaSize(105, 235, MediaSize.MM); + + /** + * JIS you #5 envelope size, 95 mm x 217 mm + */ + public static final MediaSize YOU_5 = new MediaSize(95, 217, MediaSize.MM); + + /** + * JIS you #6 envelope size, 98 mm x 190 mm + */ + public static final MediaSize YOU_6 = new MediaSize(98, 190, MediaSize.MM); + + /** + * JIS you #7 envelope size, 92 mm x 165 mm + */ + public static final MediaSize YOU_7 = new MediaSize(92, 165, MediaSize.MM); + } + + /** + * Container class for miscellaneous media sizes. + * + * @author Sven de Marothy (sven@physto.se) + */ + public static final class Other + { + private Other() + { + // prevent instantiation + } + + /** + * US Executive paper size, 7.25 inch x 10.5 inch + */ + public static final MediaSize EXECUTIVE = new MediaSize(7.25f, 10.5f, + MediaSize.INCH, MediaSizeName.EXECUTIVE); + + /** + * US Folio paper size, 8.5 inch x 13 inch + */ + public static final MediaSize FOLIO = new MediaSize(8.5f, 13f, MediaSize.INCH, MediaSizeName.FOLIO); + + /** + * US Quarto paper size, 8.5 inches by 10.83 inches. + */ + public static final MediaSize QUARTO = new MediaSize(8.5f, 10.83f, MediaSize.INCH, + MediaSizeName.QUARTO); + + /** + * US Invoice size, 5.5 inch x 8.5 inch + */ + public static final MediaSize INVOICE = new MediaSize(5.5f, 8.5f, + MediaSize.INCH, MediaSizeName.INVOICE); + + /** + * US Ledger size, 11 inch x 17 inch + */ + public static final MediaSize LEDGER = new MediaSize(11, 17, MediaSize.INCH, + MediaSizeName.LEDGER); + + /** + * Monarch (7 3/4) envelope size, 3.87 inch x 7.5 inch + */ + public static final MediaSize MONARCH_ENVELOPE = new MediaSize(3.87f, 7.5f, + MediaSize.INCH, + MediaSizeName.MONARCH_ENVELOPE); + + /** + * Personal envelope size, 3.625 inch x 6.5 inch. + */ + public static final MediaSize PERSONAL_ENVELOPE = new MediaSize(3.625f, 6.5f, MediaSize.INCH, + MediaSizeName.PERSONAL_ENVELOPE); + + /** + * Italian envelope size, 110 mm x 230 mm + */ + public static final MediaSize ITALY_ENVELOPE = new MediaSize(110, 230, + MediaSize.MM, + MediaSizeName.ITALY_ENVELOPE); + + /** + * Japanese postcard, 100 mm x 148 mm + */ + public static final MediaSize JAPANESE_POSTCARD = new MediaSize(100, 148, MediaSize.MM, MediaSizeName.JAPANESE_POSTCARD); + + /** + * Japanese double postcard, 148 mm x 200 mm + */ + public static final MediaSize JAPANESE_DOUBLE_POSTCARD = new MediaSize(148, 200, MediaSize.MM, MediaSizeName.JAPANESE_DOUBLE_POSTCARD); + + /** + * Tabloid size, 11 inch x 17 inch. + * @since 1.5 + */ + public static final MediaSize TABLOID = + new MediaSize(11, 17, Size2DSyntax.INCH, MediaSizeName.TABLOID); + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MediaSizeName.java b/libjava/classpath/javax/print/attribute/standard/MediaSizeName.java new file mode 100644 index 000000000..a6b26b1d5 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MediaSizeName.java @@ -0,0 +1,497 @@ +/* MediaSizeName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.EnumSyntax; + +/** + * MediaSizeName is a subclass of the Media printing + * attribute and provides selection of media to be used by the means of + * defined size names. The class pre-defines commonly available media sizes. + * This media type enumeration may be used in alternative to + * MediaName/MediaTray. + *

+ * IPP Compatibility: MediaSizeName is not an IPP 1.1 attribute on its + * own. It provides parts of the media attribute type values. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class MediaSizeName extends Media +{ + private static final long serialVersionUID = 2778798329756942747L; + + /** + * The ISO A0 size: 841 mm by 1189 mm. + */ + public static final MediaSizeName ISO_A0 = new MediaSizeName(0); + + /** + * The ISO A1 size: 594 mm by 841 mm. + */ + public static final MediaSizeName ISO_A1 = new MediaSizeName(1); + + /** + * The ISO A2 size: 420 mm by 594 mm. + */ + public static final MediaSizeName ISO_A2 = new MediaSizeName(2); + + /** + * The ISO A3 size: 297 mm by 420 mm. + */ + public static final MediaSizeName ISO_A3 = new MediaSizeName(3); + + /** + * The ISO A4 size: 210 mm by 297 mm. + */ + public static final MediaSizeName ISO_A4 = new MediaSizeName(4); + + /** + * The ISO A5 size: 148 mm by 210 mm. + */ + public static final MediaSizeName ISO_A5 = new MediaSizeName(5); + + /** + * The ISO A6 size: 105 mm by 148 mm. + */ + public static final MediaSizeName ISO_A6 = new MediaSizeName(6); + + /** + * The ISO A7 size: 74 mm by 105 mm. + */ + public static final MediaSizeName ISO_A7 = new MediaSizeName(7); + + /** + * The ISO A8 size: 52 mm by 74 mm. + */ + public static final MediaSizeName ISO_A8 = new MediaSizeName(8); + + /** + * The ISO A9 size: 37 mm by 52 mm. + */ + public static final MediaSizeName ISO_A9 = new MediaSizeName(9); + + /** + * The ISO A10 size: 26 mm by 37 mm. + */ + public static final MediaSizeName ISO_A10 = new MediaSizeName(10); + + /** + * The ISO B0 size: 1000 mm by 1414 mm. + */ + public static final MediaSizeName ISO_B0 = new MediaSizeName(11); + + /** + * The ISO B1 size: 707 mm by 1000 mm. + */ + public static final MediaSizeName ISO_B1 = new MediaSizeName(12); + + /** + * The ISO B2 size: 500 mm by 707 mm. + */ + public static final MediaSizeName ISO_B2 = new MediaSizeName(13); + + /** + * The ISO B3 size: 353 mm by 500 mm. + */ + public static final MediaSizeName ISO_B3 = new MediaSizeName(14); + + /** + * The ISO B4 size: 250 mm by 353 mm. + */ + public static final MediaSizeName ISO_B4 = new MediaSizeName(15); + + /** + * The ISO B5 size: 176 mm by 250 mm. + */ + public static final MediaSizeName ISO_B5 = new MediaSizeName(16); + + /** + * The ISO B6 size: 125 mm by 176 mm. + */ + public static final MediaSizeName ISO_B6 = new MediaSizeName(17); + + /** + * The ISO B7 size: 88 mm by 125 mm. + */ + public static final MediaSizeName ISO_B7 = new MediaSizeName(18); + + /** + * The ISO B8 size: 62 mm by 88 mm. + */ + public static final MediaSizeName ISO_B8 = new MediaSizeName(19); + + /** + * The ISO B9 size: 44 mm by 62 mm. + */ + public static final MediaSizeName ISO_B9 = new MediaSizeName(20); + + /** + * The ISO B10 size: 31 mm by 44 mm. + */ + public static final MediaSizeName ISO_B10 = new MediaSizeName(21); + + /** + * The JIS B0 size: 1030mm x 1456mm. + */ + public static final MediaSizeName JIS_B0 = new MediaSizeName(22); + + /** + * The JIS B1 size: 728mm x 1030mm. + */ + public static final MediaSizeName JIS_B1 = new MediaSizeName(23); + + /** + * The JIS B2 size: 515mm x 728mm. + */ + public static final MediaSizeName JIS_B2 = new MediaSizeName(24); + + /** + * The JIS B3 size: 364mm x 515mm. + */ + public static final MediaSizeName JIS_B3 = new MediaSizeName(25); + + /** + * The JIS B4 size: 257mm x 364mm. + */ + public static final MediaSizeName JIS_B4 = new MediaSizeName(26); + + /** + * The JIS B5 size: 182mm x 257mm. + */ + public static final MediaSizeName JIS_B5 = new MediaSizeName(27); + + /** + * The JIS B6 size: 128mm x 182mm. + */ + public static final MediaSizeName JIS_B6 = new MediaSizeName(28); + + /** + * The JIS B7 size: 91mm x 128mm. + */ + public static final MediaSizeName JIS_B7 = new MediaSizeName(29); + + /** + * The JIS B8 size: 64mm x 91mm. + */ + public static final MediaSizeName JIS_B8 = new MediaSizeName(30); + + /** + * The JIS B9 size: 45mm x 64mm. + */ + public static final MediaSizeName JIS_B9 = new MediaSizeName(31); + + /** + * The JIS B10 size: 32mm x 45mm. + */ + public static final MediaSizeName JIS_B10 = new MediaSizeName(32); + + /** + * The ISO C0 size: 917 mm by 1297 mm. + */ + public static final MediaSizeName ISO_C0 = new MediaSizeName(33); + + /** + * The ISO C1 size: 648 mm by 917 mm. + */ + public static final MediaSizeName ISO_C1 = new MediaSizeName(34); + + /** + * The ISO C2 size: 458 mm by 648 mm. + */ + public static final MediaSizeName ISO_C2 = new MediaSizeName(35); + + /** + * The ISO C3 size: 324 mm by 458 mm. + */ + public static final MediaSizeName ISO_C3 = new MediaSizeName(36); + + /** + * The ISO C4 size: 229 mm by 324 mm. + */ + public static final MediaSizeName ISO_C4 = new MediaSizeName(37); + + /** + * The ISO C5 size: 162 mm by 229 mm. + */ + public static final MediaSizeName ISO_C5 = new MediaSizeName(38); + + /** + * The ISO C6 size: 114 mm by 162 mm. + */ + public static final MediaSizeName ISO_C6 = new MediaSizeName(39); + + /** + * The North American letter size: 8.5 inches by 11 inches. + */ + public static final MediaSizeName NA_LETTER = new MediaSizeName(40); + + /** + * The North American legal size: 8.5 inches by 14 inches. + */ + public static final MediaSizeName NA_LEGAL = new MediaSizeName(41); + + /** + * The executive size: 7.25 inches by 10.5 inches. + */ + public static final MediaSizeName EXECUTIVE = new MediaSizeName(42); + + /** + * The ledger size: 11 inches by 17 inches. + */ + public static final MediaSizeName LEDGER = new MediaSizeName(43); + + /** + * The tabloid size: 11 inches by 17 inches. + */ + public static final MediaSizeName TABLOID = new MediaSizeName(44); + + /** + * The invoice size: 5.5 inches by 8.5 inches. + */ + public static final MediaSizeName INVOICE = new MediaSizeName(45); + + /** + * The folio size: 8.5 inches by 13 inches. + */ + public static final MediaSizeName FOLIO = new MediaSizeName(46); + + /** + * The quarto size: 8.5 inches by 10.83 inches. + */ + public static final MediaSizeName QUARTO = new MediaSizeName(47); + + /** + * The Japanese postcard size, 100 mm by 148 mm. + */ + public static final MediaSizeName JAPANESE_POSTCARD = new MediaSizeName(48); + + /** + * The Japanese Double postcard size: 148 mm by 200 mm. + */ + public static final MediaSizeName JAPANESE_DOUBLE_POSTCARD = + new MediaSizeName(49); + + /** + * The engineering ANSI A size medium: 8.5 inches x 11 inches. + */ + public static final MediaSizeName A = new MediaSizeName(50); + + /** + * The engineering ANSI B size medium: 11 inches x 17 inches. + */ + public static final MediaSizeName B = new MediaSizeName(51); + + /** + * The engineering ANSI C size medium: 17 inches x 22 inches. + */ + public static final MediaSizeName C = new MediaSizeName(52); + + /** + * The engineering ANSI D size medium: 22 inches x 34 inches. + */ + public static final MediaSizeName D = new MediaSizeName(53); + + /** + * The engineering ANSI E size medium: 34 inches x 44 inches. + */ + public static final MediaSizeName E = new MediaSizeName(54); + + /** + * The ISO Designated Long size: 110 mm by 220 mm. + */ + public static final MediaSizeName ISO_DESIGNATED_LONG = + new MediaSizeName(55); + + /** + * The Italy envelope size: 110 mm by 230 mm. + */ + public static final MediaSizeName ITALY_ENVELOPE = new MediaSizeName(56); + + /** + * The Monarch envelope size: 3.87 inch by 7.5 inch. + */ + public static final MediaSizeName MONARCH_ENVELOPE = new MediaSizeName(57); + + /** + * The Personal envelope size: 3.625 inch by 6.5 inch. + */ + public static final MediaSizeName PERSONAL_ENVELOPE = new MediaSizeName(58); + + /** + * The North American number 9 business envelope size: + * 3.875 inches by 8.875 inches. + */ + public static final MediaSizeName NA_NUMBER_9_ENVELOPE = + new MediaSizeName(59); + + /** + * The North American number 10 business envelope size: + * 4.125 inches by 9.5 inches. + */ + public static final MediaSizeName NA_NUMBER_10_ENVELOPE = + new MediaSizeName(60); + + /** + * The North American number 11 business envelope size: + * 4.5 inches by 10.375 inches. + */ + public static final MediaSizeName NA_NUMBER_11_ENVELOPE = + new MediaSizeName(61); + + /** + * The North American number 12 business envelope size: + * 4.75 inches by 11 inches. + */ + public static final MediaSizeName NA_NUMBER_12_ENVELOPE = + new MediaSizeName(62); + + /** + * The North American number 14 business envelope size: + * 5 inches by 11.5 inches. + */ + public static final MediaSizeName NA_NUMBER_14_ENVELOPE = + new MediaSizeName(63); + + /** + * The North American 6x9 inch envelope size. + */ + public static final MediaSizeName NA_6X9_ENVELOPE = new MediaSizeName(64); + + /** + * The North American 7x9 inch envelope size. + */ + public static final MediaSizeName NA_7X9_ENVELOPE = new MediaSizeName(65); + + /** + * The North American 9x11 inch envelope size. + */ + public static final MediaSizeName NA_9X11_ENVELOPE = new MediaSizeName(66); + + /** + * The North American 9x12 inch envelope size. + */ + public static final MediaSizeName NA_9X12_ENVELOPE = new MediaSizeName(67); + + /** + * The North American 10x13 inch envelope size. + */ + public static final MediaSizeName NA_10X13_ENVELOPE = new MediaSizeName(68); + + /** + * The North American 10x14 inch envelope size. + */ + public static final MediaSizeName NA_10X14_ENVELOPE = new MediaSizeName(69); + + /** + * The North American 10x15 inch envelope size. + */ + public static final MediaSizeName NA_10X15_ENVELOPE = new MediaSizeName(70); + + /** + * The North American 5 inches by 7 inches. + */ + public static final MediaSizeName NA_5X7 = new MediaSizeName(71); + + /** + * The North American 8 inches by 10 inches. + */ + public static final MediaSizeName NA_8X10 = new MediaSizeName(72); + + private static final String[] stringTable = + { "iso-a0", "iso-a1", "iso-a2", "iso-a3", "iso-a4", "iso-a5", "iso-a6", + "iso-a7", "iso-a8", "iso-a9", "iso-a10", "iso-b0", "iso-b1", "iso-b2", + "iso-b3", "iso-b4", "iso-b5", "iso-b6", "iso-b7", "iso-b8", "iso-b9", + "iso-b10", "jis-b0", "jis-b1", "jis-b2", "jis-b3", "jis-b4", "jis-b5", + "jis-b6", "jis-b7", "jis-b8", "jis-b9", "jis-b10", "iso-c0", "iso-c1", + "iso-c2", "iso-c3", "iso-c4", "iso-c5", "iso-c6", "na-letter", + "na-legal", "executive", "ledger", "tabloid", "invoice", "folio", + "quarto", "japanese-postcard", "oufuko-postcard", "a", "b", "c", "d", + "e", "iso-designated-long", "italian-envelope", "monarch-envelope", + "personal-envelope", "na-number-9-envelope", "na-number-10-envelope", + "na-number-11-envelope", "na-number-12-envelope", + "na-number-14-envelope", "na-6x9-envelope", "na-7x9-envelope", + "na-9x11-envelope", "na-9x12-envelope", "na-10x13-envelope", + "na-10x14-envelope", "na-10x15-envelope", "na-5x7", "na-8x10" }; + + private static final MediaSizeName[] enumValueTable = + { ISO_A0, ISO_A1, ISO_A2, ISO_A3, ISO_A4, ISO_A5, ISO_A6, ISO_A7, ISO_A8, + ISO_A9, ISO_A10, ISO_B0, ISO_B1, ISO_B2, ISO_B3, ISO_B4, ISO_B5, ISO_B6, + ISO_B7, ISO_B8, ISO_B9, ISO_B10, JIS_B0, JIS_B1, JIS_B2, JIS_B3, JIS_B4, + JIS_B5, JIS_B6, JIS_B7, JIS_B8, JIS_B9, JIS_B10, ISO_C0, ISO_C1, ISO_C2, + ISO_C3, ISO_C4, ISO_C5, ISO_C6, NA_LETTER, NA_LEGAL, EXECUTIVE, LEDGER, + TABLOID, INVOICE, FOLIO, QUARTO, JAPANESE_POSTCARD, + JAPANESE_DOUBLE_POSTCARD, A, B, C, D, E, ISO_DESIGNATED_LONG, + ITALY_ENVELOPE, MONARCH_ENVELOPE, PERSONAL_ENVELOPE, + NA_NUMBER_9_ENVELOPE, NA_NUMBER_10_ENVELOPE, NA_NUMBER_11_ENVELOPE, + NA_NUMBER_12_ENVELOPE, NA_NUMBER_14_ENVELOPE, NA_6X9_ENVELOPE, + NA_7X9_ENVELOPE, NA_9X11_ENVELOPE, NA_9X12_ENVELOPE, NA_10X13_ENVELOPE, + NA_10X14_ENVELOPE, NA_10X15_ENVELOPE, NA_5X7, NA_8X10 }; + + /** + * Constructs a MediaSizeName object. + * + * @param value the enum value. + */ + protected MediaSizeName(int value) + { + super(value); + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MediaTray.java b/libjava/classpath/javax/print/attribute/standard/MediaTray.java new file mode 100644 index 000000000..836640c81 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MediaTray.java @@ -0,0 +1,141 @@ +/* MediaTray.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.EnumSyntax; + +/** + * MediaTray is a subclass of the Media printing + * attribute and provides selection of media to be used by the means of the + * input tray of the printer. The class pre-defines commonly available types + * of input trays in printers. This media type enumeration may be used in + * alternative to MediaSizeName/MediaName. + *

+ * IPP Compatibility: MediaTray is not an IPP 1.1 attribute on its own. + * It provides parts of the media attribute type values. + *

+ * + * @author Sven de Marothy + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class MediaTray extends Media +{ + + private static final long serialVersionUID = -982503611095214703L; + + /** + * Top tray + */ + public static final MediaTray TOP = new MediaTray(0); + + /** + * Middle tray + */ + public static final MediaTray MIDDLE = new MediaTray(1); + + /** + * Bottom tray + */ + public static final MediaTray BOTTOM = new MediaTray(2); + + /** + * Envelope tray + */ + public static final MediaTray ENVELOPE = new MediaTray(3); + + /** + * Manual-feed tray + */ + public static final MediaTray MANUAL = new MediaTray(4); + + /** + * Large capacity tray + */ + public static final MediaTray LARGE_CAPACITY = new MediaTray(5); + + /** + * Main tray + */ + public static final MediaTray MAIN = new MediaTray(6); + + /** + * Side tray + */ + public static final MediaTray SIDE = new MediaTray(7); + + private static final String[] stringTable = { "top", "middle", "bottom", + "envelope", "manual", + "large-capacity", "main", + "side" }; + + private static final MediaTray[] enumValueTable = { TOP, MIDDLE, BOTTOM, + ENVELOPE, MANUAL, + LARGE_CAPACITY, MAIN, + SIDE }; + + /** + * Creates a MediaTray object. + * + * @param i the enum value. + */ + protected MediaTray(int i) + { + super( i ); + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/MultipleDocumentHandling.java b/libjava/classpath/javax/print/attribute/standard/MultipleDocumentHandling.java new file mode 100644 index 000000000..feb01ea4c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/MultipleDocumentHandling.java @@ -0,0 +1,147 @@ +/* MultipleDocumentHandling.java -- + Copyright (C) 2004, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The MultipleDocumentHandling printing attribute controls + * how certain printing attributes affect printing in case of multiple + * documents in a print job. This attribute is only relevant if a job + * has multiple documents. + *

+ * IPP Compatibility: MultipleDocumentHandling is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class MultipleDocumentHandling extends EnumSyntax + implements PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 8098326460746413466L; + + /** + * Multiple documents are treated as a single document. + */ + public static final MultipleDocumentHandling SINGLE_DOCUMENT = + new MultipleDocumentHandling(0); + + /** + * Multiple documents are treated as uncollated copies. + */ + public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_UNCOLLATED_COPIES = + new MultipleDocumentHandling(1); + + /** + * Multiple documents are treated as collated copies. + */ + public static final MultipleDocumentHandling SEPARATE_DOCUMENTS_COLLATED_COPIES = + new MultipleDocumentHandling(2); + + /** + * Multiple documents are treated so that every single document starts + * with a new sheet. + */ + public static final MultipleDocumentHandling SINGLE_DOCUMENT_NEW_SHEET = + new MultipleDocumentHandling(3); + + private static final String[] stringTable = { "single-document", + "separate-documents-uncollated-copies", + "separate-documents-collated-copies", + "single-document-new-sheet" }; + + private static final MultipleDocumentHandling[] enumValueTable = + { SINGLE_DOCUMENT, SEPARATE_DOCUMENTS_UNCOLLATED_COPIES, + SEPARATE_DOCUMENTS_COLLATED_COPIES, SINGLE_DOCUMENT_NEW_SHEET}; + + /** + * Constructs a MultipleDocumentHandling object. + * + * @param value the enum value + */ + protected MultipleDocumentHandling(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class MultipleDocumentHandling itself. + */ + public Class< ? extends Attribute> getCategory() + { + return MultipleDocumentHandling.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "multiple-document-handling". + */ + public final String getName() + { + return "multiple-document-handling"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/NumberOfDocuments.java b/libjava/classpath/javax/print/attribute/standard/NumberOfDocuments.java new file mode 100644 index 000000000..217df0d87 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/NumberOfDocuments.java @@ -0,0 +1,108 @@ +/* NumberOfDocuments.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The NumberOfDocuments printing attribute specifies + * the number of documents in a job. + *

+ * IPP Compatibility: NumberOfDocuments is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch + */ +public final class NumberOfDocuments extends IntegerSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 7891881310684461097L; + + /** + * Creates a NumberOfDocuments object. + * + * @param value the number of documents + * + * @exception IllegalArgumentException if value < 0 + */ + public NumberOfDocuments(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof NumberOfDocuments)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class NumberOfDocuments itself. + */ + public Class< ? extends Attribute> getCategory() + { + return NumberOfDocuments.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "number-of-documents". + */ + public String getName() + { + return "number-of-documents"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/NumberOfInterveningJobs.java b/libjava/classpath/javax/print/attribute/standard/NumberOfInterveningJobs.java new file mode 100644 index 000000000..d33d826c8 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/NumberOfInterveningJobs.java @@ -0,0 +1,109 @@ +/* NumberOfInterveningJobs.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; + +/** + * The NumberOfInterveningJobs printing attribute provides + * the number of jobs ahead in the print service queue before the + * requested job. + *

+ * IPP Compatibility: NumberOfInterveningJobs is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch + */ +public final class NumberOfInterveningJobs extends IntegerSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 2568141124844982746L; + + /** + * Creates a NumberOfInterveningJobs object. + * + * @param value the number of intervening jobs + * + * @exception IllegalArgumentException if value < 0 + */ + public NumberOfInterveningJobs(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof NumberOfInterveningJobs)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class NumberOfInterveningJobs itself. + */ + public Class< ? extends Attribute> getCategory() + { + return NumberOfInterveningJobs.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "number-of-intervening-jobs". + */ + public String getName() + { + return "number-of-intervening-jobs"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/NumberUp.java b/libjava/classpath/javax/print/attribute/standard/NumberUp.java new file mode 100644 index 000000000..82779070e --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/NumberUp.java @@ -0,0 +1,113 @@ +/* NumberUp.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + +/** + * The NumberUp printing attribute specifies the number of pages + * to be arranged upon a single media sheet. + *

+ * Note: The effect of this attribute on jobs with multiple documents + * is controlled by the job attribute + * {@link javax.print.attribute.standard.MultipleDocumentHandling}. + *

+ *

+ * IPP Compatibility: NumberUp is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch + */ +public final class NumberUp extends IntegerSyntax + implements DocAttribute, PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -3040436486786527811L; + + /** + * Creates a NumberUp object. + * + * @param value the number of print-stream pages to print on a single side + * of a media + * + * @exception IllegalArgumentException if value < 1 + */ + public NumberUp(int value) + { + super(value); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof NumberUp)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class NumberUp itself. + */ + public Class< ? extends Attribute> getCategory() + { + return NumberUp.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "number-up". + */ + public String getName() + { + return "number-up"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/NumberUpSupported.java b/libjava/classpath/javax/print/attribute/standard/NumberUpSupported.java new file mode 100644 index 000000000..62f417b89 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/NumberUpSupported.java @@ -0,0 +1,146 @@ +/* NumberUpSupported.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.SetOfIntegerSyntax; +import javax.print.attribute.SupportedValuesAttribute; + + +/** + * The NumberUpSupported printing attribute specifies the + * supported value or range of values for the + * {@link javax.print.attribute.standard.NumberUp} attribute. + *

+ * IPP Compatibility: NumberUpSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class NumberUpSupported extends SetOfIntegerSyntax + implements SupportedValuesAttribute +{ + private static final long serialVersionUID = -1041573395759141805L; + + /** + * Constructs a NumberUpSupported object. + * + * @param member the only one value supported for number up. + * + * @exception IllegalArgumentException if member is < 1 + */ + public NumberUpSupported(int member) + { + super(member); + + if (member < 1) + throw new IllegalArgumentException("member may not be less than 1"); + } + + /** + * Constructs a NumberUpSupported object. + * + * @param members the members supported for number up. + * + * @exception IllegalArgumentException if any element is invalid + * @exception NullPointerException if members is null or any + * element of members is null. + */ + public NumberUpSupported(int[][] members) + { + super(members); + + if (members == null) + throw new NullPointerException("members may not be null"); + } + + /** + * Constructs a NumberUpSupported object with the + * given range for supported number up values. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 1 + */ + public NumberUpSupported(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerBound may not be less than 1"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof NumberUpSupported)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class NumberUpSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return NumberUpSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "number-up-supported". + */ + public String getName() + { + return "number-up-supported"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/OrientationRequested.java b/libjava/classpath/javax/print/attribute/standard/OrientationRequested.java new file mode 100644 index 000000000..c24fab458 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/OrientationRequested.java @@ -0,0 +1,161 @@ +/* OrientationRequested.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The OrientationRequested printing attribute specifies + * the desired orientation of the print data on the media sheet. + *

+ * The effect of this attribute may depend on the document format as + * some document formats (e.g. postscript) contains the orientation + * inside the print data. However for other formats like e.g. plain + * text this attribute will have an effect on the orientation. + *

+ *

+ * IPP Compatibility: OrientationRequested is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class OrientationRequested extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = -4447437289862822276L; + + /** + * Orientation as portrait. + */ + public static final OrientationRequested PORTRAIT = + new OrientationRequested(3); + + /** + * Orientation as landscape. + */ + public static final OrientationRequested LANDSCAPE = + new OrientationRequested(4); + + /** + * Orientation as reversed landscape. + */ + public static final OrientationRequested REVERSE_LANDSCAPE = + new OrientationRequested(5); + + /** + * Orientation as reversed portrait. + */ + public static final OrientationRequested REVERSE_PORTRAIT = + new OrientationRequested(6); + + + private static final String[] stringTable = { "portrait", "landscape", + "reverse-landscape", + "reverse-portrait" }; + + private static final OrientationRequested[] + enumValueTable = { PORTRAIT, LANDSCAPE, + REVERSE_LANDSCAPE, REVERSE_PORTRAIT }; + + /** + * Constructs a OrientationRequested object. + * + * @param value the value + */ + protected OrientationRequested(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class OrientationRequested itself. + */ + public Class< ? extends Attribute> getCategory() + { + return OrientationRequested.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "orientation-requested". + */ + public String getName() + { + return "orientation-requested"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/OutputDeviceAssigned.java b/libjava/classpath/javax/print/attribute/standard/OutputDeviceAssigned.java new file mode 100644 index 000000000..769cef1e8 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/OutputDeviceAssigned.java @@ -0,0 +1,116 @@ +/* OutputDeviceAssigned.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The OutputDeviceAssigned printing attribute specifies the + * output printer device assigned by a print service to a print job. + *

+ * This may be empty if a print service is embedded in a printer, e.g. is the + * output device. However there exist print services with several physical + * output devices (e.g. CUPS classes) where this attribute provides the actual + * output device. + *

+ *

+ * IPP Compatibility: OutputDeviceAssigned is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class OutputDeviceAssigned extends TextSyntax + implements PrintJobAttribute +{ + private static final long serialVersionUID = 5486733778854271081L; + + /** + * Creates a OutputDeviceAssigned object. + * + * @param deviceName the name of the device. + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if deviceName is null. + */ + public OutputDeviceAssigned(String deviceName, Locale locale) + { + super(deviceName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof OutputDeviceAssigned)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class OutputDeviceAssigned itself. + */ + public Class< ? extends Attribute> getCategory() + { + return OutputDeviceAssigned.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "output-device-assigned". + */ + public String getName() + { + return "output-device-assigned"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PDLOverrideSupported.java b/libjava/classpath/javax/print/attribute/standard/PDLOverrideSupported.java new file mode 100644 index 000000000..310264a0c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PDLOverrideSupported.java @@ -0,0 +1,130 @@ +/* PDLOverrideSupported.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintServiceAttribute; + + +/** + * The PDLOverrideSupported printing attribute specifies + * if a print services is capable of attempting to override document data + * instructions with IPP attributesc. + *

+ * IPP Compatibility: PDLOverrideSupported is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class PDLOverrideSupported extends EnumSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -4393264467928463934L; + + /** + * Indicates that the print service is not capable of + * attempting to override document data instructions. + */ + public static final PDLOverrideSupported NOT_ATTEMPTED = + new PDLOverrideSupported(0); + + /** + * Indicates that the print service is capable of + * attempting to override document data instructions. + */ + public static final PDLOverrideSupported ATTEMPTED = + new PDLOverrideSupported(1); + + private static final String[] stringTable = { "not-attempted", "attempted" }; + + private static final PDLOverrideSupported[] enumValueTable = { NOT_ATTEMPTED, + ATTEMPTED}; + + /** + * Constructs a PDLOverrideSupported object. + * + * @param value the enum value + */ + protected PDLOverrideSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PDLOverrideSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PDLOverrideSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "pdl-override-supported". + */ + public final String getName() + { + return "pdl-override-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PageRanges.java b/libjava/classpath/javax/print/attribute/standard/PageRanges.java new file mode 100644 index 000000000..2250868d7 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PageRanges.java @@ -0,0 +1,172 @@ +/* PageRanges.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.SetOfIntegerSyntax; + +/** + * The PageRanges printing attribute specifies the + * range(s) of pages to be printed in a print job. + *

+ * Note: The effect of this attribute on jobs with multiple + * documents is controlled by the job attribute + * {@link javax.print.attribute.standard.MultipleDocumentHandling}. + *

+ *

+ * IPP Compatibility: PageRanges is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PageRanges extends SetOfIntegerSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = 8639895197656148392L; + + /** + * Constructs a PageRanges object with only one + * page to be printed. + * + * @param member the only page to be printed. + * + * @exception IllegalArgumentException if member is < 1 + */ + public PageRanges(int member) + { + super(member); + + if (member < 1) + throw new IllegalArgumentException("member may not be less than 1"); + } + + /** + * Constructs a PageRanges object with a set + * of ranges to be printed. + * + * @param members the page ranges to be printed. + * + * @exception IllegalArgumentException if any element is invalid + * @exception NullPointerException if members is null or any + * element of members is null. + */ + public PageRanges(int[][] members) + { + super(members); + + if (members == null) + throw new NullPointerException("members may not be null"); + } + + /** + * Constructs a PageRanges object with the + * given single range of pages to be printed. + * + * @param lowerBound the lower bound value + * @param upperBound the upper bound value + * + * @exception IllegalArgumentException if lowerBound <= upperbound + * and lowerBound < 1 + */ + public PageRanges(int lowerBound, int upperBound) + { + super(lowerBound, upperBound); + + if (lowerBound < 1) + throw new IllegalArgumentException("lowerbound may not be less than 1"); + } + + /** + * Constructs a PageRanges object with a set + * of ranges to be printed in string array form. + * + * @param members the page ranges to be printed in string form. + * + * @exception IllegalArgumentException if any element is invalid. + * @exception NullPointerException if members is null or any + * element of members is null. + */ + public PageRanges(String members) + { + super(members); + + if (members == null) + throw new NullPointerException("members may not be null"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if (! (obj instanceof PageRanges)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PageRanges itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PageRanges.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "page-ranges". + */ + public String getName() + { + return "page-ranges"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PagesPerMinute.java b/libjava/classpath/javax/print/attribute/standard/PagesPerMinute.java new file mode 100644 index 000000000..bd086817a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PagesPerMinute.java @@ -0,0 +1,110 @@ +/* PagesPerMinute.java -- + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintServiceAttribute; + +/** + * The PagesPerMinute printing attribute specifies + * the nominal number of pages per minute which may be printed + * by the printer. + *

+ * IPP Compatibility: PagesPerMinute is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PagesPerMinute extends IntegerSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -6366403993072862015L; + + /** + * Creates a PagesPerMinute object. + * + * @param value the number of pages per minute + * + * @exception IllegalArgumentException if value < 0 + */ + public PagesPerMinute(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PagesPerMinute)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PagesPerMinute itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PagesPerMinute.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "pages-per-minute". + */ + public String getName() + { + return "pages-per-minute"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PagesPerMinuteColor.java b/libjava/classpath/javax/print/attribute/standard/PagesPerMinuteColor.java new file mode 100644 index 000000000..f32bbdb19 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PagesPerMinuteColor.java @@ -0,0 +1,109 @@ +/* PagesPerMinuteColor.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintServiceAttribute; + +/** + * The PagesPerMinuteColor printing attribute specifies + * the nominal number of pages per minute which may be printed in + * color by the printer. + *

+ * IPP Compatibility: PagesPerMinuteColor is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch + */ +public final class PagesPerMinuteColor extends IntegerSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 1684993151687470944L; + + /** + * Creates a PagesPerMinuteColor object. + * + * @param value the number of pages per minute in color + * + * @exception IllegalArgumentException if value < 0 + */ + public PagesPerMinuteColor(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PagesPerMinuteColor)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PagesPerMinuteColor itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PagesPerMinuteColor.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "pages-per-minute-color". + */ + public String getName() + { + return "pages-per-minute-color"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PresentationDirection.java b/libjava/classpath/javax/print/attribute/standard/PresentationDirection.java new file mode 100644 index 000000000..62c19b241 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PresentationDirection.java @@ -0,0 +1,177 @@ +/* PresentationDirection.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The PresentationDirection attribute specifies + * a value to be used together with the NumberUp attribute + * to indicate the layout of multiple pages on a single media sheet. + *

+ * IPP Compatibility: PresentationDirection is not an IPP 1.1 + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PresentationDirection extends EnumSyntax + implements PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = 8294728067230931780L; + + /** + * The single pages are arranged on the media in columns starting + * at the top left towards the bottom left. + */ + public static final PresentationDirection TOBOTTOM_TORIGHT = + new PresentationDirection(0); + + /** + * The single pages are arranged on the media in columns starting + * at the top right towards the bottom left. + */ + public static final PresentationDirection TOBOTTOM_TOLEFT = + new PresentationDirection(1); + + /** + * The single pages are arranged on the media in columns starting + * at the bottom left towards the top right. + */ + public static final PresentationDirection TOTOP_TORIGHT = + new PresentationDirection(2); + + /** + * The single pages are arranged on the media in columns starting + * at the bottom right towards the top left. + */ + public static final PresentationDirection TOTOP_TOLEFT = + new PresentationDirection(3); + + /** + * The single pages are arranged on the media in rows starting + * at the top left towards the right bottom. + */ + public static final PresentationDirection TORIGHT_TOBOTTOM = + new PresentationDirection(4); + + /** + * The single pages are arranged on the media in rows starting + * at the bottom left towards the right top. + */ + public static final PresentationDirection TORIGHT_TOTOP = + new PresentationDirection(5); + + /** + * The single pages are arranged on the media in rows starting + * at the top right towards the left bottom. + */ + public static final PresentationDirection TOLEFT_TOBOTTOM = + new PresentationDirection(6); + + /** + * The single pages are arranged on the media in rows starting + * at the bottom right towards the left top. + */ + public static final PresentationDirection TOLEFT_TOTOP = + new PresentationDirection(7); + + private static final String[] stringTable = { "tobottom-toright", + "tobottom-toleft", "totop-toright", "totop-toleft", "toright-tobottom", + "toright-totop", "toleft-tobottom", "toleft-totop" }; + + private static final PresentationDirection[] enumValueTable = + { TOBOTTOM_TORIGHT, TOBOTTOM_TOLEFT, TOTOP_TORIGHT, TOTOP_TOLEFT, + TORIGHT_TOBOTTOM, TORIGHT_TOTOP, TOLEFT_TOBOTTOM, TOLEFT_TOTOP }; + + /** + * Constructs a PresentationDirection object. + * + * @param value the enum value. + */ + private PresentationDirection(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PresentationDirection itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PresentationDirection.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "presentation-direction". + */ + public String getName() + { + return "presentation-direction"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrintQuality.java b/libjava/classpath/javax/print/attribute/standard/PrintQuality.java new file mode 100644 index 000000000..aa65e89a7 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrintQuality.java @@ -0,0 +1,141 @@ +/* PrintQuality.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The PrintQuality printing attribute specifies the + * print quality that should be used by the print services for a job. + *

+ * IPP Compatibility: PrintQuality is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class PrintQuality extends EnumSyntax + implements DocAttribute, PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = -3072341285225858365L; + + /** + * Draft quality of the printer. + */ + public static final PrintQuality DRAFT = new PrintQuality(3); + + /** + * Normal quality of the printer. + */ + public static final PrintQuality NORMAL = new PrintQuality(4); + + /** + * High quality of the printer. + */ + public static final PrintQuality HIGH = new PrintQuality(5); + + private static final String[] stringTable = { "draft", "normal", "high" }; + + private static final PrintQuality[] enumValueTable = { DRAFT, NORMAL, HIGH }; + + /** + * Constructs a PrintQuality object. + * + * @param value the value of the enum + */ + protected PrintQuality(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PrintQuality itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrintQuality.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "print-quality". + */ + public final String getName() + { + return "print-quality"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } + + /** + * Returns the lowest used value by the enumerations of this class. + * . + * @return The lowest value used. + */ + protected int getOffset() + { + return 3; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterInfo.java b/libjava/classpath/javax/print/attribute/standard/PrinterInfo.java new file mode 100644 index 000000000..01d2065bf --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterInfo.java @@ -0,0 +1,110 @@ +/* PrinterInfo.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The PrinterInfo printing attribute provides + * informations about a printer device. + *

+ * IPP Compatibility: PrinterInfo is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PrinterInfo extends TextSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 7765280618777599727L; + + /** + * Creates a PrinterInfo object. + * + * @param printerInfo the printer info + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if printerInfo is null. + */ + public PrinterInfo(String printerInfo, Locale locale) + { + super(printerInfo, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterInfo)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterInfo itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterInfo.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-info". + */ + public String getName() + { + return "printer-info"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterIsAcceptingJobs.java b/libjava/classpath/javax/print/attribute/standard/PrinterIsAcceptingJobs.java new file mode 100644 index 000000000..5ac6bf71d --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterIsAcceptingJobs.java @@ -0,0 +1,132 @@ +/* PrinterIsAcceptingJobs.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintServiceAttribute; + + +/** + * The PrinterIsAcceptingJobs printing attribute signals + * if a print services is currently accepting jobs. + *

+ * IPP Compatibility: PrinterIsAcceptingJobs is an IPP 1.1 attribute. + * The IPP specification treats PrinterIsAcceptingJobs as boolean type which + * is not available in the Java Print Service API. The IPP boolean value "true" + * corresponds to ACCEPTING_JOBS and "false" + * to NOT_ACCEPTING_JOBS. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterIsAcceptingJobs extends EnumSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -5052010680537678061L; + + /** + * The printer is not accepting jobs currently. + */ + public static final PrinterIsAcceptingJobs NOT_ACCEPTING_JOBS = + new PrinterIsAcceptingJobs(0); + + /** + * The printer is accepting jobs. + */ + public static final PrinterIsAcceptingJobs ACCEPTING_JOBS = + new PrinterIsAcceptingJobs(1); + + private static final String[] stringTable = { "not-accepting-jobs", + "accepting-jobs" }; + + private static final PrinterIsAcceptingJobs[] enumValueTable = + { NOT_ACCEPTING_JOBS, ACCEPTING_JOBS }; + + /** + * Constructs a PrinterIsAcceptingJobs object. + * + * @param value the enum value. + */ + protected PrinterIsAcceptingJobs(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PrinterIsAcceptingJobs itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterIsAcceptingJobs.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-is-accepting-jobs". + */ + public String getName() + { + return "printer-is-accepting-jobs"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterLocation.java b/libjava/classpath/javax/print/attribute/standard/PrinterLocation.java new file mode 100644 index 000000000..934f1bdd3 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterLocation.java @@ -0,0 +1,110 @@ +/* PrinterLocation.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The PrinterLocation printing attribute provides the location + * of a printer device. This may be a room and building name for example. + *

+ * IPP Compatibility: PrinterLocation is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PrinterLocation extends TextSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -1598610039865566337L; + + /** + * Creates a PrinterLocation object. + * + * @param printerLocation the printer location + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if printerLocation is null. + */ + public PrinterLocation(String printerLocation, Locale locale) + { + super(printerLocation, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterLocation)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterLocation itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterLocation.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-location". + */ + public String getName() + { + return "printer-location"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterMakeAndModel.java b/libjava/classpath/javax/print/attribute/standard/PrinterMakeAndModel.java new file mode 100644 index 000000000..a78fe1472 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterMakeAndModel.java @@ -0,0 +1,110 @@ +/* PrinterMakeAndModel.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The PrinterMakeAndModel printing attribute provides the name + * of the maker and the model of the printer. + *

+ * IPP Compatibility: PrinterMakeAndModel is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PrinterMakeAndModel extends TextSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 4580461489499351411L; + + /** + * Creates a PrinterMakeAndModel object. + * + * @param makeAndModel the make and model string + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if makeAndModel is null. + */ + public PrinterMakeAndModel(String makeAndModel, Locale locale) + { + super(makeAndModel, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterMakeAndModel)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterMakeAndModel itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterMakeAndModel.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-make-and-model". + */ + public String getName() + { + return "printer-make-and-model"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterMessageFromOperator.java b/libjava/classpath/javax/print/attribute/standard/PrinterMessageFromOperator.java new file mode 100644 index 000000000..3bd3ee41c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterMessageFromOperator.java @@ -0,0 +1,113 @@ +/* PrinterMessageFromOperator.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The PrinterMessageFromOperator printing attribute provides + * a message from an operator or a system administrator related to the + * printer. This may include informations about the status of the printer + * or expected downtimes, etc. + *

+ * IPP Compatibility: PrinterMessageFromOperator is an IPP 1.1 + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PrinterMessageFromOperator extends TextSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -4486871203218629318L; + + /** + * Creates a PrinterMessageFromOperator object. + * + * @param message the message + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if message is null. + */ + public PrinterMessageFromOperator(String message, Locale locale) + { + super(message, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterMessageFromOperator)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterMessageFromOperator itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterMessageFromOperator.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-message-from-operator". + */ + public String getName() + { + return "printer-message-from-operator"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfo.java b/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfo.java new file mode 100644 index 000000000..4af33c664 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfo.java @@ -0,0 +1,112 @@ +/* PrinterMoreInfo.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.URISyntax; + +/** + * The PrinterMoreInfo attribute provides a URI that can be used + * to obtain more information about the printer. + *

+ * The URI may for example contain a reference to a HTML page with information. + * The information is normally intended for end users. + *

+ *

+ * IPP Compatibility: PrinterMoreInfo is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterMoreInfo extends URISyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 4555850007675338574L; + + /** + * Constructs a PrinterMoreInfo object. + * + * @param uri the URI of the information. + * @throws NullPointerException if the given uri is null. + */ + public PrinterMoreInfo(URI uri) + { + super(uri); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterMoreInfo)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterMoreInfo itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterMoreInfo.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-more-info". + */ + public String getName() + { + return "printer-more-info"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java b/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java new file mode 100644 index 000000000..a0425d3a7 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterMoreInfoManufacturer.java @@ -0,0 +1,116 @@ +/* PrinterMoreInfoManufacturer.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.URISyntax; + +/** + * The PrinterMoreInfoManufacturer attribute provides a URI that + * can be used to obtain more information about the printer device type and + * its manufacturer. + *

+ * The URI may for example contain a reference to a website of the + * manufacturer, containing informations and links to the latest firmware, + * printer drivers, manual etc. The information is normally intended for + * end users. + *

+ *

+ * IPP Compatibility: PrinterMoreInfoManufacturer is an IPP 1.1 + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterMoreInfoManufacturer extends URISyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 3323271346485076608L; + + /** + * Constructs a PrinterMoreInfoManufacturer object. + * + * @param uri the URI of the information.. + * @throws NullPointerException if the given uri is null. + */ + public PrinterMoreInfoManufacturer(URI uri) + { + super(uri); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterMoreInfoManufacturer)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterMoreInfoManufacturer itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterMoreInfoManufacturer.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-more-info-manufacturer". + */ + public String getName() + { + return "printer-more-info-manufacturer"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterName.java b/libjava/classpath/javax/print/attribute/standard/PrinterName.java new file mode 100644 index 000000000..854826c67 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterName.java @@ -0,0 +1,112 @@ +/* PrinterName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The PrinterName printing attribute provides the name of a + * print service. The name may but must not be related to parts of the + * printer URI. + *

+ * IPP Compatibility: PrinterName is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.PrinterURI + * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class PrinterName extends TextSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 299740639137803127L; + + /** + * Creates a PrinterName object. + * + * @param printerName the printer name + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if printerName is null. + */ + public PrinterName(String printerName, Locale locale) + { + super(printerName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterName)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterName itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterName.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-name". + */ + public String getName() + { + return "printer-name"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterResolution.java b/libjava/classpath/javax/print/attribute/standard/PrinterResolution.java new file mode 100644 index 000000000..acf3a63dc --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterResolution.java @@ -0,0 +1,113 @@ +/* PrinterResolution.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.ResolutionSyntax; + + +/** + * The PrinterResolution printing attribute specifies a + * resolution supported by a print service or to be used by a print job. + *

+ * IPP Compatibility: PrinterResolution is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterResolution extends ResolutionSyntax + implements DocAttribute, PrintJobAttribute, PrintRequestAttribute +{ + private static final long serialVersionUID = 13090306561090558L; + + /** + * Creates a PrinterResolution object with the given cross + * feed and feed resolutions. + * + * @param crossFeedResolution the cross feed resolution + * @param feedResolution the feed resolution + * @param units the unit to use (e.g. {@link #DPCM} or {@link #DPI}) + * + * @exception IllegalArgumentException if either parameter is < 1 + */ + public PrinterResolution(int crossFeedResolution, int feedResolution, + int units) + { + super(crossFeedResolution, feedResolution, units); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterResolution)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterResolution itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterResolution.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-resolution". + */ + public String getName() + { + return "printer-resolution"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterState.java b/libjava/classpath/javax/print/attribute/standard/PrinterState.java new file mode 100644 index 000000000..7670e144c --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterState.java @@ -0,0 +1,147 @@ +/* PrinterState.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintServiceAttribute; + + +/** + * The PrinterState printing attribute reports + * the current state of the printer device. + *

+ * The {@link javax.print.attribute.standard.PrinterStateReasons} + * attribute provides further detailed information about + * the given printer state. Detailed information about the printer + * state and printer state reasons attributes can be found in the + * RFC 2911. + *

+ *

+ * IPP Compatibility: PrinterState is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterState extends EnumSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -649578618346507718L; + + /** + * The state is unknown currently. + */ + public static final PrinterState UNKNOWN = new PrinterState(0); + + /** + * The printer device is in idle state. New jobs can start + * processing without waiting. + */ + public static final PrinterState IDLE = new PrinterState(3); + + /** + * The printer device is in processing state. + */ + public static final PrinterState PROCESSING = new PrinterState(4); + + /** + * The printer device has stopped. No jobs can be processed and + * normally manual intervention is needed. + */ + public static final PrinterState STOPPED = new PrinterState(5); + + private static final String[] stringTable = { "unknown", null, null, + "idle", "processing", + "stopped" }; + + private static final PrinterState[] enumValueTable = { UNKNOWN, null, null, + IDLE, PROCESSING, + STOPPED }; + + /** + * Constructs a PrinterState object. + * + * @param value the enum value. + */ + protected PrinterState(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PrinterState itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterState.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-state". + */ + public String getName() + { + return "printer-state"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterStateReason.java b/libjava/classpath/javax/print/attribute/standard/PrinterStateReason.java new file mode 100644 index 000000000..c3838b265 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterStateReason.java @@ -0,0 +1,331 @@ +/* PrinterStateReason.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + +/** + * The PrinterStateReason attribute provides additional + * information about the current state of the printer device. Its always part + * of the {@link javax.print.attribute.standard.PrinterStateReasons} + * printing attribute. + *

+ * IPP Compatibility: PrinterStateReason is not an IPP 1.1 + * attribute itself but used inside the PrinterStateReasons + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class PrinterStateReason extends EnumSyntax + implements Attribute +{ + private static final long serialVersionUID = -1623720656201472593L; + + /** + * Any state other state not listed here. + */ + public static final PrinterStateReason OTHER = new PrinterStateReason(0); + + /** + * A media tray has run out of media. + */ + public static final PrinterStateReason MEDIA_NEEDED = + new PrinterStateReason(1); + + /** + * A media jam occured in the printer device. + */ + public static final PrinterStateReason MEDIA_JAM = new PrinterStateReason(2); + + /** + * Indicates that the printer has been paused by the pause printer + * operation and is currently moving to the pause state. + */ + public static final PrinterStateReason MOVING_TO_PAUSED = + new PrinterStateReason(3); + + /** + * The printer device has be paused by the pause printer operation. + */ + public static final PrinterStateReason PAUSED = new PrinterStateReason(4); + + /** + * The printer device has been shutdown or removed from service. + */ + public static final PrinterStateReason SHUTDOWN = new PrinterStateReason(5); + + /** + * The printer object is connecting to the device. If a printer + * device is on the network the printer object may be unable to connect. + */ + public static final PrinterStateReason CONNECTING_TO_DEVICE = + new PrinterStateReason(6); + + /** + * The connection to the device has timed out. + */ + public static final PrinterStateReason TIMED_OUT = new PrinterStateReason(7); + + /** + * The printer object is stopping the printer device. + */ + public static final PrinterStateReason STOPPING = new PrinterStateReason(8); + + /** + * The printer object has stopped partly. A printer object may control + * several physical output devices (e.g. a printer class in CUPS) and + * stop only some of the devices. + */ + public static final PrinterStateReason STOPPED_PARTLY = + new PrinterStateReason(9); + + /** + * The printer device is low on toner. + */ + public static final PrinterStateReason TONER_LOW = + new PrinterStateReason(10); + + /** + * The printer device is out of toner. + */ + public static final PrinterStateReason TONER_EMPTY = + new PrinterStateReason(11); + + /** + * The printers spool area is currently full. The printer is + * currently not able to accept jobs. + */ + public static final PrinterStateReason SPOOL_AREA_FULL = + new PrinterStateReason(12); + + /** + * One or more covers of the printer device are open. + */ + public static final PrinterStateReason COVER_OPEN = + new PrinterStateReason(13); + + /** + * One or more interlocks of the printer device are open. + */ + public static final PrinterStateReason INTERLOCK_OPEN = + new PrinterStateReason(14); + + /** + * One or more doors of the printer device are open. + */ + public static final PrinterStateReason DOOR_OPEN = + new PrinterStateReason(15); + + /** + * One or more input trays are missing in the printer device. + */ + public static final PrinterStateReason INPUT_TRAY_MISSING = + new PrinterStateReason(16); + + /** + * The printer device is low on media. + */ + public static final PrinterStateReason MEDIA_LOW = + new PrinterStateReason(17); + + /** + * The printer device is out of media. + */ + public static final PrinterStateReason MEDIA_EMPTY = + new PrinterStateReason(18); + + /** + * One or more output trays are missing in the printer device. + */ + public static final PrinterStateReason OUTPUT_TRAY_MISSING = + new PrinterStateReason(19); + + /** + * One or more output areas of the printer device are almost full. + */ + public static final PrinterStateReason OUTPUT_AREA_ALMOST_FULL = + new PrinterStateReason(20); + + /** + * One or more output areas of the printer device are full. + */ + public static final PrinterStateReason OUTPUT_AREA_FULL = + new PrinterStateReason(21); + + /** + * The printer device is low on marker supply. + */ + public static final PrinterStateReason MARKER_SUPPLY_LOW = + new PrinterStateReason(22); + + /** + * The printer device is out of marker supply. + */ + public static final PrinterStateReason MARKER_SUPPLY_EMPTY = + new PrinterStateReason(23); + + /** + * The marker waste bin of the printer device is almost full. + */ + public static final PrinterStateReason MARKER_WASTE_ALMOST_FULL = + new PrinterStateReason(24); + + /** + * The marker waste bin of the printer device is full. + */ + public static final PrinterStateReason MARKER_WASTE_FULL = + new PrinterStateReason(25); + + /** + * The fuser of the printer device is over temperature. + */ + public static final PrinterStateReason FUSER_OVER_TEMP = + new PrinterStateReason(26); + + /** + * The fuser of the printer device is under the needed temperature. + */ + public static final PrinterStateReason FUSER_UNDER_TEMP = + new PrinterStateReason(27); + + /** + * The optical photo conductor is near its end of life (EOL). + */ + public static final PrinterStateReason OPC_NEAR_EOL = + new PrinterStateReason(28); + + /** + * The optical photo conductor has reached its end of life. + */ + public static final PrinterStateReason OPC_LIFE_OVER = + new PrinterStateReason(29); + + /** + * The printer device is low on developer. + */ + public static final PrinterStateReason DEVELOPER_LOW = + new PrinterStateReason(30); + + /** + * The printer device is out of developer. + */ + public static final PrinterStateReason DEVELOPER_EMPTY = + new PrinterStateReason(31); + + /** + * An interpreter resource (e.g. font) is unavailable. + */ + public static final PrinterStateReason INTERPRETER_RESOURCE_UNAVAILABLE = + new PrinterStateReason(32); + + private static final String[] stringTable = + { "other", "media-needed", "media-jam", "moving-to-paused", "paused", + "shutdown", "connecting-to-device", "timed-out", "stopping", + "stopped-partly", "toner-low", "toner-empty", "spool-area-full", + "cover-open", "interlock-open", "door-open", "input-tray-missing", + "media-low", "media-empty", "output-tray-missing", "output-area-almost-full", + "output-area-full", "marker-supply-low", "marker-supply-empty", + "marker-waste-almost-full", "marker-waste-full", "fuser-over-temp", + "fuser-under-temp", "opc-near-eol", "opc-life-over", "developer-low", + "developer-empty", "interpreter-resource-unavailable" }; + + private static final PrinterStateReason[] enumValueTable = + { OTHER, MEDIA_NEEDED, MEDIA_JAM, MOVING_TO_PAUSED, PAUSED, SHUTDOWN, + CONNECTING_TO_DEVICE, TIMED_OUT, STOPPING, STOPPED_PARTLY, TONER_LOW, + TONER_EMPTY, SPOOL_AREA_FULL, COVER_OPEN, INTERLOCK_OPEN, DOOR_OPEN, + INPUT_TRAY_MISSING, MEDIA_LOW, MEDIA_EMPTY, OUTPUT_TRAY_MISSING, + OUTPUT_AREA_ALMOST_FULL, OUTPUT_AREA_FULL, MARKER_SUPPLY_LOW, + MARKER_SUPPLY_EMPTY, MARKER_WASTE_ALMOST_FULL, MARKER_WASTE_FULL, + FUSER_OVER_TEMP, FUSER_UNDER_TEMP, OPC_NEAR_EOL, OPC_LIFE_OVER, + DEVELOPER_LOW, DEVELOPER_EMPTY, INTERPRETER_RESOURCE_UNAVAILABLE }; + + /** + * Constructs a PrinterStateReason object. + * + * @param value the enum value. + */ + protected PrinterStateReason(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class PrintStateReason itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterStateReason.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-state-reason". + */ + public final String getName() + { + return "printer-state-reason"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java b/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java new file mode 100644 index 000000000..5a52b8a30 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterStateReasons.java @@ -0,0 +1,203 @@ +/* PrinterStateReasons.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; + +/** + * The PrinterStateReasons attribute provides the set of + * additional informations available about the current state of the printer + * device. + *

+ * The attribute is basically a map with PrinterStateReason + * objects as keys associated with their severity level as + * Severity instances. The IPP keyword value can be + * constructed as follows:
+ * reason.toString() + '-' + severity.toString() + *

+ *

+ * IPP Compatibility: PrinterStateReasons is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.PrinterState + * @see javax.print.attribute.standard.PrinterStateReason + * @see javax.print.attribute.standard.Severity + * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterStateReasons + extends HashMap + implements PrintServiceAttribute +{ + private static final long serialVersionUID = -3731791085163619457L; + + /** + * Constructs an empty PrinterStateReasons attribute. + */ + public PrinterStateReasons() + { + super(); + } + + /** + * Constructs an empty PrinterStateReasons attribute + * with the given initial capacity and load factor. + * + * @param initialCapacity the intial capacity. + * @param loadFactor the load factor of the underlying HashMap. + * + * @throws IllegalArgumentException if initialCapacity < 0 + * @throws IllegalArgumentException if initialCapacity or loadFactor < 0 + */ + public PrinterStateReasons(int initialCapacity, float loadFactor) + { + super(initialCapacity, loadFactor); + } + + /** + * Constructs an empty PrinterStateReasons attribute + * with the given initial capacity and the default load factor. + * + * @param initialCapacity the intial capacity. + * + * @throws IllegalArgumentException if initialCapacity < 0 + */ + public PrinterStateReasons(int initialCapacity) + { + super(initialCapacity); + } + + /** + * Constructs a PrinterStateReasons attribute + * with the given content of the map. + * + * @param map the map for the initial values with the same + * PrinterStateReason to Severity mappings. + * + * @throws NullPointerException if map or any key/value is null. + * @throws ClassCastException if values of map are not of type + * PrinterStateReason and keys are not of type + * Severity. + */ + public PrinterStateReasons(Map map) + { + super(map.size(), 0.75f); + for (Map.Entry entry : map.entrySet()) + { + put(entry.getKey(), entry.getValue()); + } + } + + /** + * Constructs an unmodifiable view of the contained printer state reasons + * associated with the given severity level. + * + * @param severity the severity level for the constructed set. + * @return The set of printer state reasons. + */ + public Set printerStateReasonSet(Severity severity) + { + if (severity == null) + throw new NullPointerException("severity is null"); + + HashSet set = new HashSet(); + Iterator it = entrySet().iterator(); + while (it.hasNext()) + { + Map.Entry entry = (Map.Entry) it.next(); + if (entry.getValue().equals(severity)) + set.add(entry.getKey()); + } + + return Collections.unmodifiableSet(set); + } + + /** + * Puts the given reason object associated with the given severity object + * into the set. + * + * @param reason the reason of type PrinterStateReason. + * @param severity the severity of the reason of type Severity. + * + * @return The previously associated severity of the reason or + * null if the reason object was not in the map before. + * + * @throws NullPointerException if any of the values is null. + * @throws ClassCastException if reason is not a + * PrinterStateReason and severity is not a + * Severity instance. + */ + public Severity put(PrinterStateReason reason,Severity severity) + { + if (reason == null) + throw new NullPointerException("reason is null"); + if (severity == null) + throw new NullPointerException("severity is null"); + + return super.put(reason, severity); + } + + /** + * Returns category of this class. + * + * @return The class PrintStateReasons itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterStateReasons.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-state-reasons". + */ + public String getName() + { + return "printer-state-reasons"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/PrinterURI.java b/libjava/classpath/javax/print/attribute/standard/PrinterURI.java new file mode 100644 index 000000000..8127a4901 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/PrinterURI.java @@ -0,0 +1,112 @@ +/* PrinterURI.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.net.URI; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintServiceAttribute; +import javax.print.attribute.URISyntax; + +/** + * The PrinterURI attribute provides the URI of a printer. + *

+ * The URI identifies the printer against all the other print services + * available. This attribute is used to direct a print service request + * to this specific printer. + *

+ *

+ * IPP Compatibility: PrinterURI is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class PrinterURI extends URISyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 7923912792485606497L; + + /** + * Constructs a PrinterURI object. + * + * @param uri the URI of the print service. + * @throws NullPointerException if the given uri is null. + */ + public PrinterURI(URI uri) + { + super(uri); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof PrinterURI)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class PrinterURI itself. + */ + public Class< ? extends Attribute> getCategory() + { + return PrinterURI.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "printer-uri". + */ + public String getName() + { + return "printer-uri"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/QueuedJobCount.java b/libjava/classpath/javax/print/attribute/standard/QueuedJobCount.java new file mode 100644 index 000000000..90d4d4b1a --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/QueuedJobCount.java @@ -0,0 +1,111 @@ +/* QueuedJobCount.java -- + Copyright (C) 2003, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.IntegerSyntax; +import javax.print.attribute.PrintServiceAttribute; + +/** + * The QueuedJobCount printing attribute reports + * the number of jobs currently in the queue. These are jobs + * that are in 'pending', 'processing', 'pending-held' or + * 'processing-stopped' state. + *

+ * IPP Compatibility: QueuedJobCount is an IPP 1.1 attribute. + *

+ * @see javax.print.attribute.standard.JobState + * + * @author Michael Koch + */ +public final class QueuedJobCount extends IntegerSyntax + implements PrintServiceAttribute +{ + private static final long serialVersionUID = 7499723077864047742L; + + /** + * Creates a QueuedJobCount object. + * + * @param value the number of queued jobs + * + * @exception IllegalArgumentException if value < 0 + */ + public QueuedJobCount(int value) + { + super(value); + + if (value < 0) + throw new IllegalArgumentException("value may not be less than 0"); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof QueuedJobCount)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this class. + * + * @return The class QueuedJobCount itself. + */ + public Class< ? extends Attribute> getCategory() + { + return QueuedJobCount.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "queued-job-count". + */ + public String getName() + { + return "queued-job-count"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/ReferenceUriSchemesSupported.java b/libjava/classpath/javax/print/attribute/standard/ReferenceUriSchemesSupported.java new file mode 100644 index 000000000..2d47c77c3 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/ReferenceUriSchemesSupported.java @@ -0,0 +1,166 @@ +/* ReferenceUriSchemesSupported.java -- + Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The ReferenceUriSchemesSupported attribute provides + * the supported URI schemes (e.g. ftp) which are supported by the + * printer service to be used as uri reference for document data. + *

+ * IPP Compatibility: ReferenceUriSchemesSupported is an IPP 1.1 + * attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public class ReferenceUriSchemesSupported extends EnumSyntax + implements Attribute +{ + private static final long serialVersionUID = -8989076942813442805L; + + /** + * The file transfer protocol (FTP). + */ + public static final ReferenceUriSchemesSupported FTP = + new ReferenceUriSchemesSupported(0); + + /** + * The hyper text transfer protocol (HTTP). + */ + public static final ReferenceUriSchemesSupported HTTP = + new ReferenceUriSchemesSupported(1); + + /** + * The secure hyper text transfer protocol (HTTPS). + */ + public static final ReferenceUriSchemesSupported HTTPS = + new ReferenceUriSchemesSupported(2); + + /** + * The gopher protocol. + */ + public static final ReferenceUriSchemesSupported GOPHER = + new ReferenceUriSchemesSupported(3); + + /** + * The USENET news - RFC 1738. + */ + public static final ReferenceUriSchemesSupported NEWS = + new ReferenceUriSchemesSupported(4); + + /** + * The network news transfer protocol (NNTP) - RFC 1738. + */ + public static final ReferenceUriSchemesSupported NNTP = + new ReferenceUriSchemesSupported(5); + + /** + * The wide area information server protocol (WAIS) - RFC 4156. + */ + public static final ReferenceUriSchemesSupported WAIS = + new ReferenceUriSchemesSupported(6); + + /** + * A filename specific to the host. + */ + public static final ReferenceUriSchemesSupported FILE = + new ReferenceUriSchemesSupported(7); + + private static final String[] stringTable = { "ftp", "http", "https", + "gopher", "news", "nntp", + "wais", "file" }; + + private static final ReferenceUriSchemesSupported[] enumValueTable = + { FTP, HTTP, HTTPS, GOPHER, NEWS, NNTP, WAIS, FILE }; + + /** + * Constructs a ReferenceUriSchemeSupported object. + * + * @param value the enum value. + */ + protected ReferenceUriSchemesSupported(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class ReferenceUriSchemesSupported itself. + */ + public Class< ? extends Attribute> getCategory() + { + return ReferenceUriSchemesSupported.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "reference-uri-schemes-supported". + */ + public final String getName() + { + return "reference-uri-schemes-supported"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/RequestingUserName.java b/libjava/classpath/javax/print/attribute/standard/RequestingUserName.java new file mode 100644 index 000000000..52a13a8c0 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/RequestingUserName.java @@ -0,0 +1,110 @@ +/* RequestingUserName.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.print.attribute.standard; + +import java.util.Locale; + +import javax.print.attribute.Attribute; +import javax.print.attribute.PrintRequestAttribute; +import javax.print.attribute.TextSyntax; + +/** + * The RequestingUserName attribute provides the name of + * the user which requests the printing of the given job. + *

+ * IPP Compatibility: RequestingUserName is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + */ +public final class RequestingUserName extends TextSyntax + implements PrintRequestAttribute +{ + private static final long serialVersionUID = -2683049894310331454L; + + /** + * Creates a RequestingUserName object. + * + * @param userName the user name + * @param locale the locale to use, if null the default + * locale is used. + * + * @exception NullPointerException if userName is null. + */ + public RequestingUserName(String userName, Locale locale) + { + super(userName, locale); + } + + /** + * Tests if the given object is equal to this object. + * + * @param obj the object to test + * + * @return true if both objects are equal, + * false otherwise. + */ + public boolean equals(Object obj) + { + if(! (obj instanceof RequestingUserName)) + return false; + + return super.equals(obj); + } + + /** + * Returns category of this attribute. + * + * @return The class RequestingUserName itself. + */ + public Class< ? extends Attribute> getCategory() + { + return RequestingUserName.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "requesting-user-name". + */ + public String getName() + { + return "requesting-user-name"; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Severity.java b/libjava/classpath/javax/print/attribute/standard/Severity.java new file mode 100644 index 000000000..ee0e6a17f --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Severity.java @@ -0,0 +1,135 @@ +/* Severity.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.EnumSyntax; + + +/** + * The Severity printing attribute specifies the severity + * for a PrinterStateReason attribute. + *

+ * This attribute does not appear in the attribute set of a print service + * itself. Its used inside the PrinterStateReasons + * attribute which contains PrinterStateReason objects which + * informs about the print service's status. + *

+ *

+ * IPP Compatibility: Severity is not an IPP attribute on its own + * but used in the PrinterStateReason attribute to indicate the severity. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class Severity extends EnumSyntax + implements Attribute +{ + private static final long serialVersionUID = 8781881462717925380L; + + /** + * Indicates that the reason is a report. + */ + public static final Severity REPORT = new Severity(0); + + /** + * Indicates that the reason is a warning. + */ + public static final Severity WARNING = new Severity(1); + + /** + * Indicates that the reason is an error. + */ + public static final Severity ERROR = new Severity(2); + + private static final String[] stringTable = { "report", "warning", "error" }; + + private static final Severity[] enumValueTable = { REPORT, WARNING, ERROR }; + + /** + * Constructs a Severity object. + * + * @param value the enum value. + */ + protected Severity(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class Severity itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Severity.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "severity". + */ + public String getName() + { + return "severity"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/SheetCollate.java b/libjava/classpath/javax/print/attribute/standard/SheetCollate.java new file mode 100644 index 000000000..008a6e845 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/SheetCollate.java @@ -0,0 +1,136 @@ +/* SheetCollate.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The SheetCollate printing attribute specifies + * whether or not the sheets of each copy in a print job have to be + * in sequence. + *

+ * The attribute only makes sense if multiple copies are specified through + * the Copies printing attribute. If UNCOLLATED + * is specified every page of a print job is printed for all requested + * copies before the next page is processed. COLLATED means + * that for every copy requested the pages have to be printed in sequence. + *

+ *

+ * IPP Compatibility: SheetCollate is not an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class SheetCollate extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = 7080587914259873003L; + + /** + * The sheets of the different copies are uncollated. + */ + public static final SheetCollate UNCOLLATED = new SheetCollate(0); + + /** + * The sheets of the different copies are collated. + */ + public static final SheetCollate COLLATED = new SheetCollate(1); + + + private static final String[] stringTable = { "uncollated", "collated" }; + + private static final SheetCollate[] enumValueTable = { UNCOLLATED, + COLLATED }; + + /** + * Creates a SheetCollate object. + * + * @param value the enum value. + */ + protected SheetCollate(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class SheetCollate itself. + */ + public Class< ? extends Attribute> getCategory() + { + return SheetCollate.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "sheet-collate". + */ + public String getName() + { + return "sheet-collate"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/Sides.java b/libjava/classpath/javax/print/attribute/standard/Sides.java new file mode 100644 index 000000000..ca2a60fc7 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/Sides.java @@ -0,0 +1,147 @@ +/* Sides.java -- + Copyright (C) 2004, 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Classpath is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA +02110-1301 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package javax.print.attribute.standard; + +import javax.print.attribute.Attribute; +import javax.print.attribute.DocAttribute; +import javax.print.attribute.EnumSyntax; +import javax.print.attribute.PrintJobAttribute; +import javax.print.attribute.PrintRequestAttribute; + + +/** + * The Sides printing attribute specifies how consecutive + * printing pages are arranged on the media sheet. + *

+ * IPP Compatibility: Sides is an IPP 1.1 attribute. + *

+ * + * @author Michael Koch (konqueror@gmx.de) + * @author Wolfgang Baer (WBaer@gmx.de) + */ +public final class Sides extends EnumSyntax + implements DocAttribute, PrintRequestAttribute, PrintJobAttribute +{ + private static final long serialVersionUID = -6890309414893262822L; + + /** + * Specifies that each page should be printed on one sheet. + */ + public static final Sides ONE_SIDED = new Sides(0); + + /** + * Specifies that two following pages should be printed on the + * front and back of one sheet for binding on the long edge. + */ + public static final Sides TWO_SIDED_LONG_EDGE = new Sides(1); + + /** + * Specifies that two following pages should be printed on the + * front and back of one sheet for binding on the short edge. + */ + public static final Sides TWO_SIDED_SHORT_EDGE = new Sides(2); + + /** + * An alias constant for "two sided long edge". + */ + public static final Sides DUPLEX = new Sides(1); + + /** + * An alias constant for "two sided short edge". + */ + public static final Sides TUMBLE = new Sides(2); + + private static final String[] stringTable = { "one-sided", + "two-sided-long-edge", + "two-sided-short-edge" }; + + private static final Sides[] enumValueTable = { ONE_SIDED, + TWO_SIDED_LONG_EDGE, + TWO_SIDED_SHORT_EDGE }; + + /** + * Creates a Sides object. + * + * @param value the number of sides + */ + protected Sides(int value) + { + super(value); + } + + /** + * Returns category of this class. + * + * @return The class Sides itself. + */ + public Class< ? extends Attribute> getCategory() + { + return Sides.class; + } + + /** + * Returns the name of this attribute. + * + * @return The name "sides". + */ + public String getName() + { + return "sides"; + } + + /** + * Returns a table with the enumeration values represented as strings + * for this object. + * + * @return The enumeration values as strings. + */ + protected String[] getStringTable() + { + return stringTable; + } + + /** + * Returns a table with the enumeration values for this object. + * + * @return The enumeration values. + */ + protected EnumSyntax[] getEnumValueTable() + { + return enumValueTable; + } +} diff --git a/libjava/classpath/javax/print/attribute/standard/package.html b/libjava/classpath/javax/print/attribute/standard/package.html new file mode 100644 index 000000000..f6bec5fb1 --- /dev/null +++ b/libjava/classpath/javax/print/attribute/standard/package.html @@ -0,0 +1,60 @@ + + + + +GNU Classpath - javax.print.attribute.standard + + +Provides the printing attribute classes of the Java Print Service API. +

+The package contains the available printing attributes. Some attributes are +used by the print service implementations to inform about the state of print +services and print jobs. Other attributes are needs to be provided by the +user/program to specify how a print job or a document in a print job should +be printed. +

+Note: Printing attributes can implement more than one attribute role +and therefore be used to specify e.g. print request attributes as well as +document attributes. +

+

+Since: 1.4 +

+ + -- cgit v1.2.3