Source Code Cross Referenced for AbstractDesignInfo.java in  » IDE-Netbeans » visualweb.api.designer » org » netbeans » modules » visualweb » dataprovider » designtime » 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 » visualweb.api.designer » org.netbeans.modules.visualweb.dataprovider.designtime 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003:         *
004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005:         *
006:         * The contents of this file are subject to the terms of either the GNU
007:         * General Public License Version 2 only ("GPL") or the Common
008:         * Development and Distribution License("CDDL") (collectively, the
009:         * "License"). You may not use this file except in compliance with the
010:         * License. You can obtain a copy of the License at
011:         * http://www.netbeans.org/cddl-gplv2.html
012:         * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013:         * specific language governing permissions and limitations under the
014:         * License.  When distributing the software, include this License Header
015:         * Notice in each file and include the License file at
016:         * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this
017:         * particular file as subject to the "Classpath" exception as provided
018:         * by Sun in the GPL Version 2 section of the License file that
019:         * accompanied this code. If applicable, add the following below the
020:         * License Header, with the fields enclosed by brackets [] replaced by
021:         * your own identifying information:
022:         * "Portions Copyrighted [year] [name of copyright owner]"
023:         *
024:         * Contributor(s):
025:         *
026:         * The Original Software is NetBeans. The Initial Developer of the Original
027:         * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028:         * Microsystems, Inc. All Rights Reserved.
029:         *
030:         * If you wish your version of this file to be governed by only the CDDL
031:         * or only the GPL Version 2, indicate your decision by adding
032:         * "[Contributor] elects to include this software in this distribution
033:         * under the [CDDL or GPL Version 2] license." If you do not indicate a
034:         * single choice of license, a recipient has the option to distribute
035:         * your version of this file under either the CDDL, the GPL Version 2 or
036:         * to extend the choice of license to its licensees as provided above.
037:         * However, if you add GPL Version 2 code and therefore, elected the GPL
038:         * Version 2 license, then the option applies only if the new code is
039:         * made subject to such option by the copyright holder.
040:         */
041:
042:        package org.netbeans.modules.visualweb.dataprovider.designtime;
043:
044:        import java.beans.BeanDescriptor;
045:        import java.beans.BeanInfo;
046:        import java.beans.IntrospectionException;
047:        import java.beans.Introspector;
048:        import java.beans.PropertyDescriptor;
049:        import java.util.HashMap;
050:        import java.util.Map;
051:
052:        import com.sun.rave.designtime.DesignBean;
053:        import com.sun.rave.designtime.DesignEvent;
054:        import com.sun.rave.designtime.DesignInfo;
055:        import com.sun.rave.designtime.DesignProperty;
056:        import com.sun.rave.designtime.DisplayAction;
057:        import com.sun.rave.designtime.Result;
058:
059:        /**
060:         * <p>Convenience base class for <code>DesignInfo</code> implementations
061:         * that provide design time behavior for JSF components inside Creator.
062:         * Any <code>DesignInfo</code> implementation that extends this class
063:         * will receive the default behavior described for each method, unless that
064:         * method is overridden.</p>
065:         */
066:        public abstract class AbstractDesignInfo implements  DesignInfo {
067:
068:            // ------------------------------------------------------------- Constructor
069:
070:            /**
071:             * <p>Construct a <code>DesignInfo</code> instance for the specified
072:             * JavaBean class.</p>
073:             *
074:             * @param clazz Class of the JavaBean for which this instance is created
075:             */
076:            public AbstractDesignInfo(Class clazz) {
077:                this .beanClass = clazz;
078:            }
079:
080:            // ------------------------------------------------------ Instance Variables
081:
082:            /**
083:             * <p>The JavaBean class this <code>DesignInfo</code> instance is
084:             * designed to wrap.</p>
085:             */
086:            private Class beanClass = null;
087:
088:            // ------------------------------------------------------ DesignInfo Methods
089:
090:            /**
091:             * <p>Returns the class type of the JavaBean that was
092:             * passed to our constructor.</p>
093:             */
094:            public Class getBeanClass() {
095:
096:                return this .beanClass;
097:
098:            }
099:
100:            /**
101:             * <p>Take no action by default.  Return <code>true</code>.</p>
102:             *
103:             * {@inheritDoc}
104:             */
105:            public boolean acceptParent(DesignBean parentBean,
106:                    DesignBean childBean, Class childClass) {
107:
108:                return true;
109:
110:            }
111:
112:            /**
113:             * <p>Take no action by default.  Return <code>true</code>.</p>
114:             *
115:             * {@inheritDoc}
116:             */
117:            public boolean acceptChild(DesignBean parentBean,
118:                    DesignBean childBean, Class childClass) {
119:
120:                return true;
121:
122:            }
123:
124:            /**
125:             * <p>Take no action by default.  Return <code>Result.SUCCESS</code>.</p>
126:             *
127:             * @param bean The bean that was just created
128:             */
129:            public Result beanCreatedSetup(DesignBean bean) {
130:
131:                return Result.SUCCESS;
132:
133:            }
134:
135:            /**
136:             * <p>Take no action by default.  Return <code>Result.SUCCESS</code>.</p>
137:             *
138:             * @param bean The bean that is about to be deleted
139:             */
140:            public Result beanDeletedCleanup(DesignBean bean) {
141:
142:                return Result.SUCCESS;
143:
144:            }
145:
146:            /**
147:             * <p>Take no action by default.  Return <code>Result.SUCCESS</code>.</p>
148:             *
149:             * @param bean The bean that has been pasted
150:             */
151:            public Result beanPastedSetup(DesignBean bean) {
152:
153:                return Result.SUCCESS;
154:
155:            }
156:
157:            /**
158:             * <p>Return <code>null</code>, indicating that no context menu items
159:             * will be provided.</p>
160:             *
161:             * @param bean The DesignBean that a user has right-clicked on
162:             */
163:            public DisplayAction[] getContextItems(DesignBean bean) {
164:
165:                return null;
166:
167:            }
168:
169:            /**
170:             * <p>Return <code>false</code> by default.</p>
171:             *
172:             * @see #linkBeans
173:             */
174:            public boolean acceptLink(DesignBean targetBean,
175:                    DesignBean sourceBean, Class sourceClass) {
176:
177:                return false;
178:
179:            }
180:
181:            /**
182:             * <p>Take no action by default.</p>
183:             *
184:             * @param targetBean The target <code>DesignBean</code> instance that the
185:             *  user has 'dropped' an object onto to establish a link
186:             * @param sourceBean The <code>DesignBean</code> instance that has
187:             *  been 'dropped'
188:             *
189:             * @see #acceptLink
190:             */
191:            public Result linkBeans(DesignBean targetBean, DesignBean sourceBean) {
192:
193:                return Result.SUCCESS;
194:
195:            }
196:
197:            // ---------------------------------------------- DesignBeanListener Methods
198:
199:            /**
200:             * <p>Take no action by default.</p>
201:             *
202:             * @param bean The <code>DesignBean</code> whose context has been activated
203:             */
204:            public void beanContextActivated(DesignBean bean) {
205:
206:                ;
207:
208:            }
209:
210:            /**
211:             * <p>Take no action by default.</p>
212:             *
213:             * @param bean The <code>DesignBean</code> whose context has been deactivated
214:             */
215:            public void beanContextDeactivated(DesignBean bean) {
216:
217:                ;
218:
219:            }
220:
221:            /**
222:             * <p>Take no action by default.</p>
223:             *
224:             * @param bean The <code>DesignBean</code> that has been renamed.
225:             * @param oldInstanceName The prior instance name
226:             */
227:            public void instanceNameChanged(DesignBean bean,
228:                    String oldInstanceName) {
229:
230:                ;
231:
232:            }
233:
234:            /**
235:             * <p>Take no action by default.</p>
236:             *
237:             * @param bean The <code>DesignBean</code> that has changed.
238:             */
239:            public void beanChanged(DesignBean bean) {
240:
241:                ;
242:
243:            }
244:
245:            /**
246:             * <p>Take no action by default.</p>
247:             *
248:             * @param event The <code>DesignEvent</code> that has changed.
249:             */
250:            public void eventChanged(DesignEvent event) {
251:
252:                ;
253:
254:            }
255:
256:            /**
257:             * <p>Take no action by default.</p>
258:             *
259:             * @param property The <code>DesignProperty</code> that has changed.
260:             * @param oldValue Optional oldValue, or <code>null</code> if the
261:             *  previous value is not known
262:             */
263:            public void propertyChanged(DesignProperty property, Object oldValue) {
264:
265:                ;
266:
267:            }
268:
269:            // ------------------------------------------------------- Protected Methods
270:
271:            /**
272:             * <p>Return the <code>BeanDescriptor</code> for the class this
273:             * <code>DesignInfo</code> is designed to wrap, if possible;
274:             * otherwise, return <code>null</code>.</p>
275:             */
276:            protected BeanDescriptor getBeanDescriptor() {
277:
278:                try {
279:                    return getBeanInfo().getBeanDescriptor();
280:                } catch (IntrospectionException e) {
281:                    return null;
282:                }
283:
284:            }
285:
286:            /**
287:             * <p>Return the <code>BeanInfo</code> for the class this
288:             * <code>DesignInfo</code> is designed to wrap.</p>
289:             *
290:             * @exception IntrospectionException if an error occurs during introspection
291:             */
292:            protected BeanInfo getBeanInfo() throws IntrospectionException {
293:
294:                return Introspector.getBeanInfo(getBeanClass());
295:
296:            }
297:
298:            /**
299:             * <p>Return the <code>PropertyDescriptor</code> for the specified
300:             * property of the class this <code>DesignInfo</code> is designed
301:             * to wrap, if possible and if it exists; otherwise, return
302:             * <code>null</code>.</p>
303:             */
304:            protected PropertyDescriptor getPropertyDescriptor(String name) {
305:
306:                Map map = getPropertyDescriptorMap();
307:                if (map != null) {
308:                    return (PropertyDescriptor) map.get(name);
309:                } else {
310:                    return null;
311:                }
312:
313:            }
314:
315:            /**
316:             * <p>Return an array of <code>PropertyDescriptor</code>s for the class
317:             * this <code>DesignInfo</code> is designed to wrap, if possible;
318:             * otherwise, return <code>null</code>.</p>
319:             */
320:            protected PropertyDescriptor[] getPropertyDescriptors() {
321:
322:                try {
323:                    return getBeanInfo().getPropertyDescriptors();
324:                } catch (IntrospectionException e) {
325:                    return null;
326:                }
327:
328:            }
329:
330:            // --------------------------------------------------------- Private Methods
331:
332:            /**
333:             * <p>Cache key for the property descriptor map, cached in the
334:             * <code>BeanDescriptor</code> on first access.</p>
335:             */
336:            private static final String PROPERTY_DESCRIPTOR_MAP = "com.sun.data.provider.PROPERTY_DESCRIPTOR_MAP"; //NOI18N
337:
338:            /**
339:             * <p>Return the <code>Map</code> of <code>PropertyDescriptor</code>s for
340:             * the class this <code>DesignInfo</code> is designed to wrap, if
341:             * possible; otherwise, return <code>null</code>.</p>
342:             */
343:            private Map getPropertyDescriptorMap() {
344:
345:                BeanDescriptor bd = getBeanDescriptor();
346:                if (bd == null) {
347:                    return null;
348:                }
349:                Map map = (Map) bd.getValue(PROPERTY_DESCRIPTOR_MAP);
350:                if (map == null) {
351:                    PropertyDescriptor pd[] = getPropertyDescriptors();
352:                    if (pd == null) {
353:                        return null;
354:                    }
355:                    map = new HashMap(pd.length);
356:                    for (int i = 0; i < pd.length; i++) {
357:                        map.put(pd[i].getName(), pd[i]);
358:                    }
359:                    bd.setValue(PROPERTY_DESCRIPTOR_MAP, map);
360:                }
361:                return map;
362:
363:            }
364:
365:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.