KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > schema > ui > nodes > schema > properties > GlobalReferenceProperty


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 /*
21  * GlobalReferenceProperty.java
22  *
23  * Created on January 5, 2006, 3:21 PM
24  *
25  */

26
27 package org.netbeans.modules.xml.schema.ui.nodes.schema.properties;
28
29 import org.netbeans.modules.xml.schema.model.ReferenceableSchemaComponent;
30 import org.netbeans.modules.xml.schema.model.SchemaComponent;
31 import org.netbeans.modules.xml.schema.ui.basic.editors.GlobalReferenceEditor;
32 import org.netbeans.modules.xml.xam.dom.NamedComponentReference;
33
34 /**
35  * This class provides property support for properties having global references.
36  * @author Ajit Bhate
37  */

38 public class GlobalReferenceProperty<T extends ReferenceableSchemaComponent>
39         extends BaseSchemaProperty {
40     
41     private Class JavaDoc<T> referenceType;
42     private String JavaDoc typeDisplayName;
43
44     /**
45      * Creates a new instance of GlobalReferenceProperty.
46      *
47      *
48      * @param component The schema component which property belongs to.
49      * @param property The property name.
50      * @param propDispName The display name of the property.
51      * @param propDesc Short description about the property.
52      * @param isPrimitive distinguish between int and Integer. temporary property
53      * Assumes that the property editor is default editor for Integer.
54      * If special editor needed, subclasses and instances must set it explicitly.
55      * @throws java.lang.NoSuchMethodException If no getter and setter for the property are found
56      */

57     public GlobalReferenceProperty(SchemaComponent component,
58             String JavaDoc property, String JavaDoc dispName, String JavaDoc desc,
59             String JavaDoc typeDisplayName, String JavaDoc referenceTypeDisplayName,
60             Class JavaDoc<T> referenceType)
61             throws NoSuchMethodException JavaDoc {
62             super(component,NamedComponentReference.class,property,dispName,desc,null);
63         this.referenceType = referenceType;
64         this.typeDisplayName = typeDisplayName;
65     }
66     
67     /**
68      * This api determines if this property supports resetting default value.
69      * Overriden to return false always.
70      * Subclasses can override if different behaviour expected.
71      */

72     @Override JavaDoc
73     public boolean supportsDefaultValue () {
74         return false;
75     }
76
77     /**
78      * This method returns the property editor.
79      * Overridden to return special editor.
80      */

81     @Override JavaDoc
82     public java.beans.PropertyEditor JavaDoc getPropertyEditor() {
83         return new GlobalReferenceEditor<T>(super.getComponent(), typeDisplayName,
84                 getDisplayName(),referenceType);
85     }
86     
87 }
88
Popular Tags