Source Code Cross Referenced for AbstractListenerInterfaceRequestTarget.java in  » J2EE » wicket » wicket » request » target » component » listener » 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.request.target.component.listener 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * $Id: ListenerInterfaceRequestTarget.java,v 1.1 2005/11/27 23:22:45 eelco12
003:         * Exp $ $Revision: 459416 $ $Date: 2006-02-17 21:56:58 +0100 (Fri, 17 Feb 2006) $
004:         * 
005:         * ==============================================================================
006:         * Licensed under the Apache License, Version 2.0 (the "License"); you may not
007:         * use this file except in compliance with the License. You may obtain a copy of
008:         * the 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.request.target.component.listener;
019:
020:        import wicket.Application;
021:        import wicket.Component;
022:        import wicket.Page;
023:        import wicket.RequestCycle;
024:        import wicket.RequestListenerInterface;
025:        import wicket.request.RequestParameters;
026:        import wicket.request.target.IEventProcessor;
027:        import wicket.request.target.component.PageRequestTarget;
028:        import wicket.settings.IRequestCycleSettings;
029:
030:        /**
031:         * The abstract implementation of
032:         * {@link wicket.request.target.component.listener.IListenerInterfaceRequestTarget}. Target that denotes
033:         * a page instance and a call to a component on that page using an listener
034:         * interface method.
035:         * 
036:         * @author Eelco Hillenius
037:         * @author Johan Compagner
038:         */
039:        public abstract class AbstractListenerInterfaceRequestTarget extends
040:                PageRequestTarget implements  IListenerInterfaceRequestTarget,
041:                IEventProcessor {
042:            /** The request parameters. */
043:            private final RequestParameters requestParameters;
044:
045:            /** the target component. */
046:            private final Component component;
047:
048:            /** the listener method. */
049:            private final RequestListenerInterface listener;
050:
051:            /**
052:             * Construct.
053:             * 
054:             * @param page
055:             *            the page instance
056:             * @param component
057:             *            the target component
058:             * @param listener
059:             *            the listener interface
060:             */
061:            public AbstractListenerInterfaceRequestTarget(final Page page,
062:                    final Component component, RequestListenerInterface listener) {
063:                this (page, component, listener, null);
064:            }
065:
066:            /**
067:             * Construct.
068:             * 
069:             * @param page
070:             *            the page instance
071:             * @param component
072:             *            the target component
073:             * @param listener
074:             *            the listener method
075:             * @param requestParameters
076:             *            the request parameter
077:             */
078:            public AbstractListenerInterfaceRequestTarget(final Page page,
079:                    final Component component,
080:                    final RequestListenerInterface listener,
081:                    final RequestParameters requestParameters) {
082:                super (page);
083:
084:                if (component == null) {
085:                    throw new IllegalArgumentException(
086:                            "Argument component must be not null");
087:                }
088:
089:                this .component = component;
090:
091:                if (listener == null) {
092:                    throw new IllegalArgumentException(
093:                            "Argument listenerMethod must be not null");
094:                }
095:
096:                this .listener = listener;
097:                this .requestParameters = requestParameters;
098:            }
099:
100:            /**
101:             * Common functionality to be called by processEvents()
102:             * 
103:             * @param requestCycle
104:             *            The request cycle
105:             */
106:            protected void onProcessEvents(final RequestCycle requestCycle) {
107:                // Assume cluster needs to be updated now, unless listener
108:                // invocation changes this
109:                requestCycle.setUpdateSession(true);
110:
111:                // Clear all feedback messages if it isn't a redirect
112:                getPage().getFeedbackMessages().clear();
113:
114:                getPage().startComponentRender(getTarget());
115:
116:                final Application application = requestCycle.getApplication();
117:                // and see if we have to redirect the render part by default
118:                IRequestCycleSettings.RenderStrategy strategy = application
119:                        .getRequestCycleSettings().getRenderStrategy();
120:                boolean issueRedirect = (strategy == IRequestCycleSettings.REDIRECT_TO_RENDER || strategy == IRequestCycleSettings.REDIRECT_TO_BUFFER);
121:
122:                requestCycle.setRedirect(issueRedirect);
123:            }
124:
125:            /**
126:             * @see java.lang.Object#equals(java.lang.Object)
127:             */
128:            public boolean equals(Object obj) {
129:                boolean equal = false;
130:                if (obj != null && obj.getClass().equals(getClass())) {
131:                    AbstractListenerInterfaceRequestTarget that = (AbstractListenerInterfaceRequestTarget) obj;
132:                    if (component.equals(that.component)
133:                            && listener.equals(that.listener)) {
134:                        if (requestParameters != null) {
135:                            return requestParameters
136:                                    .equals(that.requestParameters);
137:                        } else {
138:                            return that.requestParameters == null;
139:                        }
140:                    }
141:                }
142:                return equal;
143:            }
144:
145:            /**
146:             * @see wicket.request.target.component.listener.IListenerInterfaceRequestTarget#getRequestParameters()
147:             */
148:            public final RequestParameters getRequestParameters() {
149:                return this .requestParameters;
150:            }
151:
152:            /**
153:             * @see wicket.request.target.component.listener.IListenerInterfaceRequestTarget#getRequestListenerInterface()
154:             */
155:            public final RequestListenerInterface getRequestListenerInterface() {
156:                return listener;
157:            }
158:
159:            /**
160:             * @see wicket.request.target.component.listener.IListenerInterfaceRequestTarget#getTarget()
161:             */
162:            public final Component getTarget() {
163:                return component;
164:            }
165:
166:            /**
167:             * @see java.lang.Object#hashCode()
168:             */
169:            public int hashCode() {
170:                int result = getClass().hashCode();
171:                result += component.hashCode();
172:                result += listener.hashCode();
173:                result += requestParameters != null ? requestParameters
174:                        .hashCode() : 0;
175:                return 17 * result;
176:            }
177:
178:            /**
179:             * @see java.lang.Object#toString()
180:             */
181:            public String toString() {
182:                StringBuffer buf = new StringBuffer(getClass().getName())
183:                        .append("@").append(hashCode()).append(
184:                                getPage().toString()).append("->").append(
185:                                getTarget().getId()).append("->").append(
186:                                getRequestListenerInterface().getMethod()
187:                                        .getDeclaringClass()).append(".")
188:                        .append(getRequestListenerInterface().getName());
189:
190:                if (requestParameters != null) {
191:                    buf.append(" (request paramaters: ").append(
192:                            requestParameters.toString()).append(")");
193:                }
194:                return buf.toString();
195:            }
196:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.