Source Code Cross Referenced for Meta.java in  » PDF » pdf-itext » com » lowagie » text » 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 » pdf itext » com.lowagie.text 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: Meta.java 2748 2007-05-12 15:11:48Z blowagie $
003:         * $Name$
004:         *
005:         * Copyright 1999, 2000, 2001, 2002 by Bruno Lowagie.
006:         *
007:         * The contents of this file are subject to the Mozilla Public License Version 1.1
008:         * (the "License"); you may not use this file except in compliance with the License.
009:         * You may obtain a copy of the License at http://www.mozilla.org/MPL/
010:         *
011:         * Software distributed under the License is distributed on an "AS IS" basis,
012:         * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
013:         * for the specific language governing rights and limitations under the License.
014:         *
015:         * The Original Code is 'iText, a free JAVA-PDF library'.
016:         *
017:         * The Initial Developer of the Original Code is Bruno Lowagie. Portions created by
018:         * the Initial Developer are Copyright (C) 1999, 2000, 2001, 2002 by Bruno Lowagie.
019:         * All Rights Reserved.
020:         * Co-Developer of the code is Paulo Soares. Portions created by the Co-Developer
021:         * are Copyright (C) 2000, 2001, 2002 by Paulo Soares. All Rights Reserved.
022:         *
023:         * Contributor(s): all the names of the contributors are added in the source code
024:         * where applicable.
025:         *
026:         * Alternatively, the contents of this file may be used under the terms of the
027:         * LGPL license (the "GNU LIBRARY GENERAL PUBLIC LICENSE"), in which case the
028:         * provisions of LGPL are applicable instead of those above.  If you wish to
029:         * allow use of your version of this file only under the terms of the LGPL
030:         * License and not to allow others to use your version of this file under
031:         * the MPL, indicate your decision by deleting the provisions above and
032:         * replace them with the notice and other provisions required by the LGPL.
033:         * If you do not delete the provisions above, a recipient may use your version
034:         * of this file under either the MPL or the GNU LIBRARY GENERAL PUBLIC LICENSE.
035:         *
036:         * This library is free software; you can redistribute it and/or modify it
037:         * under the terms of the MPL as stated above or under the terms of the GNU
038:         * Library General Public License as published by the Free Software Foundation;
039:         * either version 2 of the License, or any later version.
040:         *
041:         * This library is distributed in the hope that it will be useful, but WITHOUT
042:         * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
043:         * FOR A PARTICULAR PURPOSE. See the GNU Library general Public License for more
044:         * details.
045:         *
046:         * If you didn't download this code from the following link, you should check if
047:         * you aren't using an obsolete version:
048:         * http://www.lowagie.com/iText/
049:         */
050:
051:        package com.lowagie.text;
052:
053:        import java.util.ArrayList;
054:
055:        /**
056:         * This is an <CODE>Element</CODE> that contains
057:         * some meta information about the document.
058:         * <P>
059:         * An object of type <CODE>Meta</CODE> can not be constructed by the user.
060:         * Userdefined meta information should be placed in a <CODE>Header</CODE>-object.
061:         * <CODE>Meta</CODE> is reserved for: Subject, Keywords, Author, Title, Producer
062:         * and Creationdate information.
063:         *
064:         * @see		Element
065:         * @see		Header
066:         */
067:
068:        public class Meta implements  Element {
069:
070:            // membervariables
071:
072:            /** This is the type of Meta-information this object contains. */
073:            private int type;
074:
075:            /** This is the content of the Meta-information. */
076:            private StringBuffer content;
077:
078:            // constructors
079:
080:            /**
081:             * Constructs a <CODE>Meta</CODE>.
082:             *
083:             * @param	type		the type of meta-information
084:             * @param	content		the content
085:             */
086:            Meta(int type, String content) {
087:                this .type = type;
088:                this .content = new StringBuffer(content);
089:            }
090:
091:            /**
092:             * Constructs a <CODE>Meta</CODE>.
093:             *
094:             * @param	tag		    the tagname of the meta-information
095:             * @param	content		the content
096:             */
097:            public Meta(String tag, String content) {
098:                this .type = Meta.getType(tag);
099:                this .content = new StringBuffer(content);
100:            }
101:
102:            // implementation of the Element-methods
103:
104:            /**
105:             * Processes the element by adding it (or the different parts) to a
106:             * <CODE>ElementListener</CODE>.
107:             *
108:             * @param	listener		the <CODE>ElementListener</CODE>
109:             * @return	<CODE>true</CODE> if the element was processed successfully
110:             */
111:            public boolean process(ElementListener listener) {
112:                try {
113:                    return listener.add(this );
114:                } catch (DocumentException de) {
115:                    return false;
116:                }
117:            }
118:
119:            /**
120:             * Gets the type of the text element.
121:             *
122:             * @return	a type
123:             */
124:            public int type() {
125:                return type;
126:            }
127:
128:            /**
129:             * Gets all the chunks in this element.
130:             *
131:             * @return	an <CODE>ArrayList</CODE>
132:             */
133:            public ArrayList getChunks() {
134:                return new ArrayList();
135:            }
136:
137:            // methods
138:
139:            /**
140:             * appends some text to this <CODE>Meta</CODE>.
141:             *
142:             * @param	string      a <CODE>String</CODE>
143:             * @return	a <CODE>StringBuffer</CODE>
144:             */
145:            public StringBuffer append(String string) {
146:                return content.append(string);
147:            }
148:
149:            // methods to retrieve information
150:
151:            /**
152:             * Returns the content of the meta information.
153:             *
154:             * @return	a <CODE>String</CODE>
155:             */
156:            public String getContent() {
157:                return content.toString();
158:            }
159:
160:            /**
161:             * Returns the name of the meta information.
162:             *
163:             * @return	a <CODE>String</CODE>
164:             */
165:
166:            public String getName() {
167:                switch (type) {
168:                case Element.SUBJECT:
169:                    return ElementTags.SUBJECT;
170:                case Element.KEYWORDS:
171:                    return ElementTags.KEYWORDS;
172:                case Element.AUTHOR:
173:                    return ElementTags.AUTHOR;
174:                case Element.TITLE:
175:                    return ElementTags.TITLE;
176:                case Element.PRODUCER:
177:                    return ElementTags.PRODUCER;
178:                case Element.CREATIONDATE:
179:                    return ElementTags.CREATIONDATE;
180:                default:
181:                    return ElementTags.UNKNOWN;
182:                }
183:            }
184:
185:            /**
186:             * Returns the name of the meta information.
187:             * 
188:             * @param tag iText tag for meta information
189:             * @return	the Element value corresponding with the given tag
190:             */
191:            public static int getType(String tag) {
192:                if (ElementTags.SUBJECT.equals(tag)) {
193:                    return Element.SUBJECT;
194:                }
195:                if (ElementTags.KEYWORDS.equals(tag)) {
196:                    return Element.KEYWORDS;
197:                }
198:                if (ElementTags.AUTHOR.equals(tag)) {
199:                    return Element.AUTHOR;
200:                }
201:                if (ElementTags.TITLE.equals(tag)) {
202:                    return Element.TITLE;
203:                }
204:                if (ElementTags.PRODUCER.equals(tag)) {
205:                    return Element.PRODUCER;
206:                }
207:                if (ElementTags.CREATIONDATE.equals(tag)) {
208:                    return Element.CREATIONDATE;
209:                }
210:                return Element.HEADER;
211:            }
212:
213:            // deprecated
214:
215:            /**
216:             * Returns the name of the meta information.
217:             *
218:             * @return	a <CODE>String</CODE>
219:             * @deprecated Use {@link #getName()} instead
220:             */
221:            public String name() {
222:                return getName();
223:            }
224:
225:            /**
226:             * Returns the content of the meta information.
227:             *
228:             * @return	a <CODE>String</CODE>
229:             * @deprecated Use {@link #getContent()} instead
230:             */
231:            public String content() {
232:                return getContent();
233:            }
234:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.