Source Code Cross Referenced for BasicMethoidNode.java in  » IDE-Netbeans » soa » org » netbeans » modules » soa » mapper » basicmapper » methoid » 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 » IDE Netbeans » soa » org.netbeans.modules.soa.mapper.basicmapper.methoid 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * The contents of this file are subject to the terms of the Common Development
003:         * and Distribution License (the License). You may not use this file except in
004:         * compliance with the License.
005:         * 
006:         * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
007:         * or http://www.netbeans.org/cddl.txt.
008:         * 
009:         * When distributing Covered Code, include this CDDL Header Notice in each file
010:         * and include the License file at http://www.netbeans.org/cddl.txt.
011:         * If applicable, add the following below the CDDL Header, with the fields
012:         * enclosed by brackets [] replaced by your own identifying information:
013:         * "Portions Copyrighted [year] [name of copyright owner]"
014:         * 
015:         * The Original Software is NetBeans. The Initial Developer of the Original
016:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
017:         * Microsystems, Inc. All Rights Reserved.
018:         */
019:
020:        package org.netbeans.modules.soa.mapper.basicmapper.methoid;
021:
022:        import java.util.ArrayList;
023:        import java.util.Iterator;
024:        import java.util.LinkedList;
025:        import java.util.List;
026:
027:        import javax.swing.Icon;
028:
029:        import org.netbeans.modules.soa.mapper.common.ui.palette.IPaletteItem;
030:        import org.netbeans.modules.soa.mapper.basicmapper.MapperGroupNode;
031:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IField;
032:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IFieldNode;
033:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IMethoid;
034:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IMethoidNode;
035:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IMutableMethoidNode;
036:        import org.netbeans.modules.soa.mapper.common.IMapperNode;
037:
038:        /**
039:         * <p>
040:         *
041:         * Title: </p> BasicMethoidNode <p>
042:         *
043:         * Description: </p> BasicMethoidNode provides basic implementation of
044:         * IMethoidNode.<p>
045:         *
046:         * Copyright: Copyright (c) 2002 </p> <p>
047:         *
048:         * Company: </p>
049:         *
050:         * @author    Un Seng Leong
051:         * @created   December 19, 2002
052:         * @version   1.0
053:         */
054:        public class BasicMethoidNode extends MapperGroupNode implements 
055:                IMutableMethoidNode {
056:
057:            private String mName;
058:            private String mToolTip;
059:            private Icon mIcon;
060:
061:            /**
062:             * the methoid object of this methoid node repersents.
063:             */
064:            private IMethoid mMethoid;
065:
066:            /**
067:             * Construct a funcotid mapper node with the specified methoid object.
068:             *
069:             * @param methoid  the methoid object of this node repersents.
070:             */
071:            public BasicMethoidNode(IMethoid methoid) {
072:                super ();
073:                mMethoid = methoid;
074:
075:                // this order add to the list makes up the order in the
076:                // methoid graphics.
077:                IFieldNode fieldNode = null;
078:                List addedFieldNodes = new ArrayList();
079:
080:                if (mMethoid.getNamespace() != null) {
081:                    fieldNode = new BasicFieldNode(mMethoid.getNamespace());
082:                    addedFieldNodes.add(fieldNode);
083:                    addToLast(fieldNode);
084:                }
085:
086:                List fields = mMethoid.getInput();
087:                int i = 0;
088:
089:                if ((fields != null) && (fields.size() > 0)) {
090:                    for (; i < fields.size(); i++) {
091:                        fieldNode = new BasicFieldNode((IField) fields.get(i));
092:                        addedFieldNodes.add(fieldNode);
093:                        addToLast(fieldNode);
094:                    }
095:                }
096:
097:                fields = mMethoid.getOutput();
098:                i = 0;
099:
100:                if ((fields != null) && (fields.size() > 0)) {
101:                    for (; i < fields.size(); i++) {
102:                        fieldNode = new BasicFieldNode((IField) fields.get(i));
103:                        addedFieldNodes.add(fieldNode);
104:                        addToLast(fieldNode);
105:                    }
106:                }
107:                this .setX(-1);
108:                this .setY(-1);
109:            }
110:
111:            /**
112:             * Return the name of this methoid.
113:             *
114:             * @return   the name of this methoid.
115:             */
116:            public String getMethoidName() {
117:                if (mName != null)
118:                    return mName;
119:                return mMethoid.getName();
120:            }
121:
122:            /**
123:             * Return the data object of this methoid node. This method returns the
124:             * IMethoid object that this node repersents.
125:             *
126:             * @return   the IMethoid object that this node repersents.
127:             */
128:            public Object getMethoidObject() {
129:                return mMethoid;
130:            }
131:
132:            public void setMethoidObject(Object methoidObj) {
133:                if (!(methoidObj instanceof  IMethoid)) {
134:                    throw new IllegalArgumentException(
135:                            "Required an IMethoid, found " + methoidObj);
136:                }
137:                if (methoidObj == mMethoid)
138:                    return;
139:                IMethoid newMethoid = (IMethoid) methoidObj;
140:                Object data = newMethoid.getData();
141:                boolean accum = false;
142:                if (data instanceof  IPaletteItem) {
143:                    IPaletteItem item = (IPaletteItem) data;
144:                    accum = String
145:                            .valueOf(item.getItemAttribute("Accumlative"))
146:                            .equals("true");
147:                }
148:                List list = this .getInputFieldNodes();
149:                List tem = newMethoid.getInput();
150:                IField lastField = null;
151:                List toBeRemoved = new LinkedList();
152:                for (int i = 0, len = list.size(); i < len; i++) {
153:                    IFieldNode fn = (IFieldNode) list.get(i);
154:                    IField f = null;
155:                    if (i < tem.size()) {
156:                        f = (IField) tem.get(i);
157:                        lastField = f;
158:                    } else {
159:                        if (!accum) {
160:                            toBeRemoved.add(fn);
161:                            continue;
162:                        }
163:                        f = lastField;
164:                    }
165:                    fn.setFieldObject(f);
166:                    String fname = f.getName();
167:                    String fieldName = fname;
168:                    int sharp = fname.indexOf('#');
169:                    if (sharp > 0) {
170:                        fieldName = fname.substring(0, sharp);
171:                        fieldName += ++i;
172:                        if (sharp + 1 < fname.length()) {
173:                            fieldName += fname.substring(sharp + 1);
174:                        }
175:                    }
176:                    fn.setName(fieldName);
177:                    fn.setTypeName(f.getType());
178:                }
179:                Iterator iter = toBeRemoved.iterator();
180:                while (iter.hasNext()) {
181:                    removeNode((IMapperNode) iter.next());
182:                }
183:                list = this .getOutputFieldNodes();
184:                tem = newMethoid.getOutput();
185:                for (int i = 0, len = tem.size(); i < len; i++) {
186:                    ((IFieldNode) list.get(i)).setFieldObject(tem.get(i));
187:                }
188:                Object o = mMethoid, n = methoidObj;
189:                mMethoid = (IMethoid) methoidObj;
190:                firePropertyChange(IMethoidNode.METHOID_OBJECT_CHANGED, o, n);
191:            }
192:
193:            /**
194:             * Return the icon of this methoid.
195:             *
196:             * @return   the icon of this methoid
197:             */
198:            public Icon getIcon() {
199:                if (mIcon != null)
200:                    return mIcon;
201:                return mMethoid.getIcon();
202:            }
203:
204:            /**
205:             * Return the tooltip text of this methoid.
206:             *
207:             * @return   the tooltip text of this methoid.
208:             */
209:            public String getToolTipText() {
210:                if (mToolTip != null)
211:                    return mToolTip;
212:                return mMethoid.getToolTipText();
213:            }
214:
215:            /**
216:             * Set the name of this methoid.
217:             *
218:             * @param name  the name of this methoid.
219:             */
220:            public void setMethoidName(String name) {
221:                mName = name;
222:            }
223:
224:            /**
225:             * Set the icon of this methoid.
226:             *
227:             * @param icon  the icon of this methoid.
228:             */
229:            public void setIcon(Icon icon) {
230:                mIcon = icon;
231:            }
232:
233:            /**
234:             * Set the tooltip text of this methoid.
235:             *
236:             * @param tooltip  the tooltip text of this methoid.
237:             */
238:            public void setToolTipText(String tooltip) {
239:                mToolTip = tooltip;
240:            }
241:
242:            /**
243:             * Find and return the methoid field node that repersents the specified
244:             * field, or null if the node cannot be found.
245:             *
246:             * @param field  the specifed field to be matched.
247:             * @return       the methoid field node that repersents the specified field.
248:             */
249:            public IFieldNode findNode(IField field) {
250:                for (int i = 0; i < getNodeList().size(); i++) {
251:                    IFieldNode node = (IFieldNode) getNodeList().get(i);
252:
253:                    if (node.getFieldObject().equals(field)) {
254:                        return node;
255:                    }
256:                }
257:                return null;
258:            }
259:
260:            /**
261:             * Return true if the specified field node is the name space field node of
262:             * this methoid, false otherwise.
263:             *
264:             * @param fieldNode  the field node to be matched.
265:             * @return           true if the specified field node is the name space
266:             *      field node of this methoid, false otherwise.
267:             */
268:            public boolean isNamespaceField(IFieldNode fieldNode) {
269:                if (mMethoid.getNamespace() == null) {
270:                    return false;
271:                }
272:                return mMethoid.getNamespace().equals(
273:                        fieldNode.getFieldObject());
274:            }
275:
276:            /**
277:             * Retrun the name space field node of this methoid.
278:             *
279:             * @return   the name space field node of this methoid.
280:             */
281:            public IFieldNode getNamespaceFieldNode() {
282:                if (mMethoid.getNamespace() == null) {
283:                    return null;
284:                }
285:                for (int i = 0; i < getNodeList().size(); i++) {
286:                    IFieldNode child = (IFieldNode) getNodeList().get(i);
287:                    if (isNamespaceField(child)) {
288:                        return child;
289:                    }
290:                }
291:                return null;
292:            }
293:
294:            /**
295:             * Returns the input field nodes of this methoid node.
296:             *
297:             * @return   The input field nodes of this methoid node.
298:             */
299:            public List getInputFieldNodes() {
300:                List rslt = new ArrayList();
301:                for (int i = 0; i < getNodeList().size(); i++) {
302:                    IFieldNode node = (IFieldNode) getNodeList().get(i);
303:
304:                    if (node.isInput()) {
305:                        rslt.add(node);
306:                    }
307:                }
308:                return rslt;
309:            }
310:
311:            /**
312:             * Returns the output field nodes of this methoid node
313:             *
314:             * @return   the output field nodes of this methoid node
315:             */
316:            public List getOutputFieldNodes() {
317:                List rslt = new ArrayList();
318:                for (int i = 0; i < getNodeList().size(); i++) {
319:                    IFieldNode node = (IFieldNode) getNodeList().get(i);
320:
321:                    if (node.isOutput()) {
322:                        rslt.add(node);
323:                    }
324:                }
325:                return rslt;
326:            }
327:
328:            /**
329:             * Return a sum of all next nodes of the children.
330:             *
331:             * @return   a sum of all next nodes of the children.
332:             */
333:            public List getNextNodes() {
334:                List allNextNodes = new ArrayList();
335:                for (int i = 0; i < getNodeList().size(); i++) {
336:                    IFieldNode node = (IFieldNode) getNodeList().get(i);
337:
338:                    if (node.isOutput()) {
339:                        allNextNodes.addAll(node.getNextNodes());
340:                    }
341:                }
342:                return allNextNodes;
343:            }
344:
345:            /**
346:             * Return a sum of all previous nodes of the children.
347:             *
348:             * @return   a sum of all previous nodes of the children.
349:             */
350:            public List getPreviousNodes() {
351:                List allPrevNodes = new ArrayList();
352:                for (int i = 0; i < getNodeList().size(); i++) {
353:                    IFieldNode node = (IFieldNode) getNodeList().get(i);
354:
355:                    if (node.isInput()) {
356:                        allPrevNodes.addAll(node.getPreviousNodes());
357:                    }
358:                }
359:                return allPrevNodes;
360:            }
361:
362:            /**
363:             * Return a cloned BasicMethoidNode. The IMethoid meta data object will not
364:             * be cloned. Both orginal and the new cloned are referred to the same
365:             * IMethoid object.
366:             *
367:             * @return   a cloned BasicMethoidNode.
368:             */
369:            public Object clone() {
370:                BasicMethoidNode newNode = (BasicMethoidNode) super .clone();
371:                newNode.mMethoid = mMethoid;
372:                newNode.mName = mName;
373:                newNode.mIcon = mIcon;
374:                newNode.mToolTip = mToolTip;
375:                return newNode;
376:            }
377:
378:            /**
379:             * Add and return the new input child of this methoid.
380:             * This only applies to methoid nodes of accumulating methoids.
381:             *
382:             * @return   the new input child of this methoid.
383:             */
384:            public IFieldNode getNextNewNode() {
385:                // By default, we are not growable.
386:                return null;
387:            }
388:        }
ww__w_.___j___av___a2_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.