Source Code Cross Referenced for DocManager.java in  » 6.0-JDK-Modules » java-3d » org » jdesktop » j3dfly » pdfdoctools » 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 » org.jdesktop.j3dfly.pdfdoctools 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *  $Header: /cvs/j3dfly/J3dFly/src/org/jdesktop/j3dfly/pdfdoctools/DocManager.java,v 1.1 2005/04/20 21:04:36 paulby Exp $
003:         *
004:         *                         Sun Public License Notice
005:         *
006:         *  The contents of this file are subject to the Sun Public License Version
007:         *  1.0 (the "License"). You may not use this file except in compliance with
008:         *  the License. A copy of the License is available at http://www.sun.com/
009:         *  
010:         *  The Original Code is Java 3D(tm) Fly Through.
011:         *  The Initial Developer of the Original Code is Paul Byrne.
012:         *  Portions created by Paul Byrne are Copyright (C) 2002.
013:         *  All Rights Reserved.
014:         *  
015:         *  Contributor(s): Paul Byrne.
016:         *  
017:         **/
018:        package org.jdesktop.j3dfly.pdfdoctools;
019:
020:        import java.io.File;
021:        import java.io.IOException;
022:        import java.io.Reader;
023:        import java.io.BufferedReader;
024:        import java.io.FileReader;
025:        import java.io.StreamTokenizer;
026:        import java.util.HashMap;
027:        import java.net.URL;
028:
029:        import org.jdesktop.j3dfly.namecontrol.NameControl;
030:
031:        /**
032:         * Manages all the document pages for current j3f file
033:         *
034:         * @author  paulby
035:         * @version 
036:         */
037:        public class DocManager extends java.lang.Object {
038:
039:            private HashMap objectMap;
040:            private String documentPath = null;
041:            private String documentURL;
042:            private DocPanel docPanel;
043:            private String defaultURL;
044:
045:            /** Creates new DocManager */
046:            public DocManager(DocPanel docPanel) {
047:                this .docPanel = docPanel;
048:                objectMap = new HashMap();
049:            }
050:
051:            /**
052:             * Return the pdf bookmark location for the object
053:             */
054:            public String getBookmark(Object obj) {
055:                String bookmark = (String) objectMap.get(obj);
056:                if (bookmark == null)
057:                    bookmark = defaultURL;
058:
059:                return bookmark;
060:            }
061:
062:            /**
063:             * Load the index file
064:             */
065:            public void loadIndex(File file) {
066:                String currentObject = null;
067:                String currentScene = null;
068:                documentPath = file.getAbsolutePath();
069:                documentPath = documentPath.substring(0, documentPath
070:                        .lastIndexOf(File.separatorChar));
071:
072:                try {
073:                    Reader reader = new BufferedReader(new FileReader(file));
074:                    StreamTokenizer tok = new StreamTokenizer(reader);
075:
076:                    while (tok.nextToken() != StreamTokenizer.TT_EOF) {
077:                        if (tok.ttype != StreamTokenizer.TT_WORD)
078:                            throw new IOException("Syntax Error at line "
079:                                    + tok.lineno() + "  " + tok);
080:
081:                        if (tok.sval.equals("object")) {
082:                            checkForEquals(tok);
083:                            System.out.println("Object " + tok.sval);
084:                            currentObject = tok.sval;
085:                        } else if (tok.sval.equals("document")) {
086:                            checkForEquals(tok);
087:                            System.out.println("Document " + tok.sval);
088:                            documentURL = tok.sval;
089:                            docPanel.setDocument(documentURL);
090:                        } else if (tok.sval.equals("doc")) {
091:                            checkForEquals(tok);
092:                            System.out.println("Doc " + tok.sval);
093:
094:                            if (currentObject.equals("default"))
095:                                defaultURL = tok.sval;
096:                            else {
097:                                Object obj = docPanel.getJ3dFlyContext()
098:                                        .getNameControl().getNamedObject(
099:                                                currentScene, currentObject);
100:                                if (obj == null)
101:                                    System.out
102:                                            .println("Documentation error, can't find object "
103:                                                    + currentObject
104:                                                    + " in scene "
105:                                                    + currentScene);
106:                                else
107:                                    objectMap.put(obj, tok.sval);
108:                            }
109:                        } else if (tok.sval.equals("scene")) {
110:                            checkForEquals(tok);
111:                            currentScene = tok.sval;
112:                        } else
113:                            throw new RuntimeException("Unknown token at line "
114:                                    + tok.lineno() + " '" + tok.sval + "'");
115:                    }
116:                } catch (IOException e) {
117:                    e.printStackTrace();
118:                }
119:            }
120:
121:            /**
122:             *Ensure the next token in the stream is an equals sign
123:             */
124:            private void checkForEquals(StreamTokenizer tok) throws IOException {
125:                if (tok.nextToken() != '=')
126:                    throw new IOException("Syntax Error at line "
127:                            + tok.lineno() + "  " + tok + "  expecting =");
128:                tok.nextToken();
129:            }
130:
131:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.