Initial import.
[clinton/mirror/jspi/.git] / jspi / src / main / java / de / lohndirekt / print / attribute / cups / PrinterType.java
1 /**
2 * Copyright (C) 2003 <a href="http://www.lohndirekt.de/">lohndirekt.de</a>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19 package de.lohndirekt.print.attribute.cups;
20
21 import javax.print.attribute.IntegerSyntax;
22 import javax.print.attribute.PrintServiceAttribute;
23
24 public class PrinterType extends IntegerSyntax implements PrintServiceAttribute {
25
26 public static final int IS_PRINTER_CLASS = 1 << 0;
27 public static final int IS_REMOTE_DESTINATION = 1 << 1;
28 public static final int CAN_BLACK = 1 << 2;
29 public static final int CAN_COLOR = 1 << 3;
30 public static final int CAN_DUPLEX = 1 << 4;
31 public static final int CAN_STAPLE = 1 << 5;
32 public static final int CAN_UNCOLLATED = 1 << 6;
33 public static final int CAN_COLLATED = 1 << 7;
34 public static final int CAN_PUNCH = 1 << 8;
35 public static final int CAN_COVER = 1 << 9;
36 public static final int CAN_BIND = 1 << 10;
37 public static final int CAN_SORT = 1 << 11;
38 public static final int CAN_A4 = 1 << 12;
39 public static final int CAN_A2 = 1 << 13;
40 public static final int CAN_LARGER_A2 = 1 << 14;
41 public static final int CAN_USER_DEFINED_MEDIA_SIZE = 1 << 15;
42 public static final int IS_IMPLICIT_CLASS = 1 << 16;
43
44 public boolean isPrinterClass() {
45 return (getValue() & IS_PRINTER_CLASS) == 1;
46 }
47
48 public boolean isRemoteDestination() {
49 return (getValue() & IS_REMOTE_DESTINATION) == 1;
50 }
51
52 public boolean canPrintBlack() {
53 return (getValue() & CAN_BLACK) == 1;
54 }
55
56 public boolean canPrintColor() {
57 return (getValue() & CAN_COLOR) == 1;
58 }
59
60 public boolean canDuplex() {
61 return (getValue() & CAN_DUPLEX) == 1;
62 }
63
64 public boolean canStaple() {
65 return (getValue() & CAN_STAPLE) == 1;
66 }
67
68 public boolean canUncollated() {
69 return (getValue() & CAN_UNCOLLATED) == 1;
70 }
71
72 public boolean canCollated() {
73 return (getValue() & CAN_COLLATED) == 1;
74 }
75
76 public boolean canPunch() {
77 return (getValue() & CAN_PUNCH) == 1;
78 }
79
80 public boolean canCover() {
81 return (getValue() & CAN_COVER) == 1;
82 }
83
84 public boolean canBind() {
85 return (getValue() & CAN_BIND) == 1;
86 }
87
88 public boolean canSort() {
89 return (getValue() & CAN_SORT) == 1;
90 }
91
92 public boolean canA4() {
93 return (getValue() & CAN_A4) == 1;
94 }
95
96 public boolean canA2() {
97 return (getValue() & CAN_A2) == 1;
98 }
99 public boolean canLargerA2() {
100 return (getValue() & CAN_LARGER_A2) == 1;
101 }
102
103 public boolean canUserDefinedMediaSize() {
104 return (getValue() & CAN_USER_DEFINED_MEDIA_SIZE) == 1;
105 }
106 public boolean isImplicitClass() {
107 return (getValue() & IS_IMPLICIT_CLASS) == 1;
108 }
109
110
111 /**
112 * @param value
113 */
114 public PrinterType(int value) {
115 super(value);
116 }
117
118 /**
119 *
120 */
121
122 public Class getCategory() {
123 return this.getClass();
124 }
125
126 /**
127 *
128 */
129
130 public String getName() {
131 return PrinterType.getIppName();
132 }
133
134 /**
135 *
136 */
137 public static final String getIppName() {
138 return "printer-type";
139 }
140
141 }