KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > wsdl > ui > api > property > ElementOrTypeOrMessagePartPropertyEditor


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  * Created on May 16, 2005
22  *
23  * To change the template for this generated file go to
24  * Window - Preferences - Java - Code Generation - Code and Comments
25  */

26 package org.netbeans.modules.xml.wsdl.ui.api.property;
27
28 import java.awt.Component JavaDoc;
29 import java.beans.FeatureDescriptor JavaDoc;
30 import java.beans.PropertyChangeEvent JavaDoc;
31 import java.beans.PropertyChangeListener JavaDoc;
32 import java.beans.PropertyEditorSupport JavaDoc;
33
34 import org.netbeans.modules.xml.xam.ui.XAMUtils;
35 import org.openide.explorer.propertysheet.ExPropertyEditor;
36 import org.openide.explorer.propertysheet.PropertyEnv;
37
38
39
40 /**
41  * @author radval
42  *
43  * To change the template for this generated type comment go to
44  * Window - Preferences - Java - Code Generation - Code and Comments
45  */

46 public class ElementOrTypeOrMessagePartPropertyEditor extends PropertyEditorSupport JavaDoc
47 implements ExPropertyEditor, PropertyChangeListener JavaDoc {
48
49     /** property name used by propertyChangeEvent */
50     static final String JavaDoc PROP_NAME = "ElementOrType";//NOI18N
51

52     /** Environment passed to the ExPropertyEditor*/
53     private PropertyEnv mEnv;
54     
55     private ElementOrTypeOrMessagePartProvider mElementOrTypeOrMessagePartProvider;
56     
57     
58     public ElementOrTypeOrMessagePartPropertyEditor(ElementOrTypeOrMessagePartProvider elementOrTypeProvider) {
59         this.mElementOrTypeOrMessagePartProvider = elementOrTypeProvider;
60     }
61     
62     /**
63      * This method is called by the IDE to pass
64      * the environment to the property editor.
65      * @param env Environment passed by the ide.
66      */

67     public void attachEnv(PropertyEnv env) {
68         this.mEnv = env;
69         FeatureDescriptor JavaDoc desc = env.getFeatureDescriptor();
70         // make this is not editable
71
desc.setValue("canEditAsText", Boolean.FALSE); // NOI18N
72
}
73     
74     
75     
76     
77     /** @return tags */
78     @Override JavaDoc
79     public String JavaDoc[] getTags() {
80         return null;
81     }
82     
83     /** @return true */
84     @Override JavaDoc
85     public boolean supportsCustomEditor () {
86         return XAMUtils.isWritable(mElementOrTypeOrMessagePartProvider.getModel());
87     }
88     
89     /** @return editor component */
90     @Override JavaDoc
91     public Component JavaDoc getCustomEditor () {
92         ElementOrTypeOrMessagePartPropertyPanel editor = new ElementOrTypeOrMessagePartPropertyPanel(mElementOrTypeOrMessagePartProvider, this.mEnv);
93         editor.addPropertyChangeListener(PROP_NAME, this);
94         return editor;
95     }
96     /** handles property change
97      *
98      * @param evt propertyChangeEvent
99      */

100     public void propertyChange(PropertyChangeEvent JavaDoc evt) {
101         setValue(evt.getNewValue());
102     }
103 }
104
105
106
Popular Tags