Source Code Cross Referenced for UpdatesFirstEventDispatcher.java in  » Web-Framework » webonswing » net » ar » webonswing » remote » 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 » webonswing » net.ar.webonswing.remote 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        // WebOnSwing - Web Application Framework
002:        //Copyright (C) 2003 Fernando Damian Petrola
003:        //	
004:        //This library is free software; you can redistribute it and/or
005:        //modify it under the terms of the GNU Lesser General Public
006:        //License as published by the Free Software Foundation; either
007:        //version 2.1 of the License, or (at your option) any later version.
008:        //	
009:        //This library is distributed in the hope that it will be useful,
010:        //but WITHOUT ANY WARRANTY; without even the implied warranty of
011:        //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012:        //Lesser General Public License for more details.
013:        //	
014:        //You should have received a copy of the GNU Lesser General Public
015:        //License along with this library; if not, write to the Free Software
016:        //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
017:
018:        package net.ar.webonswing.remote;
019:
020:        import java.util.*;
021:
022:        import net.ar.webonswing.wrapping.*;
023:
024:        /**
025:         * Genera RemoteEvents a partir de una url y de un mapa de parametros. Estos
026:         * eventos no tienen un orden deterministico solo se asegura que todos los de
027:         * tipo "update" queden primeros y el evento principal (el que genero el
028:         * "request") quede ultimo. A futuro: guardar el orden de los eventos generados
029:         * del lado del cliente y procesarlos en el orden exacto que sucedieron.
030:         * 
031:         * @author Fernando Damian Petrola
032:         */
033:        public class UpdatesFirstEventDispatcher extends RemoteEventDispatcher {
034:            protected VisualComponent theRootComponent;
035:
036:            public UpdatesFirstEventDispatcher(VisualComponent aRootComponent) {
037:                theRootComponent = aRootComponent;
038:            }
039:
040:            public void generateAndDispatchEvents(String anUrl, Map aParameters) {
041:                Map theResult = new HashMap();
042:                List theListResult = new Vector();
043:
044:                if (anUrl.endsWith(".event")) {
045:                    int theTypePos = anUrl.substring(0, anUrl.length() - 6)
046:                            .lastIndexOf('.');
047:                    String theMainEventType = anUrl.substring(theTypePos + 1,
048:                            anUrl.length() - 6);
049:                    String theMainEventSource = anUrl.substring(anUrl
050:                            .indexOf('.') + 1, theTypePos);
051:                    List theMainComponentEvents = new Vector();
052:                    VisualComponent theMainEventComponent = theRootComponent
053:                            .findComponent(theMainEventSource);
054:
055:                    for (Iterator i = aParameters.entrySet().iterator(); i
056:                            .hasNext();) {
057:                        Map.Entry theEntry = (Map.Entry) i.next();
058:
059:                        VisualComponent theComponent = theRootComponent
060:                                .findComponent(theEntry.getKey().toString());
061:
062:                        if (theComponent != null) {
063:                            RemoteEvent theComponentEvent = new RemoteEvent(
064:                                    theComponent, "update", theEntry.getKey()
065:                                            .toString(), (String[]) theEntry
066:                                            .getValue());
067:
068:                            if (theEntry.getKey().toString().startsWith(
069:                                    theMainEventSource))
070:                                theMainComponentEvents.add(theComponentEvent);
071:                            else {
072:                                Vector theComponentEvents = (Vector) theResult
073:                                        .get(theComponent);
074:
075:                                if (theComponentEvents == null)
076:                                    theResult.put(theComponent,
077:                                            theComponentEvents = new Vector());
078:
079:                                theComponentEvents.add(theComponentEvent);
080:                            }
081:                        }
082:
083:                    }
084:
085:                    if (theMainEventComponent != null)
086:                        theMainComponentEvents.add(new RemoteEvent(
087:                                theMainEventComponent, theMainEventType,
088:                                theMainEventType, new Object[0]));
089:
090:                    for (Iterator i = theResult.entrySet().iterator(); i
091:                            .hasNext();) {
092:                        Map.Entry theEntry = (Map.Entry) i.next();
093:                        theListResult.add(new Object[] { theEntry.getKey(),
094:                                theEntry.getValue() });
095:                    }
096:                    if (theMainEventComponent != null)
097:                        theListResult.add(new Object[] { theMainEventComponent,
098:                                theMainComponentEvents });
099:                }
100:
101:                dispatchEvents(theListResult);
102:            }
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.