001    /* PrinterState.java --
002       Copyright (C) 2004, 2005 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    package javax.print.attribute.standard;
039    
040    import javax.print.attribute.Attribute;
041    import javax.print.attribute.EnumSyntax;
042    import javax.print.attribute.PrintServiceAttribute;
043    
044    
045    /**
046     * The <code>PrinterState</code> printing attribute reports
047     * the current state of the printer device.
048     * <p>
049     * The {@link javax.print.attribute.standard.PrinterStateReasons}
050     * attribute provides further detailed information about
051     * the given printer state. Detailed information about the printer
052     * state and printer state reasons attributes can be found in the
053     * RFC 2911.
054     * </p>
055     * <p>
056     * <b>IPP Compatibility:</b> PrinterState is an IPP 1.1 attribute.
057     * </p>
058     *
059     * @author Michael Koch (konqueror@gmx.de)
060     * @author Wolfgang Baer (WBaer@gmx.de)
061     */
062    public final class PrinterState extends EnumSyntax
063      implements PrintServiceAttribute
064    {
065      private static final long serialVersionUID = -649578618346507718L;
066    
067      /**
068       * The state is unknown currently.
069       */
070      public static final PrinterState UNKNOWN = new PrinterState(0);
071    
072      /**
073       * The printer device is in idle state. New jobs can start
074       * processing without waiting.
075       */
076      public static final PrinterState IDLE = new PrinterState(3);
077    
078      /**
079       * The printer device is in processing state.
080       */
081      public static final PrinterState PROCESSING = new PrinterState(4);
082    
083      /**
084       * The printer device has stopped. No jobs can be processed and
085       * normally manual intervention is needed.
086       */
087      public static final PrinterState STOPPED = new PrinterState(5);
088    
089      private static final String[] stringTable = { "unknown", null, null,
090                                                    "idle", "processing",
091                                                    "stopped" };
092    
093      private static final PrinterState[] enumValueTable = { UNKNOWN, null, null,
094                                                             IDLE, PROCESSING,
095                                                             STOPPED };
096    
097      /**
098       * Constructs a <code>PrinterState</code> object.
099       *
100       * @param value the enum value.
101       */
102      protected PrinterState(int value)
103      {
104        super(value);
105      }
106    
107      /**
108       * Returns category of this class.
109       *
110       * @return The class <code>PrinterState</code> itself.
111       */
112      public Class< ? extends Attribute> getCategory()
113      {
114        return PrinterState.class;
115      }
116    
117      /**
118       * Returns the name of this attribute.
119       *
120       * @return The name "printer-state".
121       */
122      public String getName()
123      {
124        return "printer-state";
125      }
126    
127      /**
128       * Returns a table with the enumeration values represented as strings
129       * for this object.
130       *
131       * @return The enumeration values as strings.
132       */
133      protected String[] getStringTable()
134      {
135        return stringTable;
136      }
137    
138      /**
139       * Returns a table with the enumeration values for this object.
140       *
141       * @return The enumeration values.
142       */
143      protected EnumSyntax[] getEnumValueTable()
144      {
145        return enumValueTable;
146      }
147    }