001    /* Finishings.java --
002       Copyright (C) 2004, 2005, 2006 Free Software Foundation, Inc.
003    
004    This file is part of GNU Classpath.
005    
006    GNU Classpath is free software; you can redistribute it and/or modify
007    it under the terms of the GNU General Public License as published by
008    the Free Software Foundation; either version 2, or (at your option)
009    any later version.
010    
011    GNU Classpath is distributed in the hope that it will be useful, but
012    WITHOUT ANY WARRANTY; without even the implied warranty of
013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
014    General Public License for more details.
015    
016    You should have received a copy of the GNU General Public License
017    along with GNU Classpath; see the file COPYING.  If not, write to the
018    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
019    02110-1301 USA.
020    
021    Linking this library statically or dynamically with other modules is
022    making a combined work based on this library.  Thus, the terms and
023    conditions of the GNU General Public License cover the whole
024    combination.
025    
026    As a special exception, the copyright holders of this library give you
027    permission to link this library with independent modules to produce an
028    executable, regardless of the license terms of these independent
029    modules, and to copy and distribute the resulting executable under
030    terms of your choice, provided that you also meet, for each linked
031    independent module, the terms and conditions of the license of that
032    module.  An independent module is a module which is not derived from
033    or based on this library.  If you modify this library, you may extend
034    this exception to your version of the library, but you are not
035    obligated to do so.  If you do not wish to do so, delete this
036    exception statement from your version.  */
037    
038    
039    package javax.print.attribute.standard;
040    
041    import javax.print.attribute.Attribute;
042    import javax.print.attribute.DocAttribute;
043    import javax.print.attribute.EnumSyntax;
044    import javax.print.attribute.PrintJobAttribute;
045    import javax.print.attribute.PrintRequestAttribute;
046    
047    
048    /**
049     * The <code>Finishings</code> attribute specifies the finishing operations
050     * that the Printer applies to every copy of each printed document in the Job.
051     * <p>
052     * Standard enum values are: <code>NONE</code>, <code>STAPLE</code>, 
053     * <code>COVER</code>, <code>BIND</code>, <code>SADDLE_STITCH</code>,
054     * <code>EDGE_STITCH</code>.
055     * <br><br>
056     * The following values are more specific: 
057     * <code>STAPLE_TOP_LEFT</code>, <code>STAPLE_BOTTOM_LEFT</code>, 
058     * <code>STAPLE_TOP_RIGHT</code>, <code>STAPLE_BOTTOM_RIGHT</code>, 
059     * <code>EDGE_STITCH_LEFT</code>, <code>EDGE_STITCH_TOP</code>, 
060     * <code>EDGE_STITCH_RIGHT</code>, <code>EDGE_STITCH_BOTTOM</code>, 
061     * <code>STAPLE_DUAL_LEFT</code>, <code>STAPLE_DUAL_TOP</code>, 
062     * <code>STAPLE_DUAL_RIGHT</code>, <code>STAPLE_DUAL_BOTTOM</code>.
063     * </p> 
064     * <p>
065     * <b>Note:</b> The effect of this attribute on jobs with multiple documents 
066     * is controlled by the job attribute 
067     * {@link javax.print.attribute.standard.MultipleDocumentHandling}.
068     * </p>
069     * <p>
070     * <b>IPP Compatibility:</b> Finishings is an IPP 1.1 attribute. Differences 
071     * to the IPP specification are that in the Java Print Service API only one 
072     * enum value is supported (in IPP a set of enums). Further the enum 
073     * <code>punch</code> is not supported.
074     * </p>
075     * 
076     * @author Michael Koch (konqueror@gmx.de)
077     * @author Wolfgang Baer (WBaer@gmx.de)
078     */
079    public class Finishings extends EnumSyntax
080      implements DocAttribute, PrintJobAttribute, PrintRequestAttribute
081    {
082      private static final long serialVersionUID = -627840419548391754L;
083    
084      /** 
085       * Perform no finishings of the documents.
086       */
087      public static final Finishings NONE = new Finishings(3);
088      
089      /** 
090       * Selects binding of the documents with one or more staples.  
091       */
092      public static final Finishings STAPLE = new Finishings(4);
093      
094      /**
095       * Selects the use of a non-printed (or pre-printed) cover for 
096       * the document.
097       */
098      public static final Finishings COVER = new Finishings(6);
099      
100      /**
101       * Selects that a binding is to be applied to the document.
102       * The type and placement of the binding is site-defined.
103       */
104      public static final Finishings BIND = new Finishings(7);
105      
106      /**
107       * Selects binding of the documents with one or more staples
108       * along the middle fold.  
109       */
110      public static final Finishings SADDLE_STITCH = new Finishings(8);
111      
112      /**
113       * Selects binding of the documents with one or more staples 
114       * along one edge. 
115       */
116      public static final Finishings EDGE_STITCH = new Finishings(9);
117      
118      /** 
119       * Selects binding of the documents with one or more staples 
120       * in the top left corner. 
121       */
122      public static final Finishings STAPLE_TOP_LEFT = new Finishings(20);
123      
124      /** 
125       * Selects binding of the documents with one or more staples in the bottom 
126       * left corner. 
127       */
128      public static final Finishings STAPLE_BOTTOM_LEFT = new Finishings(21);
129      
130      /**
131       * Selects binding of the documents with one or more staples in 
132       * the top right corner.
133       */
134      public static final Finishings STAPLE_TOP_RIGHT = new Finishings(22);
135      
136      /**
137       * Selects binding of the documents with one or more staples in 
138       * the bottom right corner.
139       */
140      public static final Finishings STAPLE_BOTTOM_RIGHT = new Finishings(23);
141      
142      /**
143       * Selects binding of the documents with one or more staples
144       * along the left edge.
145       */
146      public static final Finishings EDGE_STITCH_LEFT = new Finishings(24);
147      
148      /**
149       * Selects binding of the documents with one or more staples along 
150       * the top edge.
151       */
152      public static final Finishings EDGE_STITCH_TOP = new Finishings(25);
153      
154      /**
155       * Selects binding of the documents with one or more staples along 
156       * the right edge.
157       */
158      public static final Finishings EDGE_STITCH_RIGHT = new Finishings(26);
159      
160      /**
161       * Selects binding of the documents with one or more staples along
162       * the bottom edge. 
163       */
164      public static final Finishings EDGE_STITCH_BOTTOM = new Finishings(27);
165      
166      /**
167       * Selects binding of the documents with two staples along the 
168       * left edge assuming a portrait document.
169       */
170      public static final Finishings STAPLE_DUAL_LEFT = new Finishings(28);
171      
172      /**
173       * Selects binding of the documents with two staples along the 
174       * top edge assuming a portrait document.
175       */
176      public static final Finishings STAPLE_DUAL_TOP = new Finishings(29);
177      
178      /**
179       * Selects binding of the documents with two staples along the 
180       * right edge assuming a portrait document.
181       */
182      public static final Finishings STAPLE_DUAL_RIGHT = new Finishings(30);
183      
184      /**
185       * Selects binding of the documents with two staples along the 
186       * bottom edge assuming a portrait document.
187       */
188      public static final Finishings STAPLE_DUAL_BOTTOM = new Finishings(31);
189    
190      private static final String[] stringTable = { "none", "staple", null, 
191                                                    "cover", "bind", "saddle-stitch",
192                                                    "edge-stitch", null, null, null,
193                                                    null, null, null, null, null,
194                                                    null, null, "staple-top-left",
195                                                    "staple-bottom-left", 
196                                                    "staple-top-right", 
197                                                    "staple-bottom-right",
198                                                    "edge-stitch-left",
199                                                    "edge-stitch-top",
200                                                    "edge-stitch-right",
201                                                    "edge-stitch-bottom",
202                                                    "staple-dual-left",
203                                                    "staple-dual-top",
204                                                    "staple-dual-right",
205                                                    "staple-dual-bottom" };
206      
207      private static final Finishings[] enumValueTable = { NONE, STAPLE, null, 
208                                                           COVER, BIND, 
209                                                           SADDLE_STITCH,
210                                                           EDGE_STITCH, null, 
211                                                           null, null, null, 
212                                                           null, null, null, 
213                                                           null, null, null, 
214                                                           STAPLE_TOP_LEFT,
215                                                           STAPLE_BOTTOM_LEFT,
216                                                           STAPLE_TOP_RIGHT,
217                                                           STAPLE_BOTTOM_RIGHT,
218                                                           EDGE_STITCH_LEFT,
219                                                           EDGE_STITCH_TOP,
220                                                           EDGE_STITCH_RIGHT,
221                                                           EDGE_STITCH_BOTTOM,
222                                                           STAPLE_DUAL_LEFT,
223                                                           STAPLE_DUAL_TOP,
224                                                           STAPLE_DUAL_RIGHT,
225                                                           STAPLE_DUAL_BOTTOM };
226      
227      /**
228       * Constructs a <code>Finishings</code> object.
229       * 
230       * @param value the value
231       */
232      protected Finishings(int value)
233      {
234        super(value);
235      }
236    
237      /**
238       * Returns category of this class.
239       *
240       * @return the class <code>Finishings</code> itself
241       */
242      public Class< ? extends Attribute> getCategory()
243      {
244        return Finishings.class;
245      }
246    
247      /**
248       * Returns the name of this attribute.
249       *
250       * @return The name "finishings".
251       */
252      public final String getName()
253      {
254        return "finishings";
255      }
256      
257      /**
258       * Returns a table with the enumeration values represented as strings
259       * for this object.
260       *
261       * @return The enumeration values as strings.
262       */
263      protected String[] getStringTable()
264      {
265        return stringTable;
266      }
267    
268      /**
269       * Returns a table with the enumeration values for this object.
270       *
271       * @return The enumeration values.
272       */
273      protected EnumSyntax[] getEnumValueTable()
274      {
275        return enumValueTable;
276      }
277    
278      /**
279       * Returns the lowest used value by the enumerations of this class.
280       * .
281       * @return The lowest value used.
282       */
283      protected int getOffset()
284      {
285        return 3;
286      }  
287    }