Source Code Cross Referenced for RtfListTable.java in  » Graphic-Library » fop » org » apache » fop » render » rtf » rtflib » rtfdoc » 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 » Graphic Library » fop » org.apache.fop.render.rtf.rtflib.rtfdoc 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Licensed to the Apache Software Foundation (ASF) under one or more
003:         * contributor license agreements.  See the NOTICE file distributed with
004:         * this work for additional information regarding copyright ownership.
005:         * The ASF licenses this file to You under the Apache License, Version 2.0
006:         * (the "License"); you may not use this file except in compliance with
007:         * the License.  You may obtain a copy of the License at
008:         * 
009:         *      http://www.apache.org/licenses/LICENSE-2.0
010:         * 
011:         * Unless required by applicable law or agreed to in writing, software
012:         * distributed under the License is distributed on an "AS IS" BASIS,
013:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014:         * See the License for the specific language governing permissions and
015:         * limitations under the License.
016:         */
017:
018:        /* $Id: RtfListTable.java 426576 2006-07-28 15:44:37Z jeremias $ */
019:
020:        package org.apache.fop.render.rtf.rtflib.rtfdoc;
021:
022:        /*
023:         * This file is part of the RTF library of the FOP project, which was originally
024:         * created by Bertrand Delacretaz <bdelacretaz@codeconsult.ch> and by other
025:         * contributors to the jfor project (www.jfor.org), who agreed to donate jfor to
026:         * the FOP project.
027:         */
028:
029:        import java.util.LinkedList;
030:        import java.util.Iterator;
031:        import java.io.Writer;
032:        import java.io.IOException;
033:
034:        //import org.apache.fop.render.rtf.rtflib.jfor.main.JForVersionInfo;
035:
036:        /**
037:         * RtfListTable: used to make the list table in the header section of the RtfFile.
038:         * This is the method that Word uses to make lists in RTF and the way most RTF readers,
039:         * esp. Adobe FrameMaker read lists from RTF.
040:         * @author Christopher Scott, scottc@westinghouse.com
041:         */
042:        public class RtfListTable extends RtfContainer {
043:            private LinkedList lists;
044:            private LinkedList styles;
045:
046:            //static data members
047:            /** constant for a list table */
048:            public static final String LIST_TABLE = "listtable";
049:            /** constant for a list */
050:            public static final String LIST = "list";
051:            /** constant for a list template id */
052:            public static final String LIST_TEMPLATE_ID = "listtemplateid";
053:            /** constant for a list level */
054:            public static final String LIST_LEVEL = "listlevel";
055:            /** constant for a list number type */
056:            public static final String LIST_NUMBER_TYPE = "levelnfc";
057:            /** constant for a list justification */
058:            public static final String LIST_JUSTIFICATION = "leveljc";
059:            /** constant for list following character */
060:            public static final String LIST_FOLLOWING_CHAR = "levelfollow";
061:            /** constant for list start at */
062:            public static final String LIST_START_AT = "levelstartat";
063:            /** constant for list space */
064:            public static final String LIST_SPACE = "levelspace";
065:            /** constant for list indentation */
066:            public static final String LIST_INDENT = "levelindent";
067:            /** constant for list text format */
068:            public static final String LIST_TEXT_FORM = "leveltext";
069:            /** constant for list number positioning */
070:            public static final String LIST_NUM_POSITION = "levelnumbers";
071:            /** constant for list name */
072:            public static final String LIST_NAME = "listname ;";
073:            /** constant for list ID */
074:            public static final String LIST_ID = "listid";
075:            /** constant for list font type */
076:            public static final String LIST_FONT_TYPE = "f";
077:            /** constant for list override table */
078:            public static final String LIST_OVR_TABLE = "listoverridetable";
079:            /** constant for list override */
080:            public static final String LIST_OVR = "listoverride";
081:            /** constant for list override count */
082:            public static final String LIST_OVR_COUNT = "listoverridecount";
083:            /** constant for list number */
084:            public static final String LIST_NUMBER = "ls";
085:
086:            /** String array of list table attributes */
087:            public static final String[] LIST_TABLE_ATTR = { LIST_TABLE, LIST,
088:                    LIST_TEMPLATE_ID, LIST_NUMBER_TYPE, LIST_JUSTIFICATION,
089:                    LIST_FOLLOWING_CHAR, LIST_START_AT, LIST_SPACE,
090:                    LIST_INDENT, LIST_TEXT_FORM, LIST_NUM_POSITION, LIST_ID,
091:                    LIST_OVR_TABLE, LIST_OVR, LIST_OVR_COUNT, LIST_NUMBER,
092:                    LIST_LEVEL };
093:
094:            /**
095:             * RtfListTable Constructor: sets the number of the list, and allocates
096:             * for the RtfAttributes
097:             * @param parent RtfContainer holding this RtfListTable
098:             * @param w Writer
099:             * @param num number of the list in the document
100:             * @param attrs attributes of new RtfListTable
101:             * @throws IOException for I/O problems
102:             */
103:            public RtfListTable(RtfContainer parent, Writer w, Integer num,
104:                    RtfAttributes attrs) throws IOException {
105:                super (parent, w, attrs);
106:
107:                styles = new LinkedList();
108:            }
109:
110:            /**
111:             * Add List
112:             * @param list RtfList to add
113:             * @return number of lists in the table after adding
114:             */
115:            public int addList(RtfList list) {
116:                if (lists == null) {
117:                    lists = new LinkedList();
118:                }
119:
120:                lists.add(list);
121:
122:                return lists.size();
123:            }
124:
125:            /**
126:             * Write the content
127:             * @throws IOException for I/O problems
128:             */
129:            public void writeRtfContent() throws IOException {
130:                newLine();
131:                if (lists != null) {
132:                    //write '\listtable'
133:                    writeGroupMark(true);
134:                    writeStarControlWordNS(LIST_TABLE);
135:                    newLine();
136:                    for (Iterator it = lists.iterator(); it.hasNext();) {
137:                        final RtfList list = (RtfList) it.next();
138:                        writeListTableEntry(list);
139:                        newLine();
140:                    }
141:                    writeGroupMark(false);
142:
143:                    newLine();
144:                    //write '\listoveridetable'
145:                    writeGroupMark(true);
146:                    writeStarControlWordNS(LIST_OVR_TABLE);
147:                    int z = 1;
148:                    newLine();
149:                    for (Iterator it = styles.iterator(); it.hasNext();) {
150:                        final RtfListStyle style = (RtfListStyle) it.next();
151:
152:                        writeGroupMark(true);
153:                        writeStarControlWordNS(LIST_OVR);
154:                        writeGroupMark(true);
155:
156:                        writeOneAttributeNS(LIST_ID, style.getRtfList()
157:                                .getListId().toString());
158:                        writeOneAttributeNS(LIST_OVR_COUNT, new Integer(0));
159:                        writeOneAttributeNS(LIST_NUMBER, new Integer(z++));
160:
161:                        writeGroupMark(false);
162:                        writeGroupMark(false);
163:                        newLine();
164:                    }
165:
166:                    writeGroupMark(false);
167:                    newLine();
168:                }
169:            }
170:
171:            /**
172:             * Since this has no text content we have to overwrite isEmpty to print
173:             * the table
174:             * @return false (always)
175:             */
176:            public boolean isEmpty() {
177:                return false;
178:            }
179:
180:            private void writeListTableEntry(RtfList list) throws IOException {
181:                //write list-specific attributes
182:                writeGroupMark(true);
183:                writeControlWordNS(LIST);
184:                writeOneAttributeNS(LIST_TEMPLATE_ID, list.getListTemplateId()
185:                        .toString());
186:                writeOneAttributeNS(LIST, attrib.getValue(LIST));
187:
188:                // write level-specific attributes
189:                writeGroupMark(true);
190:                writeControlWordNS(LIST_LEVEL);
191:
192:                writeOneAttributeNS(LIST_JUSTIFICATION, attrib
193:                        .getValue(LIST_JUSTIFICATION));
194:                writeOneAttributeNS(LIST_FOLLOWING_CHAR, attrib
195:                        .getValue(LIST_FOLLOWING_CHAR));
196:                writeOneAttributeNS(LIST_SPACE, new Integer(0));
197:                writeOneAttributeNS(LIST_INDENT, attrib.getValue(LIST_INDENT));
198:
199:                RtfListItem item = (RtfListItem) list.getChildren().get(0);
200:                if (item != null) {
201:                    item.getRtfListStyle().writeLevelGroup(this );
202:                }
203:
204:                writeGroupMark(false);
205:
206:                writeGroupMark(true);
207:                writeControlWordNS(LIST_NAME);
208:                writeGroupMark(false);
209:
210:                writeOneAttributeNS(LIST_ID, list.getListId().toString());
211:
212:                writeGroupMark(false);
213:            }
214:
215:            /**
216:             * Add list style
217:             * @param ls ListStyle to set
218:             * @return number of styles after adding
219:             */
220:            public int addRtfListStyle(RtfListStyle ls) {
221:                styles.add(ls);
222:                return styles.size();
223:            }
224:        }
w_w__w_.j__a__v___a___2___s._c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.