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


001:        /**
002:         * Copyright (c) 2003-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.annotation;
031:
032:        import org.pdfbox.cos.COSDictionary;
033:
034:        import org.pdfbox.pdmodel.common.PDTextStream;
035:        import org.pdfbox.cos.COSBase;
036:
037:        import java.io.IOException;
038:
039:        import java.util.Calendar;
040:
041:        /**
042:         * This class represents the additonal fields of a Markup type Annotation.
043:         * 
044:         * 
045:         * @author Paul King
046:         * @version $Revision: 1.1 $
047:         */
048:        public abstract class PDAnnotationMarkup extends PDAnnotation {
049:
050:            /*
051:             * The various values of the reply type as defined in the PDF 1.6 reference
052:             * Table 8.17
053:             */
054:
055:            /**
056:             * Constant for an annotation reply type.
057:             */
058:            public static final String RT_REPLY = "R";
059:
060:            /**
061:             * Constant for an annotation reply type.
062:             */
063:            public static final String RT_GROUP = "Group";
064:
065:            /**
066:             * Constructor.
067:             */
068:            public PDAnnotationMarkup() {
069:                super ();
070:            }
071:
072:            /**
073:             * Constructor.
074:             * 
075:             * @param dict
076:             *            The annotations dictionary.
077:             */
078:            public PDAnnotationMarkup(COSDictionary dict) {
079:                super (dict);
080:            }
081:
082:            /**
083:             * Retrieve the string used as the title of the popup window shown when open
084:             * and active (by convention this identifies who added the annotation).
085:             * 
086:             * @return The title of the popup.
087:             */
088:            public String getTitlePopup() {
089:                return getDictionary().getString("T");
090:            }
091:
092:            /**
093:             * Set the string used as the title of the popup window shown when open and
094:             * active (by convention this identifies who added the annotation).
095:             * 
096:             * @param t
097:             *            The title of the popup.
098:             */
099:            public void setTitlePopup(String t) {
100:                getDictionary().setString("T", t);
101:            }
102:
103:            /**
104:             * This will retrieve the popup annotation used for entering/editing the
105:             * text for this annotation.
106:             * 
107:             * @return the popup annotation.
108:             */
109:            public PDAnnotationPopup getPopup() {
110:                COSDictionary popup = (COSDictionary) getDictionary()
111:                        .getDictionaryObject("Popup");
112:                if (popup != null) {
113:                    return new PDAnnotationPopup(popup);
114:                } else {
115:                    return null;
116:                }
117:            }
118:
119:            /**
120:             * This will set the popup annotation used for entering/editing the text for
121:             * this annotation.
122:             * 
123:             * @param popup
124:             *            the popup annotation.
125:             */
126:            public void setPopup(PDAnnotationPopup popup) {
127:                getDictionary().setItem("Popup", popup);
128:            }
129:
130:            /**
131:             * This will retrieve the constant opacity value used when rendering the
132:             * annotation (excluing any popup).
133:             * 
134:             * @return the constant opacity value.
135:             */
136:            public float getConstantOpacity() {
137:                return getDictionary().getFloat("CA", 1);
138:            }
139:
140:            /**
141:             * This will set the constant opacity value used when rendering the
142:             * annotation (excluing any popup).
143:             * 
144:             * @param ca
145:             *            the constant opacity value.
146:             */
147:            public void setConstantOpacity(float ca) {
148:                getDictionary().setFloat("CA", ca);
149:            }
150:
151:            /**
152:             * This will retrieve the rich text stream which is displayed in the popup
153:             * window.
154:             * 
155:             * @return the rich text stream.
156:             */
157:            public PDTextStream getRichContents() {
158:                COSBase rc = getDictionary().getDictionaryObject("RC");
159:                if (rc != null) {
160:                    return PDTextStream.createTextStream(rc);
161:                } else {
162:                    return null;
163:                }
164:            }
165:
166:            /**
167:             * This will set the rich text stream which is displayed in the popup window.
168:             * 
169:             * @param rc
170:             *            the rich text stream.
171:             */
172:            public void setRichContents(PDTextStream rc) {
173:                getDictionary().setItem("RC", rc);
174:            }
175:
176:            /**
177:             * This will retrieve the date and time the annotation was created.
178:             * 
179:             * @return the creation date/time.
180:             * @throws IOException
181:             *             if there is a format problem when converting the date.
182:             */
183:            public Calendar getCreationDate() throws IOException {
184:                return getDictionary().getDate("CreationDate");
185:            }
186:
187:            /**
188:             * This will set the the date and time the annotation was created.
189:             * 
190:             * @param creationDate
191:             *            the date and time the annotation was created.
192:             */
193:            public void setCreationDate(Calendar creationDate) {
194:                getDictionary().setDate("CreationDate", creationDate);
195:            }
196:
197:            /**
198:             * This will retrieve the annotation to which this one is "In Reply To" the
199:             * actual relationship is specified by the RT entry.
200:             * 
201:             * @return the other annotation.
202:             * @throws IOException
203:             *             if there is an error with the annotation.
204:             */
205:            public PDAnnotation getInReplyTo() throws IOException {
206:                COSBase irt = getDictionary().getDictionaryObject("IRT");
207:                return PDAnnotation.createAnnotation(irt);
208:            }
209:
210:            /**
211:             * This will set the annotation to which this one is "In Reply To" the
212:             * actual relationship is specified by the RT entry.
213:             * 
214:             * @param irt
215:             *            the annotation this one is "In Reply To".
216:             */
217:            public void setInReplyTo(PDAnnotation irt) {
218:                getDictionary().setItem("IRT", irt);
219:            }
220:
221:            /**
222:             * This will retrieve the short description of the subject of the annotation.
223:             * 
224:             * @return the subject.
225:             */
226:            public String getSubject() {
227:                return getDictionary().getString("Subj");
228:            }
229:
230:            /**
231:             * This will set the short description of the subject of the annotation.
232:             * 
233:             * @param subj
234:             *            short description of the subject.
235:             */
236:            public void setSubject(String subj) {
237:                getDictionary().setString("Subj", subj);
238:            }
239:
240:            /**
241:             * This will retrieve the Reply Type (relationship) with the annotation in
242:             * the IRT entry See the RT_* constants for the available values.
243:             * 
244:             * @return the relationship.
245:             */
246:            public String getReplyType() {
247:                return getDictionary().getNameAsString("RT", RT_REPLY);
248:            }
249:
250:            /**
251:             * This will set the Reply Type (relationship) with the annotation in the
252:             * IRT entry See the RT_* constants for the available values.
253:             * 
254:             * @param rt
255:             *            the reply type.
256:             */
257:            public void setReplyType(String rt) {
258:                getDictionary().setName("RT", rt);
259:            }
260:
261:            /**
262:             * This will retrieve the intent of the annotation The values and meanings
263:             * are specific to the actual annotation See the IT_* constants for the
264:             * annotation classes.
265:             * 
266:             * @return the intent
267:             */
268:            public String getIntent() {
269:                return getDictionary().getNameAsString("IT");
270:            }
271:
272:            /**
273:             * This will set the intent of the annotation The values and meanings are
274:             * specific to the actual annotation See the IT_* constants for the
275:             * annotation classes.
276:             * 
277:             * @param it
278:             *            the intent
279:             */
280:            public void setIntent(String it) {
281:                getDictionary().setName("IT", it);
282:            }
283:
284:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.