Source Code Cross Referenced for RecursivePanel.java in  » J2EE » wicket » wicket » examples » nested » 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 » wicket » wicket.examples.nested 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: RecursivePanel.java 461614 2006-07-27 09:32:41Z knopp $ $Revision: 461614 $
003:         * $Date: 2006-07-27 11:32:41 +0200 (Thu, 27 Jul 2006) $
004:         * 
005:         * ==================================================================== Licensed
006:         * under the Apache License, Version 2.0 (the "License"); you may not use this
007:         * file except in compliance with the License. You may obtain a copy of the
008:         * License at
009:         * 
010:         * http://www.apache.org/licenses/LICENSE-2.0
011:         * 
012:         * Unless required by applicable law or agreed to in writing, software
013:         * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
014:         * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
015:         * License for the specific language governing permissions and limitations under
016:         * the License.
017:         */
018:        package wicket.examples.nested;
019:
020:        import java.util.List;
021:
022:        import wicket.markup.html.WebMarkupContainer;
023:        import wicket.markup.html.basic.Label;
024:        import wicket.markup.html.list.ListItem;
025:        import wicket.markup.html.list.ListView;
026:        import wicket.markup.html.panel.Panel;
027:
028:        /**
029:         * This example list knows how to display sublists. It expects a list where each
030:         * element is either a string or another list.
031:         * 
032:         * @author Eelco Hillenius
033:         */
034:        public final class RecursivePanel extends Panel {
035:            /**
036:             * Constructor.
037:             * 
038:             * @param id
039:             *            The id of this component
040:             * @param list
041:             *            a list where each element is either a string or another list
042:             */
043:            public RecursivePanel(final String id, List list) {
044:                super (id);
045:                add(new Rows("rows", list));
046:                setVersioned(false);
047:            }
048:
049:            /**
050:             * The list class.
051:             */
052:            private static class Rows extends ListView {
053:                /**
054:                 * Construct.
055:                 * 
056:                 * @param name
057:                 *            name of the component
058:                 * @param list
059:                 *            a list where each element is either a string or another
060:                 *            list
061:                 */
062:                public Rows(String name, List list) {
063:                    super (name, list);
064:                }
065:
066:                /**
067:                 * @see wicket.markup.html.list.ListView#populateItem(wicket.markup.html.list.ListItem)
068:                 */
069:                protected void populateItem(ListItem listItem) {
070:                    Object modelObject = listItem.getModelObject();
071:
072:                    if (modelObject instanceof  List) {
073:                        // create a panel that renders the sub lis
074:                        RecursivePanel nested = new RecursivePanel("nested",
075:                                (List) modelObject);
076:                        listItem.add(nested);
077:                        // if the current element is a list, we create a dummy row/
078:                        // label element
079:                        // as we have to confirm to our HTML definition, and set it's
080:                        // visibility
081:                        // property to false as we do not want LI tags to be rendered.
082:                        WebMarkupContainer row = new WebMarkupContainer("row");
083:                        row.setVisible(false);
084:                        row.add(new WebMarkupContainer("label"));
085:                        listItem.add(row);
086:                    } else {
087:                        // if the current element is not a list, we create a dummy panel
088:                        // element
089:                        // to confirm to our HTML definition, and set this panel's
090:                        // visibility
091:                        // property to false to avoid having the UL tag rendered
092:                        RecursivePanel nested = new RecursivePanel("nested",
093:                                null);
094:                        nested.setVisible(false);
095:                        listItem.add(nested);
096:                        // add the row (with the LI element attached, and the label with
097:                        // the
098:                        // row's actual value to display
099:                        WebMarkupContainer row = new WebMarkupContainer("row");
100:                        row.add(new Label("label", modelObject.toString()));
101:                        listItem.add(row);
102:                    }
103:                }
104:            }
105:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.