Source Code Cross Referenced for XPDLViewController.java in  » Workflow-Engines » JaWE » org » enhydra » jawe » components » xpdlview » 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 » Workflow Engines » JaWE » org.enhydra.jawe.components.xpdlview 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.enhydra.jawe.components.xpdlview;
002:
003:        import java.util.List;
004:        import java.util.Observable;
005:        import java.util.Observer;
006:
007:        import org.enhydra.jawe.JaWEComponent;
008:        import org.enhydra.jawe.JaWEComponentSettings;
009:        import org.enhydra.jawe.JaWEComponentView;
010:        import org.enhydra.jawe.JaWEManager;
011:        import org.enhydra.jawe.XPDLElementChangeInfo;
012:        import org.enhydra.shark.xpdl.XMLCollection;
013:        import org.enhydra.shark.xpdl.XMLElement;
014:        import org.enhydra.shark.xpdl.XMLElementChangeInfo;
015:        import org.enhydra.shark.xpdl.XMLUtil;
016:        import org.enhydra.shark.xpdl.elements.Package;
017:
018:        /**
019:         *  Used to handle process graphs.
020:         *
021:         *  @author Sasa Bojanic
022:         */
023:        public class XPDLViewController implements  Observer, JaWEComponent {
024:
025:            protected String type = JaWEComponent.MAIN_COMPONENT;
026:            protected boolean updateInProgress = false;
027:
028:            protected XPDLViewControllerPanel panel;
029:            protected XPDLViewSettings settings;
030:
031:            public XPDLViewController(JaWEComponentSettings settings)
032:                    throws Exception {
033:                this .settings = (XPDLViewSettings) settings;
034:                this .settings.init(this );
035:                init();
036:                JaWEManager.getInstance().getJaWEController().addObserver(this );
037:            }
038:
039:            // ********************** Observer   
040:            public void update(Observable o, Object arg) {
041:                if (!(arg instanceof  XPDLElementChangeInfo))
042:                    return;
043:                XPDLElementChangeInfo info = (XPDLElementChangeInfo) arg;
044:                int action = info.getAction();
045:                if (!(action == XMLElementChangeInfo.UPDATED
046:                        || action == XMLElementChangeInfo.INSERTED
047:                        || action == XMLElementChangeInfo.REMOVED
048:                        || action == XMLElementChangeInfo.REPOSITIONED
049:                        || action == XPDLElementChangeInfo.SELECTED
050:                        || action == XPDLElementChangeInfo.UNDOABLE_ACTION_ENDED
051:                        || action == XPDLElementChangeInfo.UNDO || action == XPDLElementChangeInfo.REDO))
052:                    return;
053:
054:                long start = System.currentTimeMillis();
055:                JaWEManager.getInstance().getLoggingManager().info(
056:                        "XPDLViewController -> update for event " + info
057:                                + " started ...");
058:                if (action == XPDLElementChangeInfo.UNDOABLE_ACTION_ENDED
059:                        || action == XPDLElementChangeInfo.UNDO
060:                        || action == XPDLElementChangeInfo.REDO) {
061:
062:                    panel.setSelectedElement(null);
063:                } else {
064:                    update(info);
065:                }
066:                JaWEManager.getInstance().getLoggingManager().info(
067:                        "XPDLViewController -> update ended");
068:                long end = System.currentTimeMillis();
069:                double diffs = (end - start) / 1000.0;
070:                JaWEManager.getInstance().getLoggingManager().debug(
071:                        "THE UPDATE OF XPDL COMPONENT LASTED FOR " + diffs
072:                                + " SECONDS!");
073:            }
074:
075:            // **********************      
076:
077:            // ********************** JaWEComponent   
078:            public JaWEComponentSettings getSettings() {
079:                return settings;
080:            }
081:
082:            public JaWEComponentView getView() {
083:                return panel;
084:            }
085:
086:            public String getName() {
087:                return "XPDLComponent";
088:            }
089:
090:            public String getType() {
091:                return type;
092:            }
093:
094:            public void setType(String type) {
095:                this .type = type;
096:            }
097:
098:            public boolean adjustXPDL(Package pkg) {
099:                return false;
100:            }
101:
102:            public List checkValidity(XMLElement el, boolean fullCheck) {
103:                return null;
104:            }
105:
106:            public boolean canCreateElement(XMLCollection col) {
107:                return true;
108:            }
109:
110:            public boolean canInsertElement(XMLCollection col, XMLElement el) {
111:                return true;
112:            }
113:
114:            public boolean canModifyElement(XMLElement el) {
115:                return true;
116:            }
117:
118:            public boolean canRemoveElement(XMLCollection col, XMLElement el) {
119:                return true;
120:            }
121:
122:            public boolean canDuplicateElement(XMLCollection col, XMLElement el) {
123:                return true;
124:            }
125:
126:            public boolean canRepositionElement(XMLCollection col, XMLElement el) {
127:                return true;
128:            }
129:
130:            // **********************      
131:
132:            protected void init() {
133:                // creating special items and buttons
134:                panel = createPanel();
135:            }
136:
137:            protected XPDLViewControllerPanel createPanel() {
138:                XPDLViewControllerPanel p = new XPDLViewControllerPanel(this );
139:                p.configure();
140:                p.init();
141:                return p;
142:            }
143:
144:            public void update(XPDLElementChangeInfo info) {
145:                if (updateInProgress)
146:                    return;
147:                if (info.getSource() == this )
148:                    return;
149:                updateInProgress = true;
150:                try {
151:                    int action = info.getAction();
152:                    if (action == XMLElementChangeInfo.REMOVED) {
153:                        panel.setSelectedElement(null);
154:                        return;
155:                    }
156:                    XMLElement curSelEl = panel.getSelectedElement();
157:                    XMLElement toSelect;
158:                    if (settings.showXPDLDetails())
159:                        toSelect = info.getChangedElement();
160:                    else
161:                        toSelect = XMLUtil.getPackage(info.getChangedElement());
162:                    if (!(action == XPDLElementChangeInfo.SELECTED || (curSelEl == toSelect && action == XMLElementChangeInfo.UPDATED))) {
163:                        toSelect = null;
164:                    }
165:                    if (curSelEl != toSelect
166:                            || action == XMLElementChangeInfo.UPDATED) {
167:                        panel.setSelectedElement(toSelect);
168:                    }
169:                } finally {
170:                    updateInProgress = false;
171:                }
172:            }
173:
174:            public XPDLViewSettings getXPDLViewSettings() {
175:                return settings;
176:            }
177:
178:            public void setUpdateInProgress(boolean inProgress) {
179:                updateInProgress = true;
180:            }
181:
182:            public boolean isUpdateInProgress() {
183:                return updateInProgress;
184:            }
185:
186:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.