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


001:        package org.enhydra.jawe.components.graph;
002:
003:        import java.util.ArrayList;
004:        import java.util.HashSet;
005:        import java.util.Iterator;
006:        import java.util.Map;
007:        import java.util.Set;
008:
009:        import org.jgraph.graph.ParentMap;
010:
011:        /**
012:         * Describes relations between childs and parents.
013:         *
014:         */
015:        public class JaWEParentMap extends ParentMap {
016:
017:            /**
018:             * Returns the list of parents that will be empty when
019:             * this parent map is applied.
020:             */
021:            public ArrayList emptyParentList() {
022:                ArrayList list = new ArrayList();
023:                Iterator it = childCount.entrySet().iterator();
024:                while (it.hasNext()) {
025:                    Map.Entry entry = (Map.Entry) it.next();
026:                    if (entry.getValue() instanceof  Integer) {
027:                        if (((Integer) entry.getValue()).intValue() == 0)
028:                            list.add(entry.getKey());
029:                    }
030:                }
031:                return list;
032:            }
033:
034:            /**
035:             * Returns true if Participant that is in changed nodes set has other Participants.
036:             * NOTE: because this method is not used when Participants are added to each other,
037:             *       method doesn't check for added participants but only for removed.
038:             */
039:            public boolean hasAnyParticipant(Object p) {
040:                if ((p == null) || !(p instanceof  DefaultGraphParticipant)) {
041:                    return false;
042:                }
043:                // getting current state in model
044:                Set childParticipants = new HashSet(
045:                        ((DefaultGraphParticipant) p).getChildParticipants());
046:                // removing from it all changedNodes - this means (considering a NOTE)
047:                // that these participants will be deleted after parent map is applied
048:                childParticipants.removeAll(changedNodes);
049:
050:                return (childParticipants.size() > 0);
051:
052:            }
053:
054:            /**
055:             * Returns all children which will belong to given parent
056:             * when this parent map is applied.
057:             */
058:            public ArrayList getNewChildren(Object parent) {
059:                ArrayList list = new ArrayList();
060:                if (parent != null) {
061:                    Iterator it = entries.iterator();
062:                    while (it.hasNext()) {
063:                        Entry entry = (Entry) it.next();
064:                        Object parentFromEntry = entry.getParent();
065:                        if (parentFromEntry != null
066:                                && parentFromEntry.equals(parent)) {
067:                            list.add(entry.getChild());
068:                        }
069:                    }
070:                }
071:                return list;
072:            }
073:
074:            /**
075:             * Returns parent of given child. The child will belong to returned
076:             * parent when this parent map is applied.
077:             */
078:            public Object getNewParent(Object child) {
079:                Object parent = null;
080:                if (child != null) {
081:                    Iterator it = entries.iterator();
082:                    while (it.hasNext()) {
083:                        Entry entry = (Entry) it.next();
084:                        Object childFromEntry = entry.getChild();
085:                        if (childFromEntry != null
086:                                && childFromEntry.equals(child)) {
087:                            parent = entry.getParent();
088:                            break;
089:                        }
090:                    }
091:                }
092:                return parent;
093:            }
094:
095:            /**
096:             * Returns nodes that will be removed after this map is applied (These
097:             * are entries which parent part is null).
098:             */
099:            public ArrayList getRemovedNodes() {
100:                ArrayList list = new ArrayList();
101:                Iterator it = entries.iterator();
102:                while (it.hasNext()) {
103:                    Entry entry = (Entry) it.next();
104:                    Object parentFromEntry = entry.getParent();
105:                    if (parentFromEntry == null) {
106:                        list.add(entry.getChild());
107:                    }
108:                }
109:                return list;
110:            }
111:
112:            /**
113:             * Returns the number of entries in parent map.
114:             */
115:            public int entryCount() {
116:                return entries.size();
117:            }
118:
119:        }
120:
121:        /* End of PEParentMap.java */
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.