Source Code Cross Referenced for DefaultNode.java in  » Science » weka » weka » gui » ensembleLibraryEditor » tree » 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 » Science » weka » weka.gui.ensembleLibraryEditor.tree 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         *    This program is free software; you can redistribute it and/or modify
003:         *    it under the terms of the GNU General Public License as published by
004:         *    the Free Software Foundation; either version 2 of the License, or
005:         *    (at your option) any later version.
006:         *
007:         *    This program is distributed in the hope that it will be useful,
008:         *    but WITHOUT ANY WARRANTY; without even the implied warranty of
009:         *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
010:         *    GNU General Public License for more details.
011:         *
012:         *    You should have received a copy of the GNU General Public License
013:         *    along with this program; if not, write to the Free Software
014:         *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
015:         */
016:
017:        /*
018:         *    DefaultNode.java
019:         *    Copyright (C) 2006 Robert Jung
020:         *
021:         */
022:
023:        package weka.gui.ensembleLibraryEditor.tree;
024:
025:        import weka.gui.EnsembleLibraryEditor;
026:
027:        import java.beans.PropertyChangeEvent;
028:        import java.beans.PropertyChangeListener;
029:        import java.beans.PropertyEditor;
030:
031:        import javax.swing.tree.DefaultMutableTreeNode;
032:
033:        /**
034:         * This class is responsible for representing objects that we haven't explicitly
035:         * written custom tree node editors for. In other words - Objects that are
036:         * "weird". It didn't make sense for us to try to come up with a nice tree
037:         * representation for absolutely everything, e.g. CostMatrixes or ArrayLists.
038:         * This class is responsible for representing Classifier parameter values that
039:         * are not numbers, an enumeration of values (e.g. true/false), or Objects that
040:         * have their own GenericObjectEditors (like other Classifiers). So in these
041:         * cases we can just use the default editor that came with the object.
042:         * 
043:         * @author  Robert Jung (mrbobjung@gmail.com)
044:         * @version $Revision: 1.1 $
045:         */
046:        public class DefaultNode extends DefaultMutableTreeNode implements 
047:                PropertyChangeListener {
048:
049:            /** for serialization */
050:            private static final long serialVersionUID = -2182147677358461880L;
051:
052:            /** the name of this node */
053:            private String m_Name;
054:
055:            /** the tip text for our node editor to display */
056:            private String m_ToolTipText;
057:
058:            /** The default PropertyEditor that was supplied for this node */
059:            private PropertyEditor m_PropertyEditor;
060:
061:            /**
062:             * The constructor initializes the members of this node.
063:             * 
064:             * @param name
065:             *            the name of the value represented by this node
066:             * @param toolTipText
067:             *            the tool tip text to be displayed
068:             * @param value
069:             *            the intial value
070:             * @param propertyEditor
071:             *            the editor provided for this node
072:             */
073:            public DefaultNode(String name, String toolTipText, Object value,
074:                    PropertyEditor propertyEditor) {
075:
076:                super (value);
077:
078:                this .m_Name = name;
079:                this .m_ToolTipText = toolTipText;
080:                this .m_PropertyEditor = propertyEditor;
081:
082:                m_PropertyEditor.addPropertyChangeListener(this );
083:
084:            }
085:
086:            /**
087:             * this returns the property editor that was provided for this object. This
088:             * propertyEditor object is initially chosen inside of the GenericObjectNode
089:             * updateTree() method if you are interested in where it comes from.
090:             * 
091:             * @return the default editor for this node
092:             */
093:            public PropertyEditor getEditor() {
094:                m_PropertyEditor.setValue(this .getUserObject());
095:                return m_PropertyEditor;
096:            }
097:
098:            /**
099:             * getter for the tooltip text
100:             * 
101:             * @return tooltip text
102:             */
103:            public String getToolTipText() {
104:                return m_ToolTipText;
105:            }
106:
107:            /**
108:             * gets the name of the parameter value represented by this node
109:             * 
110:             * @return the name of this parameter
111:             */
112:            public String getName() {
113:                return m_Name;
114:            }
115:
116:            /**
117:             * this is a simple filter for the setUserObject method. We basically don't
118:             * want null values to be passed in.
119:             * 
120:             * @param o		the user object
121:             */
122:            public void setUserObject(Object o) {
123:                if (o != null)
124:                    super .setUserObject(o);
125:            }
126:
127:            /**
128:             * ToString method simply prints out the user object toString for this node
129:             * 
130:             * @return		a string representation
131:             */
132:            public String toString() {
133:                return getClass().getName() + "[" + getUserObject().toString()
134:                        + "]";
135:            }
136:
137:            /**
138:             * This implements the PropertyChangeListener for this node that gets
139:             * registered with its Editor. All we really have to do is change the Object
140:             * value stored internally at this node when its editor says the value
141:             * changed.
142:             * 
143:             * @param evt		the event
144:             */
145:            public void propertyChange(PropertyChangeEvent evt) {
146:
147:                Object source = evt.getSource();
148:
149:                Object value = EnsembleLibraryEditor.getEditorValue(source);
150:
151:                /*
152:                 * //was useful for debugging when we encountered some strange value
153:                 * types //these printouts tell you the classes that the editor is
154:                 * supplying System.out.println("prop name: " + evt.getPropertyName() +
155:                 * "new value: " + evt.getNewValue() + "old value: " +
156:                 * evt.getOldValue()); System.out.println("prop val: " +
157:                 * source.toString() + " expected val: " + value);
158:                 */
159:                setUserObject(value);
160:            }
161:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.