You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by me...@locus.apache.org on 2000/11/16 22:46:31 UTC

cvs commit: jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs BaseBeanInfo.java

metasim     00/11/16 13:46:31

  Modified:    src/antidote/org/apache/tools/ant/gui/acs BaseBeanInfo.java
  Log:
  Added icons to project tree view.
  
  Revision  Changes    Path
  1.3       +22 -2     jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/BaseBeanInfo.java
  
  Index: BaseBeanInfo.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ant/src/antidote/org/apache/tools/ant/gui/acs/BaseBeanInfo.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- BaseBeanInfo.java	2000/11/11 04:52:21	1.2
  +++ BaseBeanInfo.java	2000/11/16 21:46:31	1.3
  @@ -56,25 +56,34 @@
   import org.apache.tools.ant.gui.ResourceManager;
   import org.apache.tools.ant.gui.customizer.DynamicCustomizer;
   import java.beans.*;
  +import javax.swing.ImageIcon;
  +import java.awt.Image;
   
   /**
    * Abstract base class for ACS BeanInfo classes.
    * 
  - * @version $Revision: 1.2 $ 
  + * @version $Revision: 1.3 $ 
    * @author Simeon Fitch 
    */
   abstract class BaseBeanInfo extends SimpleBeanInfo {
       /** Property name for specifiying a sorting order. */
       public static final String SORT_ORDER = DynamicCustomizer.SORT_ORDER;
  -
       /** Resource provider for bean info. */
       private static ResourceManager _resources = new ResourceManager();
   
  +    /** Icon for this. */
  +    private Image _icon = null;
  +
   	/** 
   	 * Default ctor.
   	 * 
   	 */
       protected BaseBeanInfo() {
  +        // Load the icon.
  +        ImageIcon img = _resources.getImageIcon(getClass(), "icon");
  +        if(img != null) {
  +            _icon = img.getImage();
  +        }
       }
   
   	/** 
  @@ -93,6 +102,17 @@
   	 */
       public BeanDescriptor getBeanDescriptor() {
           return new ACSBeanDescriptor(this);
  +    }
  +
  +	/** 
  +	 * Get the icon for displaying this bean.
  +	 * 
  +	 * @param kind Kind of icon. XXX currently ignored
  +	 * @return Image for bean, or null if none.
  +	 */
  +    public Image getIcon(int kind) {
  +        // XXX kind is currently ignored.
  +        return _icon;
       }
   
   	/**