jdk/src/java.desktop/share/classes/javax/print/attribute/standard/Severity.java
author avstepan
Mon, 11 Jan 2016 17:51:54 +0300
changeset 35667 ed476aba94de
parent 25859 3317bb8137f4
child 47196 a3211bb4daff
permissions -rw-r--r--
8138838: docs cleanup for java.desktop Summary: docs cleanup for java.desktop Reviewed-by: serb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
25770
d132697706ea 8037511: Tidy warnings cleanup for java.awt - 2d part
avstepan
parents: 5506
diff changeset
     2
 * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
package javax.print.attribute.standard;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import javax.print.attribute.EnumSyntax;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import javax.print.attribute.Attribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
 * Class Severity is a printing attribute class, an enumeration, that denotes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
 * the severity of a {@link PrinterStateReason PrinterStateReason} attribute.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * Instances of Severity do not appear in a Print Service's attribute set
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * directly. Rather, a {@link PrinterStateReasons PrinterStateReasons}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * attribute appears in the Print Service's attribute set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 *  The {@link PrinterStateReasons
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * PrinterStateReasons} attribute contains zero, one, or more than one {@link
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * PrinterStateReason PrinterStateReason} objects which pertain to the Print
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * Service's status, and each {@link PrinterStateReason PrinterStateReason}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * object is associated with a Severity level of REPORT (least severe),
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * WARNING, or ERROR (most severe).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * The printer adds a {@link PrinterStateReason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * PrinterStateReason} object to the Print Service's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * {@link PrinterStateReasons PrinterStateReasons} attribute when the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * corresponding condition becomes true
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * of the printer, and the printer removes the {@link PrinterStateReason
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * PrinterStateReason} object again when the corresponding condition becomes
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * false, regardless of whether the Print Service's overall
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * {@link PrinterState PrinterState} also changed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * <B>IPP Compatibility:</B>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    53
 * {@code Severity.toString()} returns either "error", "warning", or
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * "report".  The string values returned by
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * each individual {@link PrinterStateReason} and
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    56
 * associated {@link Severity} object's {@code toString()}
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    57
 * methods, concatenated together with a hyphen ({@code "-"}) in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * between, gives the IPP keyword value for a {@link PrinterStateReasons}.
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
    59
 * The category name returned by {@code getName()} gives the IPP
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * attribute name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * @author  Alan Kaminsky
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
public final class Severity extends EnumSyntax implements Attribute {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
    private static final long serialVersionUID = 8781881462717925380L;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
     * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
     * "report" (least severe). An implementation may choose to omit some or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
     * all reports.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
     * Some reports specify finer granularity about the printer state;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
     * others serve as a precursor to a warning. A report must contain nothing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
     * that could affect the printed output.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
    public static final Severity REPORT = new Severity (0);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
     * Indicates that the {@link PrinterStateReason PrinterStateReason} is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
     * "warning." An implementation may choose to omit some or all warnings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
     * Warnings serve as a precursor to an error. A warning must contain
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
     * nothing  that prevents a job from completing, though in some cases the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
     * output may be of lower quality.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    public static final Severity WARNING = new Severity (1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
     * Indicates that the {@link PrinterStateReason PrinterStateReason} is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
     * "error" (most severe). An implementation must include all errors.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
     * If this attribute contains one or more errors, the printer's
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
     * {@link PrinterState PrinterState} must be STOPPED.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    public static final Severity ERROR = new Severity (2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
     * Construct a new severity enumeration value with the given integer
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
     * value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
     * @param  value  Integer value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    protected Severity(int value) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
        super (value);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    private static final String[] myStringTable = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
        "report",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
        "warning",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
        "error"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    private static final Severity[] myEnumValueTable = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
        REPORT,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
        WARNING,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
        ERROR
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    };
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
     * Returns the string table for class Severity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    protected String[] getStringTable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
        return myStringTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     * Returns the enumeration value table for class Severity.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    protected EnumSyntax[] getEnumValueTable() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
        return myEnumValueTable;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * Get the printing attribute class which is to be used as the "category"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * for this printing attribute value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * <P>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * For class Severity, the category is class Severity itself.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * @return  Printing attribute class (category), an instance of class
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
     *          {@link java.lang.Class java.lang.Class}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    public final Class<? extends Attribute> getCategory() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
        return Severity.class;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * Get the name of the category of which this attribute value is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * instance.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * <P>
35667
ed476aba94de 8138838: docs cleanup for java.desktop
avstepan
parents: 25859
diff changeset
   149
     * For class Severit, the category name is {@code "severity"}.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * @return  Attribute category name.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    public final String getName() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
        return "severity";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
}