Source Code Cross Referenced for DocPanel.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/DocPanel.java,v 1.1 2005/04/20 21:04:37 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.net.URL;
023:
024:        import org.jdesktop.j3dfly.event.EventProcessor;
025:        import org.jdesktop.j3dfly.event.FileLoadEvent;
026:        import org.jdesktop.j3dfly.event.ObjectPickEvent;
027:        import org.jdesktop.j3dfly.event.FlyEventListener;
028:        import org.jdesktop.j3dfly.J3dFlyContext;
029:
030:        import com.adobe.acrobat.Viewer;
031:
032:        /**
033:         *
034:         * @author  paulby
035:         * @version 
036:         */
037:        public class DocPanel extends javax.swing.JPanel implements 
038:                FlyEventListener {
039:
040:            private DocManager docManager;
041:            private Viewer pdfViewer;
042:            private J3dFlyContext context;
043:
044:            /** Creates new form DocPanel */
045:            public DocPanel(J3dFlyContext context) {
046:                this .context = context;
047:                initComponents();
048:
049:                try {
050:                    pdfViewer = new Viewer();
051:                } catch (Exception e) {
052:                    System.out.println("ERROR Construction PDF Viewer");
053:                    return;
054:                }
055:
056:                this .add(pdfViewer, java.awt.BorderLayout.CENTER);
057:
058:                try {
059:                    pdfViewer.activate();
060:                } catch (Exception e) {
061:                    System.out.println("ERROR Activating PDF Viewer");
062:                    return;
063:                }
064:
065:                docManager = new DocManager(this );
066:
067:                try {
068:                    pdfViewer
069:                            .setDocumentURL("file:///home/paulby/code/J3dFly_2.0_ws/src/geometry/doc-data/excalibur/excalibur.pdf");
070:                    pdfViewer
071:                            .execMenuItem(com.adobe.acrobat.ViewerCommand.ShowBookmarks_K);
072:                } catch (Exception e) {
073:                    System.out.println("ERROR Loading PDF Document");
074:                    return;
075:                }
076:
077:            }
078:
079:            /**
080:             * Return the Context for this Panel
081:             */
082:            J3dFlyContext getJ3dFlyContext() {
083:                return context;
084:            }
085:
086:            /** This method is called from within the constructor to
087:             * initialize the form.
088:             * WARNING: Do NOT modify this code. The content of this method is
089:             * always regenerated by the FormEditor.
090:             */
091:            private void initComponents() {//GEN-BEGIN:initComponents
092:                setLayout(new java.awt.BorderLayout());
093:            }//GEN-END:initComponents
094:
095:            /**
096:             * Called by EventProcessor when an event occurs for which this
097:             * listener has registered interest
098:             */
099:            public void processFlyEvent(
100:                    final org.jdesktop.j3dfly.event.FlyEvent evt) {
101:                if (evt instanceof  FileLoadEvent)
102:                    loadDocIndex((FileLoadEvent) evt);
103:                else if (evt instanceof  ObjectPickEvent)
104:                    processObjectPick((ObjectPickEvent) evt);
105:            }
106:
107:            /**
108:             * Load the Document index for the file that triggered the load event
109:             */
110:            private void loadDocIndex(FileLoadEvent evt) {
111:                System.out.println(evt.getFile().getName());
112:                String indexName = evt.getFile().getPath();
113:                indexName = indexName.substring(0, indexName.lastIndexOf('.'));
114:                indexName += ".pdfidx";
115:                System.out.println("Index " + indexName);
116:
117:                File file = new File(indexName);
118:                if (!file.exists()) {
119:                    System.out
120:                            .println("ERROR Can't open PDF document index file "
121:                                    + indexName);
122:                    return;
123:                }
124:
125:                docManager.loadIndex(file);
126:                context.getEventProcessor().addListener(this ,
127:                        ObjectPickEvent.class);
128:            }
129:
130:            /**
131:             * Show the PDF Document specified by the url (string)
132:             */
133:            void setDocument(String url) throws IOException {
134:                try {
135:                    pdfViewer.setDocumentURL(url);
136:                } catch (Exception e) {
137:                    System.out.println("ERROR Loading PDF Document " + url);
138:                }
139:            }
140:
141:            private void processObjectPick(ObjectPickEvent evt) {
142:                String bookmark = docManager.getBookmark(evt.getNode());
143:
144:                System.out.println("PDF got pick event ");
145:
146:                try {
147:                    pdfViewer.gotoNamedDest(bookmark);
148:                } catch (Exception e) {
149:                    System.out.println("ERROR Unable to goto PDF destination "
150:                            + bookmark);
151:                }
152:
153:            }
154:
155:            // Variables declaration - do not modify//GEN-BEGIN:variables
156:            // End of variables declaration//GEN-END:variables
157:
158:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.