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.editor.java;

import java.awt.Component;
import javax.swing.ImageIcon;
import org.netbeans.editor.ext.java.JCClass;
import org.netbeans.editor.ext.java.JCConstructor;
import org.netbeans.editor.ext.java.JCExpression;
import org.netbeans.editor.ext.java.JCField;
import org.netbeans.editor.ext.java.JCMethod;
import org.netbeans.editor.ext.java.JCPackage;
import org.netbeans.editor.ext.java.JCPaintComponent;
import org.netbeans.editor.ext.java.JCResultItem;
import org.netbeans.editor.ext.java.JCUtilities;
import org.netbeans.editor.ext.java.JavaCompletion;
import org.openide.util.Utilities;

/**
 *
 * @author  Martin Roskanin
 */
public abstract class NbJCResultItem extends JCResultItem{
    

    
    
    /** Creates a new instance of NbJCResultItem */
    public NbJCResultItem(Object associatedObject) {
        super(associatedObject);
    }
    
    
    public static class NbFieldResultItem extends FieldResultItem{
        
        private JCField fld;
        
        public NbFieldResultItem(JCField fld){
            super(fld);
            this.fld = fld;
        }        

        protected JCPaintComponent.FieldPaintComponent createPaintComponent(){
            return new NbJCPaintComponent.NbFieldPaintComponent();
        }
        
    }
    
    
    public static class NbMethodResultItem extends MethodResultItem{
        
        private JCMethod mtd;
        private JCExpression substituteExp;
        
        public NbMethodResultItem(JCMethod mtd, JCExpression substituteExp){
            super(mtd, substituteExp);
            this.mtd = mtd;
            this.substituteExp = substituteExp;
        }        

        protected JCPaintComponent.ConstructorPaintComponent createPaintComponent(){
            return new NbJCPaintComponent.NbMethodPaintComponent();
        }
        
    }
    
    public static class NbConstructorResultItem extends ConstructorResultItem{
        
        private JCConstructor ctr;
        
        public NbConstructorResultItem(JCConstructor ctr, JCExpression substituteExp){
            super(ctr, substituteExp);
            this.ctr = ctr;
        }

        protected JCPaintComponent.ConstructorPaintComponent createPaintComponent(){
            return new NbJCPaintComponent.NbConstructorPaintComponent();
        }
        
    }
    
    public static class NbPackageResultItem extends PackageResultItem{
        private JCPackage pkg;
        private boolean displayFullPackagePath;
        public NbPackageResultItem(JCPackage pkg, boolean displayFullPackagePath){
            super(pkg, displayFullPackagePath);
            this.pkg = pkg;
            this.displayFullPackagePath = displayFullPackagePath;
        }
        
        protected JCPaintComponent.PackagePaintComponent createPaintComponent(){
            return new NbJCPaintComponent.NbPackagePaintComponent();
        }

    }
    
    public static class NbClassResultItem extends ClassResultItem{
        private JCClass cls;
        private boolean displayFQN;
        public NbClassResultItem(JCClass cls, boolean displayFQN){
            this(cls, 0, displayFQN);
        }
        
        public NbClassResultItem(JCClass cls, int classDisplayOffset, boolean displayFQN){
            super(cls, classDisplayOffset, displayFQN);
            this.cls = cls;
            this.displayFQN = displayFQN;
        }

        protected JCPaintComponent.InterfacePaintComponent createInterfacePaintComponent(){
            return new NbJCPaintComponent.NbInterfacePaintComponent();
        }
        
        protected JCPaintComponent.ClassPaintComponent createClassPaintComponent(){
            return new NbJCPaintComponent.NbClassPaintComponent();
        }
        
    }
}
... 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.