Source Code Cross Referenced for StandardOverlayContainerWidget.java in  » Web-Framework » aranea-mvc-1.1.1 » org » araneaframework » framework » container » 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 » Web Framework » aranea mvc 1.1.1 » org.araneaframework.framework.container 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /**
002:         * Copyright 2006 Webmedia Group Ltd.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *  http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         **/package org.araneaframework.framework.container;
016:
017:        import java.util.Map;
018:        import org.apache.commons.collections.map.LinkedMap;
019:        import org.araneaframework.Environment;
020:        import org.araneaframework.EnvironmentAwareCallback;
021:        import org.araneaframework.InputData;
022:        import org.araneaframework.OutputData;
023:        import org.araneaframework.Path;
024:        import org.araneaframework.Widget;
025:        import org.araneaframework.core.Assert;
026:        import org.araneaframework.core.BaseApplicationWidget;
027:        import org.araneaframework.core.StandardEnvironment;
028:        import org.araneaframework.framework.FlowContextWidget;
029:        import org.araneaframework.framework.OverlayContext;
030:        import org.araneaframework.framework.FlowContext.Configurator;
031:        import org.araneaframework.framework.FlowContext.Handler;
032:        import org.araneaframework.http.UpdateRegionContext;
033:        import org.araneaframework.http.util.EnvironmentUtil;
034:
035:        /**
036:         * @author Alar Kvell (alar@araneaframework.org)
037:         * @author Taimo Peelo (taimo@araneaframework.org)
038:         * @since 1.1
039:         */
040:        public class StandardOverlayContainerWidget extends
041:                BaseApplicationWidget implements  OverlayContext {
042:            /**
043:             * <p> 
044:             * Map containing the default overlay presentation options. 
045:             * Default values are as follows:</p>
046:             * <ul>
047:             *   <li>method: post</li>
048:             *   <li>overlayClose: false</li>
049:             *   <li>width: 800</li>
050:             *   <li>slideDownDuration: 0.0</li>
051:             *   <li>slideUpDuration: 0.0</li>
052:             *   <li>overlayDuration: 0.0</li>
053:             *   <li>resizeDuration: 0.0</li>
054:             * </ul>
055:             */
056:            public static final Map DEFAULT_PRESENTATION_OPTIONS = new LinkedMap();
057:            private static final String MAIN_CHILD_KEY = "m";
058:            private static final String OVERLAY_CHILD_KEY = "o";
059:
060:            protected Map presentationOptions = new LinkedMap();
061:
062:            private Widget main;
063:            private FlowContextWidget overlay;
064:
065:            static {
066:                DEFAULT_PRESENTATION_OPTIONS.put("method", "post");
067:                DEFAULT_PRESENTATION_OPTIONS.put("overlayClose", Boolean.FALSE);
068:                DEFAULT_PRESENTATION_OPTIONS.put("width", new Integer(800));
069:                DEFAULT_PRESENTATION_OPTIONS.put("slideDownDuration", String
070:                        .valueOf(0.0));
071:                DEFAULT_PRESENTATION_OPTIONS.put("slideUpDuration", String
072:                        .valueOf(0.0));
073:                DEFAULT_PRESENTATION_OPTIONS.put("overlayDuration", String
074:                        .valueOf(0.0));
075:                DEFAULT_PRESENTATION_OPTIONS.put("resizeDuration", String
076:                        .valueOf(0.0));
077:            }
078:
079:            {
080:                presentationOptions.putAll(DEFAULT_PRESENTATION_OPTIONS);
081:            }
082:
083:            public void setMain(Widget main) {
084:                this .main = main;
085:            }
086:
087:            public void setOverlay(FlowContextWidget overlay) {
088:                this .overlay = overlay;
089:            }
090:
091:            public boolean isOverlayActive() {
092:                return overlay.isNested();
093:            }
094:
095:            protected Environment getChildWidgetEnvironment() throws Exception {
096:                return new StandardEnvironment(super 
097:                        .getChildWidgetEnvironment(), OverlayContext.class,
098:                        this );
099:            }
100:
101:            protected void init() throws Exception {
102:                super .init();
103:                Assert.notNull(main);
104:                Assert.notNull(overlay);
105:                addWidget(MAIN_CHILD_KEY, main);
106:                addWidget(OVERLAY_CHILD_KEY, overlay);
107:                overlay.addNestedEnvironmentEntry(this ,
108:                        OverlayActivityMarkerContext.class,
109:                        new OverlayActivityMarkerContext() {
110:                        });
111:            }
112:
113:            protected void update(InputData input) throws Exception {
114:                if (isOverlayActive())
115:                    overlay._getWidget().update(input);
116:                else
117:                    main._getWidget().update(input);
118:            }
119:
120:            protected void event(Path path, InputData input) throws Exception {
121:                if (path != null && path.hasNext()) {
122:                    Object next = path.getNext();
123:                    Assert.isTrue(!(isOverlayActive() ? MAIN_CHILD_KEY
124:                            : OVERLAY_CHILD_KEY).equals(next),
125:                            "Cannot deliver event to wrong hierarchy!");
126:                }
127:                super .event(path, input);
128:            }
129:
130:            protected void action(Path path, InputData input, OutputData output)
131:                    throws Exception {
132:                if (path != null && path.hasNext()) {
133:                    Object next = path.getNext();
134:                    Assert.isTrue(!(isOverlayActive() ? MAIN_CHILD_KEY
135:                            : OVERLAY_CHILD_KEY).equals(next),
136:                            "Cannot deliver action to wrong hierarchy!");
137:                }
138:                super .action(path, input, output);
139:            }
140:
141:            protected void render(OutputData output) throws Exception {
142:                if (output.getInputData().getGlobalData().containsKey(
143:                        OverlayContext.OVERLAY_REQUEST_KEY)) {
144:                    overlay._getWidget().render(output);
145:                    if (!isOverlayActive()) { // overlay has become inactive for some reason
146:                        UpdateRegionContext urCtx = EnvironmentUtil
147:                                .getUpdateRegionContext(getEnvironment());
148:                        urCtx.disableOnce();
149:                    }
150:                } else
151:                    main._getWidget().render(output);
152:            }
153:
154:            // FlowContext methods
155:            public void replace(Widget flow) {
156:                overlay.replace(flow);
157:            }
158:
159:            public void replace(Widget flow, Configurator configurator) {
160:                overlay.replace(flow, configurator);
161:            }
162:
163:            public void reset(EnvironmentAwareCallback callback) {
164:                overlay.reset(callback);
165:            }
166:
167:            public void start(Widget flow, Configurator configurator,
168:                    Handler handler) {
169:                overlay.start(flow, configurator, handler);
170:            }
171:
172:            public void start(Widget flow, Handler handler) {
173:                overlay.start(flow, handler);
174:            }
175:
176:            public void start(Widget flow) {
177:                overlay.start(flow);
178:            }
179:
180:            /* The presentation options of this overlay. */
181:            public Map getOverlayOptions() {
182:                return presentationOptions;
183:            }
184:
185:            public void setOverlayOptions(Map presentationOptions) {
186:                this.presentationOptions = presentationOptions;
187:            }
188:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.