Source Code Cross Referenced for AppendIterator.java in  » J2EE » webwork-2.2.6 » com » opensymphony » webwork » components » 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 » J2EE » webwork 2.2.6 » com.opensymphony.webwork.components 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright (c) 2002-2003 by OpenSymphony
003:         * All rights reserved.
004:         */
005:        package com.opensymphony.webwork.components;
006:
007:        import java.io.Writer;
008:        import java.util.ArrayList;
009:        import java.util.Iterator;
010:        import java.util.List;
011:
012:        import org.apache.commons.logging.Log;
013:        import org.apache.commons.logging.LogFactory;
014:
015:        import com.opensymphony.webwork.components.Param.UnnamedParametric;
016:        import com.opensymphony.webwork.util.AppendIteratorFilter;
017:        import com.opensymphony.webwork.util.MakeIterator;
018:        import com.opensymphony.xwork.util.OgnlValueStack;
019:
020:        /**
021:         * <!-- START SNIPPET: javadoc -->
022:         * <p>Component for AppendIteratorTag, which jobs is to append iterators to form an
023:         * appended iterator whereby entries goes from one iterator to another after each
024:         * respective iterator is exhausted of entries.</p>
025:         *
026:         * <p>For example, if there are 3 iterator appended (each iterator has 3 entries),
027:         * the following will be how the appended iterator entries will be arranged:</p>
028:         *
029:         * <ol>
030:         * 		<li>First Entry of the First Iterator</li>
031:         * 		<li>Second Entry of the First Iterator</li>
032:         * 		<li>Third Entry of the First Iterator</li>
033:         *      <li>First Entry of the Second Iterator</li>
034:         *      <li>Second Entry of the Second Iterator</li>
035:         *      <li>Third Entry of the Second Iterator</li>
036:         *      <li>First Entry of the Third Iterator</li>
037:         *      <li>Second Entry of the Third Iterator</li>
038:         *      <li>Third Entry of the Third ITerator</li>
039:         * </ol>
040:         * <!-- END SNIPPET: javadoc -->
041:         *
042:         * <!-- START SNIPPET: params -->
043:         * <ul>
044:         * 		<li>id (String) - the id of which if supplied will have the resultant
045:         *                        appended iterator stored under in the stack's context</li>
046:         * </ul>
047:         * <!-- END SNIPPET: params -->
048:         *
049:         *
050:         * <!-- START SNIPPET: code -->
051:         * public class AppendIteratorTagAction extends ActionSupport {
052:         *
053:         *	private List myList1;
054:         *	private List myList2;
055:         *	private List myList3;
056:         *
057:         *
058:         *	public String execute() throws Exception {
059:         *
060:         *		myList1 = new ArrayList();
061:         *		myList1.add("1");
062:         *		myList1.add("2");
063:         *		myList1.add("3");
064:         *
065:         *		myList2 = new ArrayList();
066:         *		myList2.add("a");
067:         *		myList2.add("b");
068:         *		myList2.add("c");
069:         *
070:         *		myList3 = new ArrayList();
071:         *		myList3.add("A");
072:         *		myList3.add("B");
073:         *		myList3.add("C");
074:         *
075:         *		return "done";
076:         *	}
077:         *
078:         *	public List getMyList1() { return myList1; }
079:         *	public List getMyList2() { return myList2; }
080:         *	public List getMyList3() { return myList3; }
081:         *}
082:         * <!-- END SNIPPET: code -->
083:         *
084:         * <!-- START SNIPPET: example -->
085:         * &lt;ww:append id="myAppendIterator"&gt;
086:         *		&lt;ww:param value="%{myList1}" /&gt;
087:         *		&lt;ww:param value="%{myList2}" /&gt;
088:         *		&lt;ww:param value="%{myList3}" /&gt;
089:         * &lt;/ww:append&gt;
090:         * &lt;ww:iterator value="%{#myAppendIterator}"&gt;
091:         *		&lt;ww:property /&gt;
092:         * &lt;/ww:iterator&gt;
093:         * <!-- END SNIPPET: example -->
094:         *
095:         *
096:         * @author tm_jee ( tm_jee (at) yahoo.co.uk )
097:         * @version $Date: 2006-03-18 17:28:55 +0100 (Sat, 18 Mar 2006) $ $Id: AppendIterator.java 2468 2006-03-18 16:28:55Z rgielen $
098:         * @see com.opensymphony.webwork.util.AppendIteratorFilter
099:         * @see com.opensymphony.webwork.views.jsp.iterator.AppendIteratorTag
100:         *
101:         * @ww.tag name="append" tld-body-content="JSP" tld-tag-class="com.opensymphony.webwork.views.jsp.iterator.AppendIteratorTag"
102:         * description="Append the values of a list of iterators to one iterator"
103:         */
104:        public class AppendIterator extends Component implements 
105:                UnnamedParametric {
106:
107:            private static final Log _log = LogFactory
108:                    .getLog(AppendIterator.class);
109:
110:            private AppendIteratorFilter appendIteratorFilter = null;
111:            private List _parameters;
112:
113:            public AppendIterator(OgnlValueStack stack) {
114:                super (stack);
115:            }
116:
117:            public boolean start(Writer writer) {
118:                _parameters = new ArrayList();
119:                appendIteratorFilter = new AppendIteratorFilter();
120:
121:                return super .start(writer);
122:            }
123:
124:            public boolean end(Writer writer, String body) {
125:
126:                for (Iterator paramEntries = _parameters.iterator(); paramEntries
127:                        .hasNext();) {
128:
129:                    Object iteratorEntryObj = paramEntries.next();
130:                    if (!MakeIterator.isIterable(iteratorEntryObj)) {
131:                        _log
132:                                .warn("param with value resolved as "
133:                                        + iteratorEntryObj
134:                                        + " cannot be make as iterator, it will be ignored and hence will not appear in the merged iterator");
135:                        continue;
136:                    }
137:                    appendIteratorFilter.setSource(MakeIterator
138:                            .convert(iteratorEntryObj));
139:                }
140:
141:                appendIteratorFilter.execute();
142:
143:                if (getId() != null && getId().length() > 0) {
144:                    getStack().getContext().put(getId(), appendIteratorFilter);
145:                }
146:
147:                appendIteratorFilter = null;
148:
149:                return super .end(writer, body);
150:            }
151:
152:            // UnnamedParametric implementation --------------------------------------
153:            public void addParameter(Object value) {
154:                _parameters.add(value);
155:            }
156:
157:            /**
158:             * the id of which if supplied will have the resultant appended iterator stored under in the stack's context
159:             * @ww.tagattribute required="false"
160:             */
161:            public void setId(String id) {
162:                super.setId(id);
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.