Source Code Cross Referenced for RenderingError.java in  » 6.0-JDK-Modules » java-3d » javax » media » j3d » 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 » 6.0 JDK Modules » java 3d » javax.media.j3d 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $RCSfile: RenderingError.java,v $
003:         *
004:         * Copyright 2006-2008 Sun Microsystems, Inc.  All Rights Reserved.
005:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
006:         *
007:         * This code is free software; you can redistribute it and/or modify it
008:         * under the terms of the GNU General Public License version 2 only, as
009:         * published by the Free Software Foundation.  Sun designates this
010:         * particular file as subject to the "Classpath" exception as provided
011:         * by Sun in the LICENSE file that accompanied this code.
012:         *
013:         * This code is distributed in the hope that it will be useful, but WITHOUT
014:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
015:         * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
016:         * version 2 for more details (a copy is included in the LICENSE file that
017:         * accompanied this code).
018:         *
019:         * You should have received a copy of the GNU General Public License version
020:         * 2 along with this work; if not, write to the Free Software Foundation,
021:         * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
022:         *
023:         * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
024:         * CA 95054 USA or visit www.sun.com if you need additional information or
025:         * have any questions.
026:         *
027:         * $Revision: 1.4 $
028:         * $Date: 2008/02/28 20:17:29 $
029:         * $State: Exp $
030:         */
031:
032:        package javax.media.j3d;
033:
034:        import java.awt.GraphicsDevice;
035:        import java.io.PrintStream;
036:
037:        /**
038:         * RenderingError is a container object that holds the details of
039:         * a runtime error that occurs in the Java 3D rendering system.
040:         * 
041:         * @since Java 3D 1.5
042:         */
043:        public class RenderingError extends Object {
044:            private int errorCode = NO_ERROR;
045:            private String errorMessage = null;
046:            private String detailMessage = null;
047:            private GraphicsDevice graphicsDevice = null;
048:            private Canvas3D canvas = null;
049:
050:            /**
051:             * Indicates that no error occurred.
052:             */
053:            public static final int NO_ERROR = 0;
054:
055:            /**
056:             * Indicates that an unexpected rendering exception was caught by the
057:             * Java 3D renderer thread.
058:             */
059:            public static final int UNEXPECTED_RENDERING_ERROR = 1;
060:
061:            /**
062:             * Indicates that an error occurred while getting the best graphics
063:             * configuration or while testing whether a given graphics config is
064:             * supported.
065:             */
066:            public static final int GRAPHICS_CONFIG_ERROR = 2;
067:
068:            /**
069:             * Indicates that an error occurred while creating an OpenGL or D3D
070:             * graphics context. This can happen either when querying
071:             * the Canvas3D properties or when rendering.
072:             */
073:            public static final int CONTEXT_CREATION_ERROR = 3;
074:
075:            /**
076:             * Indicates a error in creating a rendering buffer for an off-screen
077:             * Canvas3D.
078:             */
079:            public static final int OFF_SCREEN_BUFFER_ERROR = 4;
080:
081:            /**
082:             * Constructs a new RenderingError object indicating no error. The
083:             * error code is set to <code>NO_ERROR</code>.  All other fields
084:             * are initialized to null, including the error message.
085:             */
086:            public RenderingError() {
087:            }
088:
089:            /**
090:             * Constructs a new RenderingError object with the given error code
091:             * and message.  All other fields are initialized to null.
092:             * 
093:             * @param errorCode the error code for this rendering error.
094:             * @param errorMessage a short error message describing this
095:             * rendering error.
096:             */
097:            public RenderingError(int errorCode, String errorMessage) {
098:                this .errorCode = errorCode;
099:                this .errorMessage = errorMessage;
100:            }
101:
102:            /**
103:             * Prints a verbose error report to System.err. This verbose
104:             * output includes the error code, error message, detail message,
105:             * and all relevant Java 3D objects.
106:             */
107:            public void printVerbose() {
108:                printVerbose(System.err);
109:            }
110:
111:            /**
112:             * Prints a verbose error report to the specified PrintStream.
113:             * This verbose output includes the error code, error message,
114:             * detail message, and all relevant Java 3D objects.
115:             *
116:             * @param printStream the print stream on which to print the error
117:             * report.
118:             */
119:            public void printVerbose(PrintStream printStream) {
120:                printStream.println(this );
121:                if (graphicsDevice != null) {
122:                    printStream.println("graphicsDevice = " + graphicsDevice);
123:                }
124:                if (canvas != null) {
125:                    printStream.println("canvas = " + canvas);
126:                }
127:
128:                if (detailMessage != null) {
129:                    printStream.println();
130:                    printStream.println("Detail Message");
131:                    printStream.println("--------------");
132:                    printStream.println(detailMessage);
133:                }
134:            }
135:
136:            /**
137:             * Sets the error code for this rendering error. This represents the
138:             * type of error that occurred.
139:             *
140:             * @param errorCode the error code for this rendering error.
141:             */
142:            public void setErrorCode(int errorCode) {
143:                this .errorCode = errorCode;
144:            }
145:
146:            /**
147:             * Returns the error code for this rendering error.
148:             *
149:             * @return the error code.
150:             */
151:            public int getErrorCode() {
152:                return errorCode;
153:            }
154:
155:            /**
156:             * Sets the error message for this rendering error. This is a short
157:             * message describing the error, and is included as part of
158:             * toString().
159:             *
160:             * @param errorMessage a short error message describing this
161:             * rendering error.
162:             */
163:            public void setErrorMessage(String errorMessage) {
164:                this .errorMessage = errorMessage;
165:            }
166:
167:            /**
168:             * Returns the error message for this rendering error.
169:             *
170:             * @return a short error message describing this rendering error.
171:             */
172:            public String getErrorMessage() {
173:                return errorMessage;
174:            }
175:
176:            /**
177:             * Sets the detail message for this rendering error. This is a more
178:             * detailed error message that is not included as part of toString().
179:             *
180:             * @param detailMessage a detailed message describing this
181:             * error in more detail.
182:             */
183:            public void setDetailMessage(String detailMessage) {
184:                this .detailMessage = detailMessage;
185:            }
186:
187:            /**
188:             * Returns the detail message for this rendering error.
189:             *
190:             * @return the detail message for this rendering error.
191:             */
192:            public String getDetailMessage() {
193:                return detailMessage;
194:            }
195:
196:            /**
197:             * Sets the graphics device associated with this rendering error.
198:             *
199:             * @param graphicsDevice the graphics device associated with this rendering error.
200:             */
201:            public void setGraphicsDevice(GraphicsDevice graphicsDevice) {
202:                this .graphicsDevice = graphicsDevice;
203:            }
204:
205:            /**
206:             * Returns the graphics device associated with this rendering error.
207:             *
208:             * @return the graphics device associated with this rendering error.
209:             */
210:            public GraphicsDevice getGraphicsDevice() {
211:                return this .graphicsDevice;
212:            }
213:
214:            /**
215:             * Sets the canvas associated with this rendering error.
216:             *
217:             * @param canvas the canvas associated with this rendering error.
218:             */
219:            public void setCanvas3D(Canvas3D canvas) {
220:                this .canvas = canvas;
221:            }
222:
223:            /**
224:             * Returns the canvas associated with this rendering error.
225:             *
226:             * @return the canvas associated with this rendering error.
227:             */
228:            public Canvas3D getCanvas3D() {
229:                return this .canvas;
230:            }
231:
232:            /**
233:             * Returns a short string that describes this rendering error. The
234:             * string is composed of the textual description of the errorCode,
235:             * a ": ", and the errorMessage field.  If the errorMessage is
236:             * null then the ": " and the errorMessage are omitted.
237:             *
238:             * @return a string representation of this rendering error.
239:             */
240:            public String toString() {
241:                // Concatenate string representation of error code with error message
242:                String errorCodeStr;
243:                switch (errorCode) {
244:                case NO_ERROR:
245:                    errorCodeStr = "NO_ERROR";
246:                    break;
247:                case UNEXPECTED_RENDERING_ERROR:
248:                    errorCodeStr = "UNEXPECTED_RENDERING_ERROR";
249:                    break;
250:                case GRAPHICS_CONFIG_ERROR:
251:                    errorCodeStr = "GRAPHICS_CONFIG_ERROR";
252:                    break;
253:                case CONTEXT_CREATION_ERROR:
254:                    errorCodeStr = "CONTEXT_CREATION_ERROR";
255:                    break;
256:                case OFF_SCREEN_BUFFER_ERROR:
257:                    errorCodeStr = "OFF_SCREEN_BUFFER_ERROR";
258:                    break;
259:
260:                default:
261:                    errorCodeStr = "UNKNOWN ERROR CODE (" + errorCode + ")";
262:                }
263:
264:                if (errorMessage == null) {
265:                    return errorCodeStr;
266:                }
267:
268:                return errorCodeStr + ": " + errorMessage;
269:            }
270:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.