Source Code Cross Referenced for SwingMLEvent.java in  » XML-UI » SwingML » org » swingml » event » 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 » XML UI » SwingML » org.swingml.event 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.swingml.event;
002:
003:        import java.awt.*;
004:        import java.util.*;
005:
006:        import javax.swing.*;
007:
008:        import org.swingml.*;
009:        import org.swingml.model.*;
010:        import org.swingml.system.*;
011:
012:        public class SwingMLEvent implements  ISwingMLEvent {
013:
014:            private ListenerModel listener;
015:            private String name;
016:            private JComponent owner;
017:            private SwingMLModel ownerModel;
018:
019:            public SwingMLEvent(ListenerModel listener,
020:                    SwingMLModel eventOwnerModel, String eventName,
021:                    JComponent eventOwner) {
022:                setListener(listener);
023:                setOwnerModel(eventOwnerModel);
024:                setName(eventName);
025:                setOwner(eventOwner);
026:            }
027:
028:            /**
029:             * Notify the listener of the event that occurred, so it can handle it.
030:             */
031:            public Object execute(Object anObject) {
032:                if (anObject != null && anObject instanceof  ListenerModel) {
033:                    ListenerModel theEventListener = (ListenerModel) anObject;
034:
035:                    int theOption = JOptionPane.YES_OPTION;
036:                    if (theEventListener.hasConfirmationMessage()) {
037:                        JOptionPaneModel theOptionPane = theEventListener
038:                                .getConfirmationMessage();
039:                        Component theComponent = EventHandler.getInstance()
040:                                .findActionTarget(
041:                                        getOwner().getTopLevelAncestor(),
042:                                        theOptionPane.getComponent());
043:                        theOption = JOptionPane.showConfirmDialog(theComponent,
044:                                theOptionPane.getText(), "Select an Option",
045:                                JOptionPane.YES_NO_OPTION);
046:                    }
047:
048:                    if (theOption == JOptionPane.YES_OPTION) {
049:                        Iterator theActions = theEventListener.getActions()
050:                                .iterator();
051:                        Object theIteratorObject = null;
052:                        while (theActions.hasNext()) {
053:                            theIteratorObject = theActions.next();
054:                            if (theIteratorObject instanceof  ActionModel) {
055:                                ActionModel theAction = (ActionModel) theIteratorObject;
056:                                Component theActionTarget = EventHandler
057:                                        .getInstance().findActionTarget(
058:                                                getOwner()
059:                                                        .getTopLevelAncestor(),
060:                                                theAction.getComponent());
061:                                if (theActionTarget != null) {
062:                                    EventHandler.getInstance().processAction(
063:                                            theAction, theActionTarget,
064:                                            getOwnerModel().getName(),
065:                                            theEventListener);
066:                                } else {
067:                                    SwingMLLogger
068:                                            .getInstance()
069:                                            .log(
070:                                                    ILogCapable.WARN,
071:                                                    "Syntax error: The component "
072:                                                            + theAction
073:                                                                    .getComponent()
074:                                                            + " in the action for the listener "
075:                                                            + theEventListener
076:                                                                    .getEvent()
077:                                                            + " in the element "
078:                                                            + getOwnerModel()
079:                                                                    .getName()
080:                                                            + " wasn't found. Verify the value of COMPONENT.");
081:                                }
082:                            } else if (theIteratorObject instanceof  ExternalActionModel) {
083:
084:                                ExternalActionModel eam = (ExternalActionModel) theIteratorObject;
085:
086:                                EventHandler
087:                                        .getInstance()
088:                                        .handleExternalEvent(
089:                                                (ExternalActionModel) theIteratorObject,
090:                                                getOwner(), getOwnerModel(),
091:                                                theEventListener);
092:                            } else if (theIteratorObject instanceof  ControllerActionModel) {
093:
094:                                ControllerActionModel eam = (ControllerActionModel) theIteratorObject;
095:                                EventHandler.getInstance()
096:                                        .handleControllerActionEvent(eam,
097:                                                getOwner(), getOwnerModel(),
098:                                                theEventListener);
099:
100:                            }
101:                        }
102:                    }
103:                }
104:
105:                return null;
106:            }
107:
108:            public ListenerModel getListener() {
109:                return listener;
110:            }
111:
112:            public String getName() {
113:                return name;
114:            }
115:
116:            public JComponent getOwner() {
117:                return owner;
118:            }
119:
120:            public SwingMLModel getOwnerModel() {
121:                return ownerModel;
122:            }
123:
124:            public void postExecute(Object anObject) {
125:                // Do nothing
126:            }
127:
128:            /**
129:             * return a list of all ListenerModels that are listening on this event.
130:             */
131:            public Object preExecute() {
132:                return getListener();
133:            }
134:
135:            public void setListener(ListenerModel listener) {
136:                this .listener = listener;
137:            }
138:
139:            public void setName(String string) {
140:                name = string;
141:            }
142:
143:            public void setOwner(JComponent aComponent) {
144:                owner = aComponent;
145:            }
146:
147:            public void setOwnerModel(SwingMLModel model) {
148:                ownerModel = model;
149:            }
150:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.