Source Code Cross Referenced for All2PSStreamPrintService.java in  » Apache-Harmony-Java-SE » org-package » org » apache » harmony » x » print » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Apache Harmony Java SE » org package » org.apache.harmony.x.print 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  Licensed to the Apache Software Foundation (ASF) under one or more
003:         *  contributor license agreements.  See the NOTICE file distributed with
004:         *  this work for additional information regarding copyright ownership.
005:         *  The ASF licenses this file to You under the Apache License, Version 2.0
006:         *  (the "License"); you may not use this file except in compliance with
007:         *  the License.  You may obtain a copy of the License at
008:         *
009:         *     http://www.apache.org/licenses/LICENSE-2.0
010:         *
011:         *  Unless required by applicable law or agreed to in writing, software
012:         *  distributed under the License is distributed on an "AS IS" BASIS,
013:         *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         *  See the License for the specific language governing permissions and
015:         *  limitations under the License.
016:         */
017:        /** 
018:         * @author Aleksei V. Ivaschenko 
019:         * @version $Revision: 1.2 $ 
020:         */package org.apache.harmony.x.print;
021:
022:        import java.io.OutputStream;
023:        import javax.print.DocFlavor;
024:        import javax.print.DocPrintJob;
025:        import javax.print.ServiceUIFactory;
026:        import javax.print.StreamPrintService;
027:        import javax.print.StreamPrintServiceFactory;
028:        import javax.print.attribute.Attribute;
029:        import javax.print.attribute.AttributeSet;
030:        import javax.print.attribute.PrintServiceAttribute;
031:        import javax.print.attribute.PrintServiceAttributeSet;
032:        import javax.print.attribute.standard.ColorSupported;
033:        import javax.print.attribute.standard.Copies;
034:        import javax.print.attribute.standard.JobName;
035:        import javax.print.attribute.standard.Media;
036:        import javax.print.attribute.standard.MediaPrintableArea;
037:        import javax.print.attribute.standard.MediaSizeName;
038:        import javax.print.attribute.standard.Sides;
039:        import javax.print.event.PrintServiceAttributeListener;
040:
041:        /*
042:         * Image2PSStreamPrintService
043:         */
044:        public class All2PSStreamPrintService extends StreamPrintService {
045:
046:            private static final String outputFormat = "application/postscript";
047:            private static final MediaSizeName mediaSizes[] = {
048:                    MediaSizeName.ISO_A3, MediaSizeName.ISO_A4,
049:                    MediaSizeName.ISO_A5 };
050:
051:            private static final Class supportedAttributeCategories[] = {
052:                    ColorSupported.class, Copies.class, JobName.class,
053:                    Media.class, MediaPrintableArea.class, Sides.class };
054:
055:            private static final DocFlavor supportedDocFlavors[] = {
056:                    DocFlavor.SERVICE_FORMATTED.PRINTABLE,
057:                    DocFlavor.SERVICE_FORMATTED.PAGEABLE,
058:                    DocFlavor.BYTE_ARRAY.GIF, DocFlavor.INPUT_STREAM.GIF,
059:                    DocFlavor.URL.GIF, DocFlavor.BYTE_ARRAY.JPEG,
060:                    DocFlavor.INPUT_STREAM.JPEG, DocFlavor.URL.JPEG,
061:                    DocFlavor.BYTE_ARRAY.PNG, DocFlavor.INPUT_STREAM.PNG,
062:                    DocFlavor.URL.PNG };
063:
064:            public All2PSStreamPrintService(OutputStream outputstream,
065:                    StreamPrintServiceFactory factory) {
066:                super (outputstream);
067:                if (factory == null) {
068:                    throw new NullPointerException("factory is null");
069:                }
070:            }
071:
072:            public String getOutputFormat() {
073:                return outputFormat;
074:            }
075:
076:            public Class[] getSupportedAttributeCategories() {
077:                Class copy_supportedAttrCats[] = new Class[supportedAttributeCategories.length];
078:                for (int i = 0; i < supportedAttributeCategories.length; i++) {
079:                    copy_supportedAttrCats[i] = supportedAttributeCategories[i];
080:                }
081:                return copy_supportedAttrCats;
082:            }
083:
084:            public boolean isAttributeCategorySupported(Class category) {
085:                if (category == null) {
086:                    throw new NullPointerException("Argument category is null");
087:                }
088:                if (!(javax.print.attribute.Attribute.class)
089:                        .isAssignableFrom(category)) {
090:                    throw new IllegalArgumentException(category.toString()
091:                            + " is not an Attribute");
092:                }
093:
094:                for (int i = 0; i < supportedAttributeCategories.length; i++) {
095:                    if (category.equals(supportedAttributeCategories[i]))
096:                        return true;
097:                }
098:                return false;
099:            }
100:
101:            public String getName() {
102:                return "Convert source to Postscript language";
103:            }
104:
105:            public DocFlavor[] getSupportedDocFlavors() {
106:                DocFlavor copy_supportedDocFlavors[] = new DocFlavor[supportedDocFlavors.length];
107:                for (int i = 0; i < supportedDocFlavors.length; i++) {
108:                    copy_supportedDocFlavors[i] = supportedDocFlavors[i];
109:                }
110:                return copy_supportedDocFlavors;
111:            }
112:
113:            public boolean isDocFlavorSupported(DocFlavor flavor) {
114:                if (flavor == null) {
115:                    throw new NullPointerException("Argument flavor is null");
116:                }
117:
118:                for (int i = 0; i < supportedDocFlavors.length; i++) {
119:                    if (flavor.equals(supportedDocFlavors[i]))
120:                        return true;
121:                }
122:                return false;
123:            }
124:
125:            public DocPrintJob createPrintJob() {
126:                return new All2PSDocPrintJob(this );
127:            }
128:
129:            public int hashCode() {
130:                return getName().hashCode();
131:            }
132:
133:            public boolean equals(Object obj) {
134:                return obj == this 
135:                        || (obj instanceof  All2PSStreamPrintService)
136:                        && ((All2PSStreamPrintService) obj).getName().equals(
137:                                getName());
138:            }
139:
140:            public ServiceUIFactory getServiceUIFactory() {
141:                return null;
142:            }
143:
144:            /* methods below this line must be completed */
145:
146:            public PrintServiceAttributeSet getAttributes() {
147:                return null;
148:            }
149:
150:            public void addPrintServiceAttributeListener(
151:                    PrintServiceAttributeListener arg0) {
152:            }
153:
154:            public void removePrintServiceAttributeListener(
155:                    PrintServiceAttributeListener arg0) {
156:            }
157:
158:            public Object getDefaultAttributeValue(Class arg0) {
159:                return null;
160:            }
161:
162:            public PrintServiceAttribute getAttribute(Class arg0) {
163:                return null;
164:            }
165:
166:            public boolean isAttributeValueSupported(Attribute arg0,
167:                    DocFlavor arg1, AttributeSet arg2) {
168:                return false;
169:            }
170:
171:            public AttributeSet getUnsupportedAttributes(DocFlavor arg0,
172:                    AttributeSet arg1) {
173:                return arg1;
174:            }
175:
176:            public Object getSupportedAttributeValues(Class arg0,
177:                    DocFlavor arg1, AttributeSet arg2) {
178:                return null;
179:            }
180:
181:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.