Source Code Cross Referenced for InternalFrame.java in  » J2EE » wicket » org » apache » wicket » markup » html » link » 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 » org.apache.wicket.markup.html.link 
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:        package org.apache.wicket.markup.html.link;
018:
019:        import org.apache.wicket.IPageMap;
020:        import org.apache.wicket.Page;
021:        import org.apache.wicket.PageMap;
022:        import org.apache.wicket.RequestCycle;
023:        import org.apache.wicket.Session;
024:        import org.apache.wicket.markup.ComponentTag;
025:        import org.apache.wicket.markup.html.WebMarkupContainer;
026:        import org.apache.wicket.util.string.Strings;
027:
028:        /**
029:         * Implementation of an <a
030:         * href="http://www.w3.org/TR/REC-html40/present/frames.html#h-16.5">inline
031:         * frame</a> component. Must be used with an iframe (&lt;iframe src...)
032:         * element. The src attribute will be generated.
033:         * 
034:         * @author Sven Meier
035:         * @author Ralf Ebert
036:         * 
037:         * @deprecated will be replaced by {@link InlineFrame} in Wicket 2.0 as that's a
038:         *             better name for it.
039:         */
040:        public class InternalFrame extends WebMarkupContainer implements 
041:                ILinkListener {
042:            private static final long serialVersionUID = 1L;
043:
044:            /** The link. */
045:            private final IPageLink pageLink;
046:
047:            /**
048:             * The pagemap name where the page that will be created by this inline frame
049:             * will be created in.
050:             */
051:            private final String pageMapName;
052:
053:            /**
054:             * Constructs an inline frame that instantiates the given Page class when
055:             * the content of the inline frame is requested. The instantiated Page is
056:             * used to render a response to the user.
057:             * 
058:             * @param id
059:             *            See Component
060:             * @param pageMap
061:             *            the pagemap where the page of the inline frame must be in
062:             * @param c
063:             *            Page class
064:             */
065:            public InternalFrame(final String id, final IPageMap pageMap,
066:                    final Class c) {
067:                this (id, pageMap, new IPageLink() {
068:                    private static final long serialVersionUID = 1L;
069:
070:                    public Page getPage() {
071:                        // Create page using page factory
072:                        return Session.get().getPageFactory().newPage(c);
073:                    }
074:
075:                    public Class getPageIdentity() {
076:                        return c;
077:                    }
078:                });
079:
080:                // Ensure that c is a subclass of Page
081:                if (!Page.class.isAssignableFrom(c)) {
082:                    throw new IllegalArgumentException("Class " + c
083:                            + " is not a subclass of Page");
084:                }
085:            }
086:
087:            /**
088:             * This constructor is ideal if a Page object was passed in from a previous
089:             * Page. Construct an inline frame containing the given Page.
090:             * 
091:             * @param id
092:             *            See component
093:             * @param pageMap
094:             *            the pagemap where the page of the inline frame must be in
095:             * @param page
096:             *            The page
097:             */
098:            public InternalFrame(final String id, final IPageMap pageMap,
099:                    final Page page) {
100:                this (id, pageMap, new IPageLink() {
101:                    private static final long serialVersionUID = 1L;
102:
103:                    public Page getPage() {
104:                        // use given page
105:                        return page;
106:                    }
107:
108:                    public Class getPageIdentity() {
109:                        return page.getClass();
110:                    }
111:                });
112:            }
113:
114:            /**
115:             * This constructor is ideal for constructing pages lazily.
116:             * 
117:             * Constructs an inline frame which invokes the getPage() method of the
118:             * IPageLink interface when the content of the inline frame is requested.
119:             * Whatever Page objects is returned by this method will be rendered back to
120:             * the user.
121:             * 
122:             * @param id
123:             *            See Component
124:             * @param pageMap
125:             *            the pagemap where the page of the inline frame must be in
126:             * @param pageLink
127:             *            An implementation of IPageLink which will create the page to
128:             *            be contained in the inline frame if and when the content is
129:             *            requested
130:             */
131:            public InternalFrame(final String id, final IPageMap pageMap,
132:                    IPageLink pageLink) {
133:                super (id);
134:
135:                this .pageMapName = pageMap.getName();
136:
137:                this .pageLink = pageLink;
138:            }
139:
140:            /**
141:             * Gets the url to use for this link.
142:             * 
143:             * @return The URL that this link links to
144:             */
145:            protected CharSequence getURL() {
146:                return urlFor(ILinkListener.INTERFACE);
147:            }
148:
149:            /**
150:             * Handles this frame's tag.
151:             * 
152:             * @param tag
153:             *            the component tag
154:             * @see org.apache.wicket.Component#onComponentTag(ComponentTag)
155:             */
156:            protected final void onComponentTag(final ComponentTag tag) {
157:                checkComponentTag(tag, "iframe");
158:
159:                // Set href to link to this frame's frameRequested method
160:                CharSequence url = getURL();
161:
162:                // generate the src attribute
163:                tag.put("src", Strings.replaceAll(url, "&", "&amp;"));
164:
165:                super .onComponentTag(tag);
166:            }
167:
168:            /**
169:             * @see org.apache.wicket.markup.html.link.ILinkListener#onLinkClicked()
170:             */
171:            public final void onLinkClicked() {
172:                RequestCycle.get().getRequest().getRequestParameters()
173:                        .setPageMapName(pageMapName);
174:
175:                setResponsePage(pageLink.getPage());
176:            }
177:
178:            /**
179:             * Returns the pageMap.
180:             * 
181:             * @return pageMap
182:             */
183:            public final IPageMap getPageMap() {
184:                return PageMap.forName(this.pageMapName);
185:            }
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.