Source Code Cross Referenced for Echo2Screen.java in  » Web-Framework » roma-webwizard » org » romaframework » aspect » view » echo2 » screen » 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 » roma webwizard » org.romaframework.aspect.view.echo2.screen 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2006 Luca Garulli (luca.garulli@assetdata.it)
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:         */
016:
017:        package org.romaframework.aspect.view.echo2.screen;
018:
019:        import java.util.Iterator;
020:        import java.util.LinkedHashMap;
021:        import java.util.Map;
022:
023:        import nextapp.echo2.app.Component;
024:        import nextapp.echo2.app.WindowPane;
025:        import nextapp.echo2.app.event.WindowPaneEvent;
026:        import nextapp.echo2.app.event.WindowPaneListener;
027:
028:        import org.romaframework.aspect.view.echo2.component.PopupWindow;
029:        import org.romaframework.aspect.view.echo2.component.WindowFormContainer;
030:        import org.romaframework.aspect.view.echo2.form.EntityForm;
031:        import org.romaframework.aspect.view.echo2.look.LookAndFeelManager;
032:        import org.romaframework.aspect.view.screen.Screen;
033:        import org.romaframework.core.GlobalConstants;
034:        import org.romaframework.core.flow.ObjectContext;
035:
036:        import echopointng.ContentPaneEx;
037:
038:        public abstract class Echo2Screen extends ContentPaneEx implements 
039:                WindowPaneListener, Screen {
040:
041:            protected LinkedHashMap<String, WindowPane> popups;
042:            protected String lastArea = BODY;
043:
044:            public static final String BODY = "//body";
045:            public static final String POPUP = "popup";
046:            public static final String NULL = "null";
047:
048:            public Echo2Screen() {
049:                ObjectContext.getInstance().getComponent(
050:                        LookAndFeelManager.class).assignStyle(this );
051:            }
052:
053:            /**
054:             * Display a component in the specified area
055:             */
056:            public abstract String view(String iArea, Component iComponent);
057:
058:            /**
059:             * Display a component in the specified area
060:             */
061:            public final String view(String iArea, Object iComponent) {
062:                return view(iArea, (Component) iComponent);
063:            }
064:
065:            public void close(Object iWindow) {
066:            }
067:
068:            // @Override
069:            // public void dispose() {
070:            // if (popups != null)
071:            // popups.clear();
072:            // super.dispose();
073:            // }
074:
075:            public Object getComponentInArea(String iArea) {
076:                if (iArea.startsWith(POPUP) && popups != null)
077:                    return popups.get(iArea);
078:                return null;
079:            }
080:
081:            protected void displayPopUp(String iName, Component iComponent) {
082:                if (iName == null)
083:                    iName = GlobalConstants.ROOT_CLASS;
084:
085:                WindowPane window;
086:
087:                if (popups == null) {
088:                    // CREATE ONCE THE POPUPS MAP
089:                    popups = new LinkedHashMap<String, WindowPane>();
090:                    window = null;
091:                } else
092:                    // FIND THE POPUP IF ANY
093:                    window = popups.get(iName);
094:
095:                if (window == null) {
096:                    // POPUP NOT FOUND: CREATE A NEW ONE
097:                    if (iComponent instanceof  WindowPane) {
098:                        window = (WindowPane) iComponent;
099:                    } else {
100:                        // CREATE A WRAPPER WINDOW FOR OBJECT BEFORE TO DISPLAY
101:                        window = new PopupWindow((EntityForm) iComponent);
102:                    }
103:
104:                    window.addWindowPaneListener(this );
105:                    add(window);
106:                    popups.put(iName, window);
107:                } else {
108:                    // REPLACE THE FORM BEHIND THE WIND
109:                    if (iComponent instanceof  WindowFormContainer) {
110:                        WindowFormContainer windowFormContainer = (WindowFormContainer) iComponent;
111:                        ((WindowFormContainer) window).setForm(
112:                                windowFormContainer.getForm(),
113:                                windowFormContainer.getForm());
114:                    } else {
115:                        // window.removeAll();
116:                        // window.add(iComponent);
117:                        ((WindowFormContainer) window).setForm(
118:                                (EntityForm) iComponent,
119:                                (EntityForm) iComponent);
120:                    }
121:                }
122:            }
123:
124:            public void windowPaneClosing(WindowPaneEvent e) {
125:                // REMOVE THE WINDOW JUST CLOSED BY MAP
126:                Object winToClose = e.getSource();
127:
128:                // CHECK IF THE WINDOW TO REMOVE WAS ALSO THE LAST AREA. IF TRUE RESET LAST
129:                // AREA
130:                boolean reassignLastArea = false;
131:                for (Map.Entry<String, WindowPane> w : popups.entrySet()) {
132:                    if (w.getValue().equals(winToClose)) {
133:                        if (w.getKey().equals(lastArea)) {
134:                            reassignLastArea = true;
135:                            break;
136:                        }
137:                    }
138:                }
139:                popups.values().remove(winToClose);
140:
141:                if (reassignLastArea) {
142:                    String lastInMap = BODY;
143:                    Iterator<Map.Entry<String, WindowPane>> it = popups
144:                            .entrySet().iterator();
145:                    while (it.hasNext()) {
146:                        lastInMap = it.next().getKey();
147:                    }
148:                    lastArea = lastInMap;
149:                }
150:            }
151:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.