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