Source Code Cross Referenced for BasicFieldNode.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 org.netbeans.modules.soa.mapper.basicmapper.MapperNode;
023:        import org.netbeans.modules.soa.mapper.common.basicmapper.literal.ILiteralUpdater;
024:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IField;
025:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IFieldNode;
026:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IMethoid;
027:        import org.netbeans.modules.soa.mapper.common.basicmapper.methoid.IMethoidNode;
028:        import org.netbeans.modules.soa.mapper.common.IMapperLink;
029:        import org.netbeans.modules.soa.mapper.basicmapper.methoid.BasicAccumulatingMethoidNode;
030:
031:        /**
032:         * <p>
033:         *
034:         * Title: BasicFieldNode </p> <p>
035:         *
036:         * Description: Provides basic functionalities of a methoid field node. This
037:         * class extends BasicNode to provide all the basic mapper node functionalities.
038:         * Then it wraps the IMethoidField object passing from the constructor to
039:         * produce a mapper node of the funcotid field. </p> <p>
040:         *
041:         * @author    Un Seng Leong
042:         * @created   December 26, 2002
043:         */
044:        public class BasicFieldNode extends MapperNode implements  IFieldNode {
045:
046:            /**
047:             * The methoid field of this node.
048:             */
049:            private IField mField;
050:
051:            private String mName;
052:            private String mToolTip;
053:            private String mType;
054:            private String mLiteralName;
055:            private ILiteralUpdater mOriginalLiteralUpdater;
056:
057:            /**
058:             * Constructor a methoid field node by specified the methoid field.
059:             *
060:             * @param field  the methoid field of this node.
061:             */
062:            public BasicFieldNode(IField field) {
063:                mField = field;
064:                mName = field.getName();
065:            }
066:
067:            /**
068:             * Return the field data in another object repersentation.
069:             *
070:             * @return   the field data in another object repersentation.
071:             */
072:            public Object getFieldObject() {
073:                return mField;
074:            }
075:
076:            public void setFieldObject(Object obj) {
077:                IField field = (IField) obj;
078:                Object old = mField;
079:                mField = field;
080:                firePropertyChange(IFieldNode.FIELD_OBJECT_CHANGED, old, obj);
081:            }
082:
083:            /**
084:             * Return the name of this field.
085:             *
086:             * @return   the name of this field.
087:             */
088:            public String getName() {
089:                if (mName != null)
090:                    return mName;
091:                return mField.getName();
092:            }
093:
094:            /**
095:             * Return the popup tooltip text of this field.
096:             *
097:             * @return   the popup tooltip text of this field.
098:             */
099:            public String getToolTipText() {
100:                if (mToolTip != null)
101:                    return mToolTip;
102:                return mField.getToolTipText();
103:            }
104:
105:            /**
106:             * Return the type name of this field.
107:             *
108:             * @return   the type name of this field.
109:             */
110:            public String getTypeName() {
111:                if (mType != null)
112:                    return mType;
113:                return mField.getType();
114:            }
115:
116:            /**
117:             * Retrun ture if this field is an input field, false otherwise.
118:             *
119:             * @return   true if this field is an input field, false otherwise.
120:             */
121:            public boolean isInput() {
122:                return mField.isInput();
123:            }
124:
125:            /**
126:             * Retrun ture if this field is an output field, false otherwise.
127:             *
128:             * @return   true if this field is an output field, false otherwise.
129:             */
130:            public boolean isOutput() {
131:                return mField.isOutput();
132:            }
133:
134:            /**
135:             * Set the name of this field node.
136:             *
137:             * @param name  the name of this field node.
138:             */
139:            public void setName(String name) {
140:                String oldName = mName;
141:                mName = name;
142:                mLiteralName = null;
143:                firePropertyChange(IFieldNode.NAME_CHANGED, mName, oldName);
144:            }
145:
146:            /**
147:             * Set the popup tooltip text of this field.
148:             *
149:             * @param tooltip  the popup tooltip text of this field.
150:             */
151:            public void setToolTipText(String tooltip) {
152:                String oldToolTip = mToolTip;
153:                mToolTip = tooltip;
154:                firePropertyChange(IFieldNode.TOOLTIP_CHANGED, mToolTip,
155:                        oldToolTip);
156:            }
157:
158:            /**
159:             * Set the type name of this field.
160:             *
161:             * @param type  the type name of this field.
162:             */
163:            public void setTypeName(String type) {
164:                String oldType = mType;
165:                mType = type;
166:                firePropertyChange(IFieldNode.TOOLTIP_CHANGED, mType, oldType);
167:            }
168:
169:            /**
170:             * Return a cloned basic field node of this field node. The IField object
171:             * will be the same as the this field node.
172:             *
173:             * @return   a cloned basic field node of this field node.
174:             */
175:            public Object clone() {
176:                BasicFieldNode newNode = (BasicFieldNode) super .clone();
177:                newNode.mField = mField;
178:                newNode.mName = mField.getName();
179:                newNode.mToolTip = mField.getToolTipText();
180:                newNode.mType = mField.getType();
181:                return newNode;
182:            }
183:
184:            /**
185:             * This method calculates the hash code value
186:             * @return hash code
187:             */
188:            public int hashCode() {
189:                int hashCode = 0;
190:
191:                if (mField != null) {
192:                    hashCode = hashCode ^ mField.hashCode();
193:                }
194:                if (this .mName != null) {
195:                    hashCode = hashCode ^ mName.hashCode();
196:                }
197:                if (this .mToolTip != null) {
198:                    hashCode = hashCode ^ mToolTip.hashCode();
199:                }
200:                if (this .mType != null) {
201:                    hashCode = hashCode ^ mType.hashCode();
202:                }
203:                if (this .getGroupNode() != null) {
204:                    hashCode = hashCode ^ this .getGroupNode().hashCode();
205:                }
206:
207:                return hashCode;
208:            }
209:
210:            /**
211:             * This method determines whether two values are equal
212:             * @param obj obj
213:             * @return boolean
214:             */
215:            public boolean equals(Object obj) {
216:                if (obj == null) {
217:                    return false;
218:                }
219:                if (!(obj instanceof  BasicFieldNode)) {
220:                    return false;
221:                }
222:                if (this  == obj) {
223:                    return true;
224:                }
225:                BasicFieldNode node = (BasicFieldNode) obj;
226:
227:                if (mField != null) {
228:                    if (!mField.equals(node.getFieldObject())) {
229:                        return false;
230:                    }
231:                }
232:                if (mName != null && !mName.equals(node.getName())) {
233:                    return false;
234:                }
235:                if (mType != null && !mType.equals(node.getTypeName())) {
236:                    return false;
237:                }
238:
239:                if (mToolTip != null && !mToolTip.equals(node.getToolTipText())) {
240:                    return false;
241:                }
242:                return true;
243:            }
244:
245:            /**
246:             * Add a link that is connected to this node. Link is added only if the link
247:             * is not already existed.
248:             *
249:             * @param link  the link connected to this node.
250:             */
251:            public void addLink(IMapperLink link) {
252:                if (isInput() && mField.getLiteralUpdater() != null
253:                        && hasInPlaceLiteral()) {
254:                    // Remove the in-place literal before we connect a different link expression.
255:                    mField.getLiteralUpdater().literalUnset(this );
256:                    setLiteralName(null);
257:                }
258:                super .addLink(link);
259:            }
260:
261:            private void setStyle(String style) {
262:                firePropertyChange(IFieldNode.STYLE_CHANGED, style, null);
263:            }
264:
265:            /**
266:             * Return the display name of this methoid field node.
267:             * The display name is the visual name in the methoid field.
268:             */
269:            public String getLiteralName() {
270:                return mLiteralName;
271:            }
272:
273:            /**
274:             * Returns whether this field node has an in-place literal.
275:             * This represents an unlinked field node that is 
276:             * tied to literal expression. 
277:             */
278:            public boolean hasInPlaceLiteral() {
279:                return mLiteralName != null;
280:            }
281:
282:            /**
283:             * Set the display name of this methoid field node.
284:             */
285:            public void setLiteralName(String literalName) {
286:                setLiteralName(literalName, mField.getLiteralUpdater());
287:            }
288:
289:            /**
290:             * Set the display name of this methoid field node.
291:             * Override the innate literal updater with the specified one.
292:             */
293:            public void setLiteralName(String literalName,
294:                    ILiteralUpdater updater) {
295:                // do not update the mName field, we are only changing the display name
296:                mLiteralName = literalName;
297:                if (mField.getLiteralUpdater() != null
298:                        && mField.getLiteralUpdater() != updater) {
299:                    mOriginalLiteralUpdater = mField.getLiteralUpdater();
300:                    mField.setLiteralUpdater(updater);
301:                }
302:                if (literalName == null) {
303:                    if (mOriginalLiteralUpdater != null) {
304:                        // if an overriding updater was set, revert it
305:                        mField.setLiteralUpdater(mOriginalLiteralUpdater);
306:                    }
307:                    // unset literal by refreshing original name and reverting style
308:                    setName(getName());
309:                    setStyle(IFieldNode.STYLE_TYPE_NORMAL);
310:                } else {
311:                    if (updater != null) {
312:                        String literalDisplayName = updater
313:                                .getLiteralDisplayText(literalName);
314:                        firePropertyChange(IFieldNode.NAME_CHANGED,
315:                                literalDisplayName, mName);
316:                    } else {
317:                        firePropertyChange(IFieldNode.NAME_CHANGED,
318:                                literalName, mName);
319:                    }
320:                    setStyle(IFieldNode.STYLE_TYPE_LITERAL);
321:
322:                    // make sure accumulating methoid containers grow properly
323:                    IMethoidNode methoidNode = (IMethoidNode) getGroupNode();
324:                    IMethoid methoid = (IMethoid) methoidNode
325:                            .getMethoidObject();
326:                    if (methoid.isAccumulative()) {
327:                        ((BasicAccumulatingMethoidNode) methoidNode)
328:                                .checkAddNew();
329:                    }
330:                }
331:            }
332:        }
w_w_w_._j___a___v__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.