alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

What this is

This file is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Other links

The source code

/*
 *                 Sun Public License Notice
 * 
 * The contents of this file are subject to the Sun Public License
 * Version 1.0 (the "License"). You may not use this file except in
 * compliance with the License. A copy of the License is available at
 * http://www.sun.com/
 * 
 * The Original Code is NetBeans. The Initial Developer of the Original
 * Code is Sun Microsystems, Inc. Portions Copyright 1997-2004 Sun
 * Microsystems, Inc. All Rights Reserved.
 */

package org.netbeans.modules.javadoc.comments;

import java.awt.*;
import java.beans.*;
import org.openide.util.NbBundle;
import org.openide.src.JavaDoc;

/**
* A property editor for JavaDoc the simple version - no extra tags
*
* @version  0.10, 17 Jun 1998
*/
public final class JavaDocEditor extends PropertyEditorSupport  {

    // variables ..................................................................................

    private AutoCommenter.Element element;

//    private JavaDoc javaDoc;

    private JavaDocEditorPanel editorPanel = null;



    // init .......................................................................................

    public JavaDocEditor(AutoCommenter.Element element) {
        if (element == null) throw new NullPointerException("element"); // NOI18N
        this.element = element;
    }

    // main methods .......................................................................................

    public void setValue (Object object) {
        if (!(object instanceof JavaDoc))
            throw new IllegalArgumentException("object: " + object); // NOI18N
        
        super.setValue(object);
    }

    public String getAsText () {
        JavaDoc jd = (JavaDoc) getValue();
        String v = jd.getRawText();
        if (v == null) {
            return ResourceUtils.getBundledString("MSG_javadocCommentValue");
        } else {
            return jd.getText();
        }
    }

    public void setAsText (String string)  {
        return;
    }

    public String getJavaInitializationString () {
        return null;
    }

    public String[] getTags () {
        return null;
    }

    public boolean isPaintable () {
        return false;
    }

    public void paintValue (Graphics g, Rectangle rectangle) {
    }

    public boolean supportsCustomEditor () {
        return true;
    }
    
    public Component getCustomEditor () {
        if (editorPanel == null) {
            editorPanel = new JavaDocEditorPanel(element, (JavaDoc) getValue());
            editorPanel.getAccessibleContext().setAccessibleName(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yName"));  // NOI18N
            editorPanel.getAccessibleContext().setAccessibleDescription(NbBundle.getBundle(JavaDocEditor.class).getString("ACS_JavaDocEditorPanelA11yDesc"));  // NOI18N
        }
        return editorPanel;
    }

}
... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.