Source Code Cross Referenced for PDThreadBead.java in  » PDF » PDFBox-0.7.3 » org » pdfbox » pdmodel » interactive » pagenavigation » 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 » PDF » PDFBox 0.7.3 » org.pdfbox.pdmodel.interactive.pagenavigation 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright (c) 2005, www.pdfbox.org
003:         * All rights reserved.
004:         *
005:         * Redistribution and use in source and binary forms, with or without
006:         * modification, are permitted provided that the following conditions are met:
007:         *
008:         * 1. Redistributions of source code must retain the above copyright notice,
009:         *    this list of conditions and the following disclaimer.
010:         * 2. Redistributions in binary form must reproduce the above copyright notice,
011:         *    this list of conditions and the following disclaimer in the documentation
012:         *    and/or other materials provided with the distribution.
013:         * 3. Neither the name of pdfbox; nor the names of its
014:         *    contributors may be used to endorse or promote products derived from this
015:         *    software without specific prior written permission.
016:         *
017:         * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
018:         * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
019:         * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
020:         * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
021:         * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
022:         * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
023:         * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
024:         * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
025:         * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
026:         * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
027:         *
028:         * http://www.pdfbox.org
029:         *
030:         */package org.pdfbox.pdmodel.interactive.pagenavigation;
031:
032:        import org.pdfbox.cos.COSArray;
033:        import org.pdfbox.cos.COSBase;
034:        import org.pdfbox.cos.COSDictionary;
035:        import org.pdfbox.cos.COSName;
036:
037:        import org.pdfbox.pdmodel.PDPage;
038:        import org.pdfbox.pdmodel.common.COSObjectable;
039:        import org.pdfbox.pdmodel.common.PDRectangle;
040:
041:        /**
042:         * This a single bead in a thread in a PDF document.
043:         *
044:         * @author <a href="mailto:ben@benlitchfield.com">Ben Litchfield</a>
045:         * @version $Revision: 1.4 $
046:         */
047:        public class PDThreadBead implements  COSObjectable {
048:
049:            private COSDictionary bead;
050:
051:            /**
052:             * Constructor that is used for a preexisting dictionary.
053:             *
054:             * @param b The underlying dictionary.
055:             */
056:            public PDThreadBead(COSDictionary b) {
057:                bead = b;
058:            }
059:
060:            /**
061:             * Default constructor.
062:             * 
063:             */
064:            public PDThreadBead() {
065:                bead = new COSDictionary();
066:                bead.setName("Type", "Bead");
067:                setNextBead(this );
068:                setPreviousBead(this );
069:            }
070:
071:            /**
072:             * This will get the underlying dictionary that this object wraps.
073:             *
074:             * @return The underlying info dictionary.
075:             */
076:            public COSDictionary getDictionary() {
077:                return bead;
078:            }
079:
080:            /**
081:             * Convert this standard java object to a COS object.
082:             *
083:             * @return The cos object that matches this Java object.
084:             */
085:            public COSBase getCOSObject() {
086:                return bead;
087:            }
088:
089:            /**
090:             * This will get the thread that this bead is part of.  This is only required
091:             * for the first bead in a thread, so other beads 'may' return null.
092:             * 
093:             * @return The thread that this bead is part of.
094:             */
095:            public PDThread getThread() {
096:                PDThread retval = null;
097:                COSDictionary dic = (COSDictionary) bead
098:                        .getDictionaryObject("T");
099:                if (dic != null) {
100:                    retval = new PDThread(dic);
101:                }
102:                return retval;
103:            }
104:
105:            /**
106:             * Set the thread that this bead is part of.  This is only required for the
107:             * first bead in a thread.  Note: This property is set for you by the PDThread.setFirstBead() method.
108:             * 
109:             * @param thread The thread that this bead is part of.
110:             */
111:            public void setThread(PDThread thread) {
112:                bead.setItem("T", thread);
113:            }
114:
115:            /**
116:             * This will get the next bead.  If this bead is the last bead in the list then this
117:             * will return the first bead. 
118:             * 
119:             * @return The next bead in the list or the first bead if this is the last bead.
120:             */
121:            public PDThreadBead getNextBead() {
122:                return new PDThreadBead((COSDictionary) bead
123:                        .getDictionaryObject("N"));
124:            }
125:
126:            /**
127:             * Set the next bead in the thread.
128:             * 
129:             * @param next The next bead.
130:             */
131:            protected void setNextBead(PDThreadBead next) {
132:                bead.setItem("N", next);
133:            }
134:
135:            /**
136:             * This will get the previous bead.  If this bead is the first bead in the list then this
137:             * will return the last bead. 
138:             * 
139:             * @return The previous bead in the list or the last bead if this is the first bead.
140:             */
141:            public PDThreadBead getPreviousBead() {
142:                return new PDThreadBead((COSDictionary) bead
143:                        .getDictionaryObject("V"));
144:            }
145:
146:            /**
147:             * Set the previous bead in the thread.
148:             * 
149:             * @param previous The previous bead.
150:             */
151:            protected void setPreviousBead(PDThreadBead previous) {
152:                bead.setItem("V", previous);
153:            }
154:
155:            /**
156:             * Append a bead after this bead.  This will correctly set the next/previous beads in the
157:             * linked list.
158:             * 
159:             * @param append The bead to insert.
160:             */
161:            public void appendBead(PDThreadBead append) {
162:                PDThreadBead nextBead = getNextBead();
163:                nextBead.setPreviousBead(append);
164:                append.setNextBead(nextBead);
165:                setNextBead(append);
166:                append.setPreviousBead(this );
167:            }
168:
169:            /**
170:             * Get the page that this bead is part of.
171:             * 
172:             * @return The page that this bead is part of.
173:             */
174:            public PDPage getPage() {
175:                PDPage page = null;
176:                COSDictionary dic = (COSDictionary) bead
177:                        .getDictionaryObject("P");
178:                if (dic != null) {
179:                    page = new PDPage(dic);
180:                }
181:                return page;
182:            }
183:
184:            /**
185:             * Set the page that this bead is part of.  This is a required property and must be
186:             * set when creating a new bead.  The PDPage object also has a list of beads in the natural
187:             * reading order.  It is recommended that you add this object to that list as well.
188:             * 
189:             * @param page The page that this bead is on.
190:             */
191:            public void setPage(PDPage page) {
192:                bead.setItem("P", page);
193:            }
194:
195:            /**
196:             * The rectangle on the page that this bead is part of.
197:             * 
198:             * @return The part of the page that this bead covers.
199:             */
200:            public PDRectangle getRectangle() {
201:                PDRectangle rect = null;
202:                COSArray array = (COSArray) bead.getDictionaryObject(COSName.R);
203:                if (array != null) {
204:                    rect = new PDRectangle(array);
205:                }
206:                return rect;
207:            }
208:
209:            /**
210:             * Set the rectangle on the page that this bead covers.
211:             * 
212:             * @param rect The portion of the page that this bead covers.
213:             */
214:            public void setRectangle(PDRectangle rect) {
215:                bead.setItem(COSName.R, rect);
216:            }
217:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.