Source Code Cross Referenced for ParticlePropertyModel.java in  » Web-Framework » rife-1.6.1 » com » uwyn » rife » gui » model » 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 » Web Framework » rife 1.6.1 » com.uwyn.rife.gui.model 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2001-2007 Geert Bevin <gbevin[remove] at uwyn dot com>
003:         * Distributed under the terms of either:
004:         * - the common development and distribution license (CDDL), v1.0; or
005:         * - the GNU Lesser General Public License, v2.1 or later
006:         * $Id: ParticlePropertyModel.java 3634 2007-01-08 21:42:24Z gbevin $
007:         */
008:        package com.uwyn.rife.gui.model;
009:
010:        import java.lang.reflect.InvocationTargetException;
011:        import java.lang.reflect.Method;
012:
013:        import com.uwyn.rife.gui.model.exceptions.ParticlePropertyCreationException;
014:        import com.uwyn.rife.gui.model.exceptions.GuiModelException;
015:
016:        public abstract class ParticlePropertyModel {
017:            private ParticleModel mParticle = null;
018:            private String mName = null;
019:            private String mDescription = null;
020:
021:            private ParticlePropertyModel() {
022:            }
023:
024:            protected ParticlePropertyModel(ParticleModel particle, String name)
025:                    throws GuiModelException {
026:                assert particle != null;
027:                assert name != null;
028:
029:                setName(name);
030:                try {
031:                    particle.addProperty(this );
032:                } catch (GuiModelException e) {
033:                    throw new ParticlePropertyCreationException(e);
034:                }
035:            }
036:
037:            public ParticleModel getParticle() {
038:                synchronized (this ) {
039:                    return mParticle;
040:                }
041:            }
042:
043:            protected void setParticle(ParticleModel particle) {
044:                synchronized (this ) {
045:                    mParticle = particle;
046:                }
047:            }
048:
049:            public String getDescription() {
050:                synchronized (this ) {
051:                    return mDescription;
052:                }
053:            }
054:
055:            public void setDescription(String description) {
056:                synchronized (this ) {
057:                    mDescription = description;
058:                }
059:            }
060:
061:            public boolean equals(Object object) {
062:                if (object instanceof  ParticlePropertyModel) {
063:                    ParticlePropertyModel property = (ParticlePropertyModel) object;
064:                    if (property.getParticle() == getParticle()
065:                            && property.getClass() == getClass()
066:                            && property.getName().equals(getName())) {
067:                        return true;
068:                    }
069:                }
070:
071:                return false;
072:            }
073:
074:            public int hashCode() {
075:                int result = 17;
076:
077:                result = 37 * result + getParticle().hashCode();
078:                result = 37 * result + getClass().hashCode();
079:                result = 37 * result + getName().hashCode();
080:
081:                return result;
082:            }
083:
084:            public String getName() {
085:                synchronized (this ) {
086:                    return mName;
087:                }
088:            }
089:
090:            protected void setName(String name) {
091:                assert name != null;
092:                assert name.length() > 0;
093:
094:                synchronized (this ) {
095:                    mName = name;
096:                }
097:            }
098:
099:            public final boolean isValidName(String name) {
100:                if (null == name)
101:                    throw new IllegalArgumentException("name can't be null.");
102:                if (0 == name.length())
103:                    throw new IllegalArgumentException("name can't be empty.");
104:
105:                ParticlePropertyModel temp_property = findConflictingProperty(
106:                        getParticle(), getClass(), name);
107:
108:                if (temp_property == this  || temp_property == null) {
109:                    return true;
110:                } else {
111:                    return false;
112:                }
113:            }
114:
115:            public static boolean isValidName(ParticleModel particle,
116:                    Class type, String name) {
117:                if (null == particle)
118:                    throw new IllegalArgumentException(
119:                            "particle can't be null.");
120:                if (null == type)
121:                    throw new IllegalArgumentException("type can't be null.");
122:                if (null == name)
123:                    throw new IllegalArgumentException("name can't be null.");
124:                if (0 == name.length())
125:                    throw new IllegalArgumentException("name can't be empty.");
126:
127:                ParticlePropertyModel temp_property = null;
128:                Method find_conflicting_property_method = null;
129:
130:                Class class_to_search = type;
131:
132:                while (class_to_search != null) {
133:                    try {
134:                        find_conflicting_property_method = class_to_search
135:                                .getDeclaredMethod("findConflictingProperty",
136:                                        new Class[] { ParticleModel.class,
137:                                                Class.class, String.class });
138:                        break;
139:                    } catch (NoSuchMethodException e) {
140:                        class_to_search = class_to_search.getSuperclass();
141:                        find_conflicting_property_method = null;
142:                    }
143:                }
144:
145:                if (find_conflicting_property_method != null) {
146:                    try {
147:                        temp_property = (ParticlePropertyModel) find_conflicting_property_method
148:                                .invoke(null, new Object[] { particle, type,
149:                                        name });
150:                    } catch (IllegalAccessException e) {
151:                        temp_property = null;
152:                    } catch (IllegalArgumentException e) {
153:                        temp_property = null;
154:                    } catch (InvocationTargetException e) {
155:                        temp_property = null;
156:                    }
157:                }
158:
159:                if (temp_property == null) {
160:                    return true;
161:                } else {
162:                    return false;
163:                }
164:            }
165:
166:            protected static ParticlePropertyModel findConflictingProperty(
167:                    ParticleModel particle, Class type, String name) {
168:                assert particle != null;
169:                assert type != null;
170:                assert name != null;
171:                assert name.length() > 0;
172:
173:                return particle.getProperty(type, name);
174:            }
175:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.