Source Code Cross Referenced for BaseMacroParameter.java in  » ERP-CRM-Financial » sakai » org » radeox » macro » parameter » 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 » ERP CRM Financial » sakai » org.radeox.macro.parameter 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * This file is part of "SnipSnap Radeox Rendering Engine".
003:         *
004:         * Copyright (c) 2002 Stephan J. Schmidt, Matthias L. Jugel
005:         * All Rights Reserved.
006:         *
007:         * Please visit http://radeox.org/ for updates and contact.
008:         *
009:         * --LICENSE NOTICE--
010:         * Licensed under the Apache License, Version 2.0 (the "License");
011:         * you may not use this file except in compliance with the License.
012:         * You may obtain a copy of the License at
013:         *
014:         *      http://www.apache.org/licenses/LICENSE-2.0
015:         *
016:         * Unless required by applicable law or agreed to in writing, software
017:         * distributed under the License is distributed on an "AS IS" BASIS,
018:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
019:         * See the License for the specific language governing permissions and
020:         * limitations under the License.
021:         * --LICENSE NOTICE--
022:         */
023:
024:        package org.radeox.macro.parameter;
025:
026:        import java.util.HashMap;
027:        import java.util.Map;
028:        import java.util.StringTokenizer;
029:
030:        import org.radeox.api.engine.context.RenderContext;
031:        import org.radeox.api.macro.MacroParameter;
032:
033:        /**
034:         * @author
035:         * @version $Id: BaseMacroParameter.java 7707 2006-04-12 17:30:19Z
036:         *          ian@caret.cam.ac.uk $
037:         */
038:
039:        public class BaseMacroParameter implements  MacroParameter {
040:            private String content;
041:
042:            protected Map params;
043:
044:            private int size;
045:
046:            protected RenderContext context;
047:
048:            private int start;
049:
050:            private int end;
051:
052:            private int contentStart;
053:
054:            private int contentEnd;
055:
056:            public BaseMacroParameter() {
057:            }
058:
059:            public BaseMacroParameter(RenderContext context) {
060:                this .context = context;
061:            }
062:
063:            public void setParams(String stringParams) {
064:                params = split(stringParams, "|");
065:                size = params.size();
066:            }
067:
068:            public RenderContext getContext() {
069:                return context;
070:            }
071:
072:            public Map getParams() {
073:                return params;
074:            }
075:
076:            public String getContent() {
077:                return content;
078:            }
079:
080:            public void setContent(String content) {
081:                this .content = content;
082:            }
083:
084:            public int getLength() {
085:                return size;
086:            }
087:
088:            public String get(String index, int idx) {
089:                String result = get(index);
090:                if (result == null) {
091:                    result = get(idx);
092:                }
093:                return result;
094:            }
095:
096:            public String get(String index) {
097:                return (String) params.get(index);
098:            }
099:
100:            public String get(int index) {
101:                return get("" + index);
102:            }
103:
104:            /**
105:             * Splits a String on a delimiter to a List. The function works like the
106:             * perl-function split.
107:             * 
108:             * @param aString
109:             *        a String to split
110:             * @param delimiter
111:             *        a delimiter dividing the entries
112:             * @return a Array of splittet Strings
113:             */
114:
115:            private Map split(String aString, String delimiter) {
116:                Map result = new HashMap();
117:
118:                if (null != aString) {
119:                    StringTokenizer st = new StringTokenizer(aString, delimiter);
120:                    int i = 0;
121:
122:                    while (st.hasMoreTokens()) {
123:                        String value = st.nextToken();
124:                        String key = "" + i;
125:                        if (value.indexOf("=") != -1) {
126:                            // Store this for
127:                            result.put(key, insertValue(value));
128:                            int index = value.indexOf("=");
129:                            key = value.substring(0, index);
130:                            value = value.substring(index + 1);
131:
132:                            result.put(key, insertValue(value));
133:                        } else {
134:                            result.put(key, insertValue(value));
135:                        }
136:                        i++;
137:                    }
138:                }
139:                return result;
140:            }
141:
142:            private String insertValue(String s) {
143:                int idx = s.indexOf('$');
144:                if (idx != -1) {
145:                    StringBuffer tmp = new StringBuffer();
146:                    Map globals = context.getParameters();
147:                    String var = s.substring(idx + 1);
148:                    if (idx > 0)
149:                        tmp.append(s.substring(0, idx));
150:                    if (globals.containsKey(var)) {
151:                        tmp.append(globals.get(var));
152:                    }
153:                    return tmp.toString();
154:                }
155:                return s;
156:            }
157:
158:            public void setStart(int start) {
159:                this .start = start;
160:            }
161:
162:            public void setEnd(int end) {
163:                this .end = end;
164:            }
165:
166:            public int getStart() {
167:                return this .start;
168:            }
169:
170:            public int getEnd() {
171:                return this .end;
172:            }
173:
174:            public int getContentStart() {
175:                return contentStart;
176:            }
177:
178:            public void setContentStart(int contentStart) {
179:                this .contentStart = contentStart;
180:            }
181:
182:            public int getContentEnd() {
183:                return contentEnd;
184:            }
185:
186:            public void setContentEnd(int contentEnd) {
187:                this.contentEnd = contentEnd;
188:            }
189:
190:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.