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

package org.openide.loaders;

import java.awt.Component;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.beans.PropertyChangeListener;
import java.beans.PropertyEditor;
import org.openide.ErrorManager;
import org.openide.explorer.propertysheet.ExPropertyEditor;
import org.openide.explorer.propertysheet.PropertyEnv;
import org.openide.util.Lookup;

/** Property editor for {@link org.openide.loaders.ExtensionList}s.
*
* @see org.openide.loaders.ExtensionList
*
* @deprecated Should not be used directly (property editor search path will find it).
*/
public class ExtensionListEditor implements PropertyEditor, ExPropertyEditor {
    
    private PropertyEditor delegate1;
    private ExPropertyEditor delegate2;
    
    public ExtensionListEditor() {
        try {
            ClassLoader l = (ClassLoader)Lookup.getDefault().lookup(ClassLoader.class);
            Class c = Class.forName("org.netbeans.beaninfo.editors.ExtensionListEditor", true, l); // NOI18N
            Object o = c.newInstance();
            delegate1 = (PropertyEditor)o;
            if (o instanceof ExPropertyEditor) {
                delegate2 = (ExPropertyEditor)o;
            }
        } catch (Exception e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        } catch (LinkageError e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    
    public void addPropertyChangeListener(PropertyChangeListener listener) {
        if (delegate1 != null) {
            delegate1.addPropertyChangeListener(listener);
        }
    }
    
    public String getAsText() {
        if (delegate1 != null) {
            return delegate1.getAsText();
        } else {
            return null;
        }
    }
    
    public Component getCustomEditor() {
        if (delegate1 != null) {
            return delegate1.getCustomEditor();
        } else {
            return null;
        }
    }
    
    public String getJavaInitializationString() {
        if (delegate1 != null) {
            return delegate1.getJavaInitializationString();
        } else {
            return null;
        }
    }
    
    public String[] getTags() {
        if (delegate1 != null) {
            return delegate1.getTags();
        } else {
            return null;
        }
    }
    
    public Object getValue() {
        if (delegate1 != null) {
            return delegate1.getValue();
        } else {
            return null;
        }
    }
    
    public boolean isPaintable() {
        if (delegate1 != null) {
            return delegate1.isPaintable();
        } else {
            return false;
        }
    }
    
    public void paintValue(Graphics gfx, Rectangle box) {
        if (delegate1 != null) {
            delegate1.paintValue(gfx, box);
        }
    }
    
    public void removePropertyChangeListener(PropertyChangeListener listener) {
        if (delegate1 != null) {
            delegate1.removePropertyChangeListener(listener);
        }
    }
    
    public void setAsText(String text) throws IllegalArgumentException {
        if (delegate1 != null) {
            delegate1.setAsText(text);
        } else {
            throw new IllegalArgumentException();
        }
    }
    
    public void setValue(Object value) {
        if (delegate1 != null) {
            delegate1.setValue(value);
        }
    }
    
    public boolean supportsCustomEditor() {
        if (delegate1 != null) {
            return delegate1.supportsCustomEditor();
        } else {
            return false;
        }
    }
    
    public void attachEnv(PropertyEnv env) {
        if (delegate2 != null) {
            delegate2.attachEnv(env);
        }
    }
    
}
... 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.