Source Code Cross Referenced for LayoutInputFileParser.java in  » RSS-RDF » Feedzeo » 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 » RSS RDF » Feedzeo » util 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**********************************************************************************
002:
003:            Feedzeo! 
004:            A free and open source RSS/Atom/RDF feed aggregator
005:
006:            Copyright (C) 2005-2006  Anand Rao (anandrao@users.sourceforge.net)
007:
008:            This library is free software; you can redistribute it and/or
009:            modify it under the terms of the GNU Lesser General Public
010:            License as published by the Free Software Foundation; either
011:            version 2.1 of the License, or (at your option) any later version.
012:
013:            This library is distributed in the hope that it will be useful,
014:            but WITHOUT ANY WARRANTY; without even the implied warranty of
015:            MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016:            Lesser General Public License for more details.
017:
018:            You should have received a copy of the GNU Lesser General Public
019:            License along with this library; if not, write to the Free Software
020:            Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
021:
022:         ************************************************************************************/package util;
023:
024:        import java.io.*;
025:
026:        /*
027:         * This class is used to parse layout objects like tables and pages;
028:         * It uses the basic config file parser for this;
029:         * Since both types of objects are present in the same file, the table 
030:         * and pages are differentiated using type property of the object
031:         * eg:  
032:         *  t1 
033:         *  {
034:         *     type=table;
035:         *     rows=10;
036:         *     cols=10;
037:         *     cell(0,0)=....
038:         *     cell(0,1)=....
039:         *  }
040:         * 
041:         *  p1
042:         *  {
043:         *     type=page;
044:         *     table=t1;
045:         *  }
046:         * 
047:         */
048:
049:        /**
050:         *
051:         * @author  Anand Rao
052:         */
053:        public class LayoutInputFileParser extends ConfigFileParser {
054:
055:            private final boolean DEBUG_CLASS = false;
056:
057:            private int NumTables = 0, NumPages = 0;
058:            private int TableStartIndex = -1, PageStartIndex = -1; /* 
059:             * Index from which Tables or page
060:             * starts; table and page objects 
061:             * cannot be mixed; 
062:             * TableStartIndex points to first 
063:             * Table object;
064:             * PageStartIndex points to first
065:             * page object;
066:             */
067:
068:            private boolean IsTable(String objname) {
069:                String line;
070:                initGroupCursor(objname);
071:                while ((line = getNextGroupItem(objname)) != null) {
072:                    NameValueListPair nvp = new NameValueListPair(line);
073:
074:                    if (DEBUG_CLASS)
075:                        System.out.println("line:" + line + "Name:"
076:                                + nvp.getName() + " Value:"
077:                                + nvp.getValueList());
078:
079:                    if (nvp.getName().equalsIgnoreCase("type")) {
080:                        // we have a type property
081:                        if (nvp.getValueList().equalsIgnoreCase("table"))
082:                            return true; // we found a table 
083:                        else if (nvp.getValueList().equalsIgnoreCase("page"))
084:                            return false;
085:                    }
086:                }
087:                ExceptionUtil.reportException(new Exception(
088:                        "Error parsing table/page element"));
089:                return false;
090:            }
091:
092:            /** Creates a new instance of LayoutInputFileParser */
093:            public LayoutInputFileParser(String Path)
094:                    throws FileNotFoundException {
095:                super (Path);
096:                for (int i = 0; i < getNumGroups(); i++) {
097:                    String Grpname = getGroup(i);
098:                    if (DEBUG_CLASS)
099:                        System.out.println("Layout Group:" + Grpname);
100:                    if (IsTable(Grpname)) {
101:                        // set the TableStartIndex if we have not set yet
102:                        if (TableStartIndex == -1)
103:                            TableStartIndex = i;
104:                        NumTables++;
105:                    } else { // must be a page
106:                        // set the PageStartIndex if we have not set yet
107:                        if (PageStartIndex == -1)
108:                            PageStartIndex = i;
109:                        NumPages++;
110:                    }
111:                }
112:            }
113:
114:            // TableLayout related APIS
115:            public void initTableCursor(String Tablename) {
116:                initGroupCursor(Tablename);
117:            }
118:
119:            public String getNextTableElement(String Tablename) {
120:                try {
121:                    String NextItem = getNextGroupItem(Tablename);
122:                    return NextItem;
123:                } catch (Exception e) {
124:                    ExceptionUtil.reportException(e);
125:                    return null;
126:                }
127:            }
128:
129:            public int getNumTables() {
130:                return NumTables;
131:            }
132:
133:            public String getTable(int index) {
134:                return getGroup(index + TableStartIndex);
135:            }
136:
137:            // PageLayout related APIS
138:            public void initPageCursor(String Pagename) {
139:                initGroupCursor(Pagename);
140:            }
141:
142:            public String getNextPageElement(String Pagename) {
143:                try {
144:                    String nextItem = getNextGroupItem(Pagename);
145:                    return nextItem;
146:                } catch (Exception e) {
147:                    ExceptionUtil.reportException(e);
148:                    return null;
149:                }
150:            }
151:
152:            public int getNumPages() {
153:                return NumPages;
154:            }
155:
156:            public String getPage(int index) {
157:                return getGroup(index + PageStartIndex);
158:            }
159:
160:            public void closeParser() {
161:                CloseFile();
162:            }
163:
164:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.