KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > javadoc > comments > JavaDocEditor


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-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.modules.javadoc.comments;
21
22 import java.awt.*;
23 import java.beans.*;
24 import org.openide.util.NbBundle;
25 import org.openide.src.JavaDoc;
26
27 /**
28 * A property editor for JavaDoc the simple version - no extra tags
29 *
30 * @version 0.10, 17 Jun 1998
31 */

32 public final class JavaDocEditor extends PropertyEditorSupport {
33
34     // variables ..................................................................................
35

36     private AutoCommenter.Element element;
37
38 // private JavaDoc javaDoc;
39

40     private JavaDocEditorPanel editorPanel = null;
41
42
43
44     // init .......................................................................................
45

46     public JavaDocEditor(AutoCommenter.Element element) {
47         if (element == null) throw new NullPointerException JavaDoc("element"); // NOI18N
48
this.element = element;
49     }
50
51     // main methods .......................................................................................
52

53     public void setValue (Object JavaDoc object) {
54         if (!(object instanceof JavaDoc))
55             throw new IllegalArgumentException JavaDoc("object: " + object); // NOI18N
56

57         super.setValue(object);
58     }
59
60     public String JavaDoc getAsText () {
61         JavaDoc jd = (JavaDoc) getValue();
62         String JavaDoc v = jd.getRawText();
63         if (v == null) {
64             return ResourceUtils.getBundledString("MSG_javadocCommentValue"); // NOI18N
65
} else {
66             return jd.getText();
67         }
68     }
69
70     public void setAsText (String JavaDoc string) {
71         return;
72     }
73
74     public String JavaDoc getJavaInitializationString () {
75         return null;
76     }
77
78     public String JavaDoc[] getTags () {
79         return null;
80     }
81
82     public boolean isPaintable () {
83         return false;
84     }
85
86     public void paintValue (Graphics g, Rectangle rectangle) {
87     }
88
89     public boolean supportsCustomEditor () {
90         return true;
91     }
92     
93     public Component getCustomEditor () {
94         if (editorPanel == null) {
95             editorPanel = new JavaDocEditorPanel(element, (JavaDoc) getValue());
96             editorPanel.getAccessibleContext().setAccessibleName(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yName")); // NOI18N
97
editorPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yDesc")); // NOI18N
98
}
99         return editorPanel;
100     }
101
102 }
103
Popular Tags