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


001:        package com.lowagie.text.pdf.collection;
002:
003:        import com.lowagie.text.pdf.PdfBoolean;
004:        import com.lowagie.text.pdf.PdfDate;
005:        import com.lowagie.text.pdf.PdfDictionary;
006:        import com.lowagie.text.pdf.PdfName;
007:        import com.lowagie.text.pdf.PdfNumber;
008:        import com.lowagie.text.pdf.PdfObject;
009:        import com.lowagie.text.pdf.PdfString;
010:
011:        /**
012:         * @author blowagie
013:         *
014:         */
015:        public class PdfCollectionField extends PdfDictionary {
016:            /** A possible type of collection field. */
017:            public static final int TEXT = 0;
018:            /** A possible type of collection field. */
019:            public static final int DATE = 1;
020:            /** A possible type of collection field. */
021:            public static final int NUMBER = 2;
022:            /** A possible type of collection field. */
023:            public static final int FILENAME = 3;
024:            /** A possible type of collection field. */
025:            public static final int DESC = 4;
026:            /** A possible type of collection field. */
027:            public static final int MODDATE = 5;
028:            /** A possible type of collection field. */
029:            public static final int CREATIONDATE = 6;
030:            /** A possible type of collection field. */
031:            public static final int SIZE = 7;
032:
033:            /** The type of the PDF collection field. */
034:            protected int type;
035:
036:            /**
037:             * Creates a PdfCollectionField.
038:             * @param name		the field name
039:             * @param type		the field type
040:             */
041:            public PdfCollectionField(String name, int type) {
042:                super (PdfName.COLLECTIONFIELD);
043:                put(PdfName.N, new PdfString(name, PdfObject.TEXT_UNICODE));
044:                this .type = type;
045:                switch (type) {
046:                default:
047:                    put(PdfName.SUBTYPE, PdfName.S);
048:                    break;
049:                case DATE:
050:                    put(PdfName.SUBTYPE, PdfName.D);
051:                    break;
052:                case NUMBER:
053:                    put(PdfName.SUBTYPE, PdfName.N);
054:                    break;
055:                case FILENAME:
056:                    put(PdfName.SUBTYPE, PdfName.F);
057:                    break;
058:                case DESC:
059:                    put(PdfName.SUBTYPE, PdfName.DESC);
060:                    break;
061:                case MODDATE:
062:                    put(PdfName.SUBTYPE, PdfName.MODDATE);
063:                    break;
064:                case CREATIONDATE:
065:                    put(PdfName.SUBTYPE, PdfName.CREATIONDATE);
066:                    break;
067:                case SIZE:
068:                    put(PdfName.SUBTYPE, PdfName.SIZE);
069:                    break;
070:                }
071:            }
072:
073:            /**
074:             * The relative order of the field name. Fields are sorted in ascending order.
075:             * @param i	a number indicating the order of the field
076:             */
077:            public void setOrder(int i) {
078:                put(PdfName.O, new PdfNumber(i));
079:            }
080:
081:            /**
082:             * Sets the initial visibility of the field.
083:             * @param visible	the default is true (visible)
084:             */
085:            public void setVisible(boolean visible) {
086:                put(PdfName.V, new PdfBoolean(visible));
087:            }
088:
089:            /**
090:             * Indication if the field value should be editable in the viewer.
091:             * @param editable	the default is false (not editable)
092:             */
093:            public void setEditable(boolean editable) {
094:                put(PdfName.E, new PdfBoolean(editable));
095:            }
096:
097:            /**
098:             * Checks if the type of the field is suitable for a Collection Item.
099:             */
100:            public boolean isCollectionItem() {
101:                switch (type) {
102:                case TEXT:
103:                case DATE:
104:                case NUMBER:
105:                    return true;
106:                default:
107:                    return false;
108:                }
109:            }
110:
111:            /**
112:             * Returns a PdfObject that can be used as the value of a Collection Item.
113:             * @param v	value	the value that has to be changed into a PdfObject (PdfString, PdfDate or PdfNumber)	
114:             */
115:            public PdfObject getValue(String v) {
116:                switch (type) {
117:                case TEXT:
118:                    return new PdfString(v, PdfObject.TEXT_UNICODE);
119:                case DATE:
120:                    return new PdfDate(PdfDate.decode(v));
121:                case NUMBER:
122:                    return new PdfNumber(v);
123:                }
124:                throw new IllegalArgumentException(v
125:                        + " is not an acceptable value for the field "
126:                        + get(PdfName.N).toString());
127:            }
128:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.