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


001:        package com.etymon.pjx.util;
002:
003:        import com.etymon.pjx.*;
004:
005:        /**
006:         Modifies indirect references within a PDF object, adding a
007:         specified offset to each object number in a reference.  {@link
008:         PdfObjectFilter PdfObjectFilter} is used to filter the indirect
009:         references.  This class is synchronized.
010:         @author Nassib Nassar
011:         */
012:        public class PdfRenumberOffset implements  PdfObjectFilter {
013:
014:            /**
015:               The offset value to add to each object number.
016:             */
017:            protected int _offset;
018:
019:            /**
020:               Controls whether generation numbers will be set to 0 during
021:               the renumbering process.  If so, the value is
022:               <code>true</code>.
023:             */
024:            protected boolean _resetG;
025:
026:            /**
027:               Constructs a <code>PdfRenumberOffset</code> instance.  By
028:               default, generation numbers will not be modified (see
029:               {@link #resetGeneration(boolean)
030:               resetGeneration(boolean)}).  The offset value defaults to 0
031:               (see {@link #setOffset(int) setOffset(int)}).
032:             */
033:            public PdfRenumberOffset() {
034:
035:                _offset = 0;
036:                _resetG = false;
037:
038:            }
039:
040:            /**
041:               Sets the offset value to add to each object number during
042:               renumbering.
043:               @param offset the offset to use.
044:             */
045:            public void setOffset(int offset) {
046:                synchronized (this ) {
047:
048:                    _offset = offset;
049:
050:                }
051:            }
052:
053:            /**
054:               Controls whether generation numbers will be set to 0 during
055:               the renumbering process.
056:               @param reset if <code>true</code>, generation numbers will
057:               be set to 0; otherwise they are not modified.
058:             */
059:            public void resetGeneration(boolean reset) {
060:                synchronized (this ) {
061:
062:                    _resetG = reset;
063:
064:                }
065:            }
066:
067:            /**
068:               Adds an offset to the object number in each {@link
069:               PdfReference PdfReference} within the specified object.
070:               The generation number may optionally be reset to 0 (see
071:               {@link #resetGeneration(boolean)
072:               resetGeneration(boolean)}).  The offset is specified with
073:               {@link #setOffset(int) setOffset(int)}.
074:               @param obj the object to renumber.
075:               @return the renumbered object.
076:               @throws PdfFormatException
077:             */
078:            public PdfObject renumber(PdfObject obj) throws PdfFormatException {
079:                synchronized (this ) {
080:
081:                    return obj.filter(this );
082:
083:                }
084:            }
085:
086:            /**
087:               This method is used by {@link #renumber(PdfObject)
088:               renumber(PdfObject)} to filter indirect references and
089:               <b>should not be called externally</b>.  (It is not
090:               synchronized.)
091:               @param obj the object to filter.
092:               @return the filtered object.
093:               @throws PdfFormatException
094:             */
095:            public PdfObject preFilter(PdfObject obj) throws PdfFormatException {
096:                if (obj instanceof  PdfReference) {
097:                    PdfReference r = (PdfReference) obj;
098:                    return new PdfReference(r.getObjectNumber() + _offset,
099:                            _resetG ? 0 : r.getGenerationNumber());
100:                } else {
101:                    return obj;
102:                }
103:            }
104:
105:            /**
106:               This method is used by {@link #renumber(PdfObject)
107:               renumber(PdfObject)} to filter indirect references and
108:               <b>should not be called externally</b>.  (It is not
109:               synchronized.)
110:               @param obj the object to filter.
111:               @return the filtered object.
112:               @throws PdfFormatException
113:             */
114:            public PdfObject postFilter(PdfObject obj)
115:                    throws PdfFormatException {
116:                return obj;
117:            }
118:
119:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.