Source Code Cross Referenced for PjInfo.java in  » PDF » pjx » com » etymon » pj » object » 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 » pjx » com.etymon.pj.object 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.etymon.pj.object;
002:
003:        import java.io.*;
004:        import java.util.*;
005:        import com.etymon.pj.*;
006:        import com.etymon.pj.exception.*;
007:
008:        /**
009:         A representation of a PDF Info dictionary.
010:         @author Nassib Nassar
011:         */
012:        public class PjInfo extends PjDictionary {
013:
014:            /**
015:               Creates a new Info dictionary.
016:             */
017:            public PjInfo() {
018:                super ();
019:                addDefaults();
020:            }
021:
022:            /**
023:               Creates an Info dictionary as a wrapper around a Hashtable.
024:               @param h the Hashtable to use for this dictionary.
025:             */
026:            public PjInfo(Hashtable h) {
027:                super (h);
028:                addDefaults();
029:            }
030:
031:            public void setAuthor(PjString author) {
032:                _h.put(PjName.AUTHOR, author);
033:            }
034:
035:            public void setAuthor(PjReference author) {
036:                _h.put(PjName.AUTHOR, author);
037:            }
038:
039:            public PjObject getAuthor() throws InvalidPdfObjectException {
040:                return hget(PjName.AUTHOR);
041:            }
042:
043:            public void setCreationDate(PjDate creationDate) {
044:                _h.put(PjName.CREATIONDATE, creationDate);
045:            }
046:
047:            public void setCreationDate(PjReference creationDate) {
048:                _h.put(PjName.CREATIONDATE, creationDate);
049:            }
050:
051:            public PjObject getCreationDate() throws InvalidPdfObjectException {
052:                return hget(PjName.CREATIONDATE);
053:            }
054:
055:            public void setModDate(PjDate modDate) {
056:                _h.put(PjName.MODDATE, modDate);
057:            }
058:
059:            public void setModDate(PjReference modDate) {
060:                _h.put(PjName.MODDATE, modDate);
061:            }
062:
063:            public PjObject getModDate() throws InvalidPdfObjectException {
064:                return hget(PjName.MODDATE);
065:            }
066:
067:            public void setCreator(PjString creator) {
068:                _h.put(PjName.CREATOR, creator);
069:            }
070:
071:            public void setCreator(PjReference creator) {
072:                _h.put(PjName.CREATOR, creator);
073:            }
074:
075:            public PjObject getCreator() throws InvalidPdfObjectException {
076:                return hget(PjName.CREATOR);
077:            }
078:
079:            public void setProducer(PjString producer) {
080:                _h.put(PjName.PRODUCER, new PjString(PjConst.COPYRIGHT_IN_INFO
081:                        .getString()
082:                        + ". " + producer.getString()));
083:            }
084:
085:            public PjObject getProducer() throws InvalidPdfObjectException {
086:                return hget(PjName.PRODUCER);
087:            }
088:
089:            public void setTitle(PjString title) {
090:                _h.put(PjName.TITLE, title);
091:            }
092:
093:            public void setTitle(PjReference title) {
094:                _h.put(PjName.TITLE, title);
095:            }
096:
097:            public PjObject getTitle() throws InvalidPdfObjectException {
098:                return hget(PjName.TITLE);
099:            }
100:
101:            public void setSubject(PjString subject) {
102:                _h.put(PjName.SUBJECT, subject);
103:            }
104:
105:            public void setSubject(PjReference subject) {
106:                _h.put(PjName.SUBJECT, subject);
107:            }
108:
109:            public PjObject getSubject() throws InvalidPdfObjectException {
110:                return hget(PjName.SUBJECT);
111:            }
112:
113:            public void setKeywords(PjString keywords) {
114:                _h.put(PjName.KEYWORDS, keywords);
115:            }
116:
117:            public void setKeywords(PjReference keywords) {
118:                _h.put(PjName.KEYWORDS, keywords);
119:            }
120:
121:            public PjObject getKeywords() throws InvalidPdfObjectException {
122:                return hget(PjName.KEYWORDS);
123:            }
124:
125:            /**
126:               Examines a dictionary to see if it is a PDF Info
127:               dictionary.
128:               @param dictionary the dictionary to examine.
129:               @return true if the dictionary could be interpreted as a
130:               valid PjInfo object.
131:             */
132:            public static boolean isLike(PjDictionary dictionary) {
133:		// run through the keys and see if they are all valid,
134:		// and make sure there is at least one valid key
135:		boolean atLeastOneValid = false;
136:		Hashtable h = dictionary.getHashtable();
137:		PjName key;
138:		for (Enumeration enum = h.keys(); enum.hasMoreElements();) {
139:			key = (PjName)(enum.nextElement());
140:			if ( ( ! key.equals(PjName.AUTHOR) ) &&
141:			     ( ! key.equals(PjName.CREATIONDATE) ) &&
142:			     ( ! key.equals(PjName.MODDATE) ) &&
143:			     ( ! key.equals(PjName.CREATOR) ) &&
144:			     ( ! key.equals(PjName.PRODUCER) ) &&
145:			     ( ! key.equals(PjName.TITLE) ) &&
146:			     ( ! key.equals(PjName.SUBJECT) ) &&
147:			     ( ! key.equals(PjName.KEYWORDS) ) ) {
148:				return false;
149:			} else {
150:				if ( ! atLeastOneValid ) {
151:					atLeastOneValid = true;
152:				}
153:			}
154:		}
155:		return atLeastOneValid;
156:	}
157:
158:            /**
159:               Returns a deep copy of this object.
160:               @return a deep copy of this object.
161:               @exception CloneNotSupportedException if the instance can not be cloned.
162:             */
163:            public Object clone() throws CloneNotSupportedException {
164:                return new PjInfo(cloneHt());
165:            }
166:
167:            private void addDefaults() {
168:                // Here we insert the PjConst.COPYRIGHT_IN_INFO
169:                // constant, which contains the pj copyright notice.
170:                // You may not remove this copyright notice.
171:                _h.put(PjName.PRODUCER, PjConst.COPYRIGHT_IN_INFO);
172:                // also need to add CreationDate and ModDate
173:            }
174:
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.