Clover coverage report - clover
Coverage timestamp: Sat Oct 8 2005 22:54:17 EDT
file stats: LOC: 38   Methods: 1
NCLOC: 33   Classes: 1
 
 Source file Conditionals Statements Methods TOTAL
ComponentTreeIcons.java 66.7% 93.8% 100% 82.8%
coverage coverage
 1   
 package abbot.editor;
 2   
 
 3   
 import java.awt.Component;
 4   
 import javax.swing.*;
 5   
 import java.util.*;
 6   
 import java.net.URL;
 7   
 
 8   
 /** Provides JTree icons for different Components. */
 9   
 
 10   
 class ComponentTreeIcons {
 11   
     private Map icons = new HashMap();
 12  145
     public Icon getIcon(Class cls) {
 13  145
         String className = cls.getName();
 14  145
         int lastdot = className.lastIndexOf(".");
 15  145
         String simpleName = lastdot != -1
 16   
             ? className.substring(lastdot+1).toLowerCase() : className;
 17  145
         Icon icon = (Icon)icons.get(className);
 18  145
         if (icon == null) {
 19  29
             URL url = getClass().getResource("icons/" + className + ".gif");
 20  29
             if (url == null) {
 21  29
                 url = getClass().getResource("icons/" + simpleName + ".gif");
 22   
             }
 23  29
             if (url == null) {
 24  10
                 if (Component.class.equals(cls))
 25  0
                     return null;
 26  10
                 icon = getIcon(cls.getSuperclass());
 27   
             }
 28   
             else {
 29  19
                 icon = new ImageIcon(url);
 30   
             }
 31  29
             if (icon != null) {
 32  29
                 icons.put(className, icon);
 33   
             }
 34   
         }
 35  145
         return icon;
 36   
     }
 37   
 }
 38