Source Code Cross Referenced for ComponentFlowEditorBasicCompoundPropertySource.java in  » ESB » cbesb-1.2 » com » bostechcorp » cbesb » ui » componentflow » componentFlowEditor » diagram » providers » 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 » ESB » cbesb 1.2 » com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * ChainBuilder ESB
003:         *          Visual Enterprise Integration
004:         * 
005:         * Copyright (C) 2006 Bostech Corporation
006:         * 
007:         * This program is free software; you can redistribute it and/or modify it 
008:         * under the terms of the GNU General Public License as published by the 
009:         * Free Software Foundation; either version 2 of the License, or (at your option) 
010:         * any later version.
011:         *
012:         * This program is distributed in the hope that it will be useful, 
013:         * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
014:         * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
015:         * for more details.
016:         * 
017:         * You should have received a copy of the GNU General Public License along with 
018:         * this program; if not, write to the Free Software Foundation, Inc., 
019:         * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020:         *
021:         *
022:         * $Id$
023:         */
024:        package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.providers;
025:
026:        import java.util.ArrayList;
027:        import java.util.HashMap;
028:        import java.util.Iterator;
029:        import java.util.List;
030:        import java.util.Map;
031:        import org.eclipse.core.runtime.Assert;
032:        import org.eclipse.emf.common.notify.AdapterFactory;
033:        import org.eclipse.emf.ecore.EObject;
034:        import org.eclipse.emf.edit.provider.IItemPropertyDescriptor;
035:        import org.eclipse.emf.edit.provider.IItemPropertySource;
036:        import org.eclipse.ui.views.properties.IPropertyDescriptor;
037:        import org.eclipse.ui.views.properties.IPropertySource;
038:        import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.HTTP;
039:
040:        public abstract class ComponentFlowEditorBasicCompoundPropertySource
041:                implements  IPropertySource {
042:            protected Map subSourcesMap;
043:            /**
044:             * This is the object for which this class is a property source.
045:             */
046:            protected Object object;
047:            private List sources;
048:            private List objectsOfsources;
049:            protected AdapterFactory adapterFactory;
050:
051:            public ComponentFlowEditorBasicCompoundPropertySource(
052:                    Object object, AdapterFactory adapterFactory) {
053:                this .subSourcesMap = new HashMap();
054:                this .object = object;
055:                this .adapterFactory = adapterFactory;
056:            }
057:
058:            public void add(IItemPropertySource itemPropertySource, Object obj) {
059:                if (itemPropertySource instanceof  IItemPropertySource) {
060:                    if (sources == null)
061:                        sources = new ArrayList();
062:                    sources.add(itemPropertySource);
063:                    if (objectsOfsources == null)
064:                        objectsOfsources = new ArrayList();
065:                    objectsOfsources.add(obj);
066:                }
067:            }
068:
069:            public Object getPropertyValue(Object id) {
070:                //		if (sources != null)			
071:                //			for (Iterator i = sources.iterator(); i.hasNext(); ) {
072:                //				IItemPropertySource propertySource = (IItemPropertySource) i.next();
073:                //				int a =sources.indexOf(propertySource);				
074:                //				Object obj = objectsOfsources.get(sources.indexOf(propertySource));
075:                //				Object x = propertySource.getPropertyDescriptor(obj, id);
076:                //				Object result = propertySource.getPropertyDescriptor(obj, id) == null ? null
077:                //						: propertySource.getPropertyDescriptor(obj, id)
078:                //								.getPropertyValue(obj);
079:                //				if (result != null)
080:                //					return result;
081:                //			}
082:                //		return null;
083:                //		Assert.isTrue(id instanceof PropertyDescriptorWithObjectedID);
084:                if (id instanceof  PropertyDescriptorWithObjectedID) {
085:                    Object obj = ((PropertyDescriptorWithObjectedID) id)
086:                            .getObject();
087:                    return ((PropertyDescriptorWithObjectedID) id)
088:                            .getItemPropertyDescriptor().getPropertyValue(obj);//id - is dummy!
089:                }
090:                return null;
091:
092:            }
093:
094:            public boolean isPropertySet(Object id) {
095:                //		if (sources != null)
096:                //			for (Iterator i = sources.iterator(); i.hasNext(); ) {
097:                //				IItemPropertySource propertySource = (IItemPropertySource) i.next();
098:                //				Object obj = objectsOfsources.get(sources.indexOf(propertySource));
099:                //				if (propertySource.getPropertyDescriptor(obj, id)==null)
100:                //					continue;				
101:                //				if (propertySource.getPropertyDescriptor(obj, id).isPropertySet(obj))
102:                //					return true;
103:                //			}
104:                //		return false;
105:                //Assert.isTrue(id instanceof PropertyDescriptorWithObjectedID);
106:                if (id instanceof  PropertyDescriptorWithObjectedID) {
107:                    Object obj = ((PropertyDescriptorWithObjectedID) id)
108:                            .getObject();
109:                    return ((PropertyDescriptorWithObjectedID) id)
110:                            .getItemPropertyDescriptor().isPropertySet(obj);//id - is dummy!			
111:                }
112:                return false;
113:            }
114:
115:            public void resetPropertyValue(Object id) {
116:                //		if (sources != null)
117:                //			for (Iterator i = sources.iterator(); i.hasNext(); ) {
118:                //				IItemPropertySource propertySource = (IItemPropertySource) i.next();
119:                //				Object obj = objectsOfsources.get(sources.indexOf(propertySource));
120:                //				if (propertySource.getPropertyDescriptor(obj, id)!=null)
121:                //					propertySource.getPropertyDescriptor(obj, id).resetPropertyValue(obj);
122:                //			}
123:                //		Assert.isTrue(id instanceof PropertyDescriptorWithObjectedID);
124:                if (id instanceof  PropertyDescriptorWithObjectedID) {
125:                    Object obj = ((PropertyDescriptorWithObjectedID) id)
126:                            .getObject();
127:                    ((PropertyDescriptorWithObjectedID) id)
128:                            .getItemPropertyDescriptor()
129:                            .resetPropertyValue(obj);//id - is dummy!
130:                }
131:            }
132:
133:            public void setPropertyValue(Object id, Object value) {
134:                //		if (sources != null)
135:                //			for (Iterator i = sources.iterator(); i.hasNext();) {
136:                //				IItemPropertySource propertySource = (IItemPropertySource) i.next();
137:                //				Object obj = objectsOfsources.get(sources
138:                //						.indexOf(propertySource));
139:                //				if (propertySource.getPropertyDescriptor(obj, id) != null)
140:                //					propertySource.getPropertyDescriptor(obj, id)
141:                //							.setPropertyValue(obj, value);
142:                //			}
143:                //		Assert.isTrue(id instanceof PropertyDescriptorWithObjectedID);
144:                if (id instanceof  PropertyDescriptorWithObjectedID) {
145:                    Object obj = ((PropertyDescriptorWithObjectedID) id)
146:                            .getObject();
147:                    ((PropertyDescriptorWithObjectedID) id)
148:                            .getItemPropertyDescriptor().setPropertyValue(obj,
149:                                    value);//id - is dummy!
150:                }
151:            }
152:
153:            public Object getEditableValue() {
154:                //		if (sources != null)
155:                //			for (Iterator i = sources.iterator(); i.hasNext(); ) {
156:                //				IItemPropertySource propertySource = (IItemPropertySource) i.next();
157:                //				Object obj = objectsOfsources.get(sources.indexOf(propertySource));
158:                //				Object o = propertySource.getEditableValue(obj);
159:                //				return 	o;		
160:                //			}
161:                return this ;
162:            }
163:
164:            public IPropertyDescriptor[] getPropertyDescriptors() {
165:                List result = new ArrayList();
166:                if (sources != null)
167:                    for (int i = 0; i < sources.size(); i++) {
168:                        IItemPropertySource propertySource = (IItemPropertySource) sources
169:                                .get(i);
170:                        Object obj = objectsOfsources.get(i);
171:
172:                        addPropertyDescriptorsFromPropertySource(result, obj,
173:                                propertySource);
174:
175:                        //				if (obj instanceof HttpWSDLDocument) {
176:
177:                        //					List httpWSDLDescriptorsList = new ArrayList();
178:                        //					addPropertyDescriptorsFromPropertySource(httpWSDLDescriptorsList, obj, propertySource);
179:                        //					IPropertyDescriptor[] httpWSDLDescriptors = (IPropertyDescriptor [])httpWSDLDescriptorsList.toArray(new IPropertyDescriptor [httpWSDLDescriptorsList.size()]);
180:                        //				}
181:                        //				List itemPropertyDescriptors = propertySource.getPropertyDescriptors(obj);
182:                        //				if (itemPropertyDescriptors != null)
183:                        //			    {
184:                        //			      for (Iterator j = itemPropertyDescriptors.iterator(); j.hasNext(); )
185:                        //			      {
186:                        //			        IItemPropertyDescriptor itemPropertyDescriptor = (IItemPropertyDescriptor)j.next();
187:                        //			        result.add(createPropertyDescriptor(obj, itemPropertyDescriptor));
188:                        //			      }
189:                        //			    }				
190:                    }
191:                //add HTTPWSDL
192:                List otherList = getSubLevelPropertyDescriptorList();
193:                result.addAll(otherList);
194:                //
195:                IPropertyDescriptor[] x = (IPropertyDescriptor[]) result
196:                        .toArray(new IPropertyDescriptor[result.size()]);
197:                return x;
198:            }
199:
200:            abstract protected List getSubLevelPropertyDescriptorList();
201:
202:            abstract protected void updateSubSourcesMap();
203:
204:            protected IItemPropertySource getIItemPropertySourceAdapter(
205:                    Object object) {
206:                return (IItemPropertySource) (object instanceof  EObject
207:                        && ((EObject) object).eClass() == null ? null
208:                        : adapterFactory.adapt(object,
209:                                IItemPropertySource.class));
210:            }
211:
212:            protected void addPropertyDescriptorsFromPropertySource(
213:                    List result, Object obj, IItemPropertySource propertySource) {
214:                List itemPropertyDescriptors = propertySource
215:                        .getPropertyDescriptors(obj);
216:                if (itemPropertyDescriptors != null) {
217:                    for (Iterator j = itemPropertyDescriptors.iterator(); j
218:                            .hasNext();) {
219:                        IItemPropertyDescriptor itemPropertyDescriptor = (IItemPropertyDescriptor) j
220:                                .next();
221:                        result.add(createPropertyDescriptor(obj,
222:                                itemPropertyDescriptor));
223:                    }
224:                }
225:            }
226:
227:            protected IPropertyDescriptor createPropertyDescriptor(
228:                    Object object,
229:                    IItemPropertyDescriptor itemPropertyDescriptor) {
230:                return new PropertyDescriptorWithObjectedID(object,
231:                        itemPropertyDescriptor);
232:            }
233:        }
w___w_w__._j__av___a__2__s_._c_o_m___ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.