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


001:        package com.lowagie.text.rtf.graphic;
002:
003:        import java.io.ByteArrayOutputStream;
004:        import java.io.IOException;
005:        import java.io.OutputStream;
006:
007:        import com.lowagie.text.rtf.RtfAddableElement;
008:
009:        /**
010:         * The RtfShapePosition stores position and ordering
011:         * information for one RtfShape.
012:         * 
013:         * @version $Id: RtfShapePosition.java 2776 2007-05-23 20:01:40Z hallm $
014:         * @author Mark Hall (mhall@edu.uni-klu.ac.at)
015:         * @author Thomas Bickel (tmb99@inode.at)
016:         */
017:        public class RtfShapePosition extends RtfAddableElement {
018:            /**
019:             * Constant for horizontal positioning relative to the page.
020:             */
021:            public static final int POSITION_X_RELATIVE_PAGE = 0;
022:            /**
023:             * Constant for horizontal positioning relative to the margin.
024:             */
025:            public static final int POSITION_X_RELATIVE_MARGIN = 1;
026:            /**
027:             * Constant for horizontal positioning relative to the column.
028:             */
029:            public static final int POSITION_X_RELATIVE_COLUMN = 2;
030:            /**
031:             * Constant for vertical positioning relative to the page.
032:             */
033:            public static final int POSITION_Y_RELATIVE_PAGE = 0;
034:            /**
035:             * Constant for vertical positioning relative to the margin.
036:             */
037:            public static final int POSITION_Y_RELATIVE_MARGIN = 1;
038:            /**
039:             * Constant for vertical positioning relative to the paragraph.
040:             */
041:            public static final int POSITION_Y_RELATIVE_PARAGRAPH = 2;
042:
043:            /**
044:             * The top coordinate of this RtfShapePosition.
045:             */
046:            private int top = 0;
047:            /**
048:             * The left coordinate of this RtfShapePosition.
049:             */
050:            private int left = 0;
051:            /**
052:             * The right coordinate of this RtfShapePosition.
053:             */
054:            private int right = 0;
055:            /**
056:             * The bottom coordinate of this RtfShapePosition.
057:             */
058:            private int bottom = 0;
059:            /**
060:             * The z order of this RtfShapePosition.
061:             */
062:            private int zOrder = 0;
063:            /**
064:             * The horizontal relative position.
065:             */
066:            private int xRelativePos = POSITION_X_RELATIVE_PAGE;
067:            /**
068:             * The vertical relative position.
069:             */
070:            private int yRelativePos = POSITION_Y_RELATIVE_PAGE;
071:            /**
072:             * Whether to ignore the horizontal relative position.
073:             */
074:            private boolean ignoreXRelative = false;
075:            /**
076:             * Whether to ignore the vertical relative position.
077:             */
078:            private boolean ignoreYRelative = false;
079:            /**
080:             * Whether the shape is below the text.
081:             */
082:            private boolean shapeBelowText = false;
083:
084:            /**
085:             * Constructs a new RtfShapePosition with the four bounding coordinates.
086:             * 
087:             * @param top The top coordinate.
088:             * @param left The left coordinate.
089:             * @param right The right coordinate.
090:             * @param bottom The bottom coordinate.
091:             */
092:            public RtfShapePosition(int top, int left, int right, int bottom) {
093:                this .top = top;
094:                this .left = left;
095:                this .right = right;
096:                this .bottom = bottom;
097:            }
098:
099:            /**
100:             * Gets whether the shape is below the text.
101:             * 
102:             * @return <code>True</code> if the shape is below, <code>false</code> if the text is below.
103:             */
104:            public boolean isShapeBelowText() {
105:                return shapeBelowText;
106:            }
107:
108:            /**
109:             * Sets whether the shape is below the text.
110:             * 
111:             * @param shapeBelowText <code>True</code> if the shape is below, <code>false</code> if the text is below.
112:             */
113:            public void setShapeBelowText(boolean shapeBelowText) {
114:                this .shapeBelowText = shapeBelowText;
115:            }
116:
117:            /**
118:             * Sets the relative horizontal position. Use one of the constants
119:             * provided in this class.
120:             * 
121:             * @param relativePos The relative horizontal position to use.
122:             */
123:            public void setXRelativePos(int relativePos) {
124:                xRelativePos = relativePos;
125:            }
126:
127:            /**
128:             * Sets the relative vertical position. Use one of the constants
129:             * provides in this class.
130:             * 
131:             * @param relativePos The relative vertical position to use.
132:             */
133:            public void setYRelativePos(int relativePos) {
134:                yRelativePos = relativePos;
135:            }
136:
137:            /**
138:             * Sets the z order to use.
139:             * 
140:             * @param order The z order to use.
141:             */
142:            public void setZOrder(int order) {
143:                zOrder = order;
144:            }
145:
146:            /**
147:             * Set whether to ignore the horizontal relative position.
148:             * 
149:             * @param ignoreXRelative <code>True</code> to ignore the horizontal relative position, <code>false</code> otherwise.
150:             */
151:            protected void setIgnoreXRelative(boolean ignoreXRelative) {
152:                this .ignoreXRelative = ignoreXRelative;
153:            }
154:
155:            /**
156:             * Set whether to ignore the vertical relative position.
157:             * 
158:             * @param ignoreYRelative <code>True</code> to ignore the vertical relative position, <code>false</code> otherwise.
159:             */
160:            protected void setIgnoreYRelative(boolean ignoreYRelative) {
161:                this .ignoreYRelative = ignoreYRelative;
162:            }
163:
164:            /**
165:             * Write this RtfShapePosition.
166:             * @deprecated replaced by {@link #writeContent(OutputStream)}
167:             */
168:            public byte[] write() {
169:                ByteArrayOutputStream result = new ByteArrayOutputStream();
170:                try {
171:                    writeContent(result);
172:                } catch (IOException ioe) {
173:                    ioe.printStackTrace();
174:                }
175:                return result.toByteArray();
176:            }
177:
178:            /**
179:             * Write this RtfShapePosition.
180:             */
181:            public void writeContent(final OutputStream result)
182:                    throws IOException {
183:                result.write("\\shpleft".getBytes());
184:                result.write(intToByteArray(this .left));
185:                result.write("\\shptop".getBytes());
186:                result.write(intToByteArray(this .top));
187:                result.write("\\shpright".getBytes());
188:                result.write(intToByteArray(this .right));
189:                result.write("\\shpbottom".getBytes());
190:                result.write(intToByteArray(this .bottom));
191:                result.write("\\shpz".getBytes());
192:                result.write(intToByteArray(this .zOrder));
193:                switch (this .xRelativePos) {
194:                case POSITION_X_RELATIVE_PAGE:
195:                    result.write("\\shpbxpage".getBytes());
196:                    break;
197:                case POSITION_X_RELATIVE_MARGIN:
198:                    result.write("\\shpbxmargin".getBytes());
199:                    break;
200:                case POSITION_X_RELATIVE_COLUMN:
201:                    result.write("\\shpbxcolumn".getBytes());
202:                    break;
203:                }
204:                if (this .ignoreXRelative) {
205:                    result.write("\\shpbxignore".getBytes());
206:                }
207:                switch (this .yRelativePos) {
208:                case POSITION_Y_RELATIVE_PAGE:
209:                    result.write("\\shpbypage".getBytes());
210:                    break;
211:                case POSITION_Y_RELATIVE_MARGIN:
212:                    result.write("\\shpbymargin".getBytes());
213:                    break;
214:                case POSITION_Y_RELATIVE_PARAGRAPH:
215:                    result.write("\\shpbypara".getBytes());
216:                    break;
217:                }
218:                if (this .ignoreYRelative) {
219:                    result.write("\\shpbyignore".getBytes());
220:                }
221:                if (this .shapeBelowText) {
222:                    result.write("\\shpfblwtxt1".getBytes());
223:                } else {
224:                    result.write("\\shpfblwtxt0".getBytes());
225:                }
226:            }
227:
228:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.