Ignore:
Timestamp:
10/02/12 11:43:50 (12 years ago)
Author:
fglaser
Message:
  • JFCMonitor now logs component class parents
  • Renamed WindowMonitor? to JFCWindowMonitor
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCComponent.java

    r851 r853  
    2626 * </p> 
    2727 *  
    28  * @author Steffen Herbold, Fabian Glaser 
     28 * @author Steffen Herbold  
     29 * @author Fabian Glaser 
    2930 * @version 1.0 
    3031 */ 
     
    4445     * </p> 
    4546     */ 
    46      
    4747    private static List<PropertyChangeListener> propertyChangeListeners =  
    4848        new ArrayList<PropertyChangeListener>(); 
    4949     
     50    /** 
     51     * <p> 
     52     * List of ContainerListeners that are registered on the components. 
     53     * </p> 
     54     */ 
    5055    private static List<ContainerListener> containerListeners = 
    5156                new ArrayList<ContainerListener>(); 
     
    6469    } 
    6570     
     71    /** 
     72     * <p> 
     73     * Adds a new PropertyChangeListener to the components. 
     74     * </p>  
     75     * @param list  
     76     *                  the PropertyChangeListener 
     77     */ 
    6678    public static void addPropertyChangeListener(PropertyChangeListener list){ 
    6779        propertyChangeListeners.add(list); 
    6880    } 
    6981     
     82    /** 
     83     * <p>  
     84     * Adds a new ContainerListener to the components. 
     85     * </p>  
     86     * @param list 
     87     *                  the ContainerListener 
     88     */ 
    7089    public static void addContainerListener(ContainerListener list){ 
    7190        containerListeners.add(list); 
    7291    } 
    7392     
     93    /** 
     94     * <p> 
     95     * Tests if a component is already known. 
     96     * </p> 
     97     * @param component to be tested 
     98     * @return true, if component is already known, false otherwise. 
     99     */ 
    74100    public static boolean isKnown(Component component){ 
    75101        if (knownComponents.containsKey(component)) 
     
    238264        setTitle(); 
    239265        StringBuilder builder = new StringBuilder(); 
    240         builder.append("  <component"); 
     266        builder.append("<component"); 
    241267        if (parent != null){ 
    242268                if (!JFCComponent.isKnown(parent.component)) 
     
    245271        } 
    246272        builder.append(">"+ StringTools.ENDLINE); 
    247         builder.append("   <param name=\"title\" value=\"" + title + "\" />" + StringTools.ENDLINE); 
    248         builder.append("   <param name=\"class\" value=\"" + componentClass + "\" />" + 
     273        builder.append(" <param name=\"title\" value=\"" + title + "\" />" + StringTools.ENDLINE); 
     274        builder.append(" <param name=\"class\" value=\"" + componentClass + "\" />" + 
    249275            StringTools.ENDLINE); 
    250         builder.append("   <param name=\"icon\" value=\"" + icon + "\" />" + StringTools.ENDLINE); 
    251         builder.append("   <param name=\"index\" value=\"" + index + "\" />" + StringTools.ENDLINE); 
    252         builder.append("   <param name=\"hash\" value=\"" + 
     276        builder.append(" <param name=\"icon\" value=\"" + icon + "\" />" + StringTools.ENDLINE); 
     277        builder.append(" <param name=\"index\" value=\"" + index + "\" />" + StringTools.ENDLINE); 
     278        builder.append(" <param name=\"hash\" value=\"" + 
    253279            Integer.toHexString(component.hashCode()) + "\" />" + StringTools.ENDLINE); 
    254         builder.append("  </component>" + StringTools.ENDLINE); 
     280        builder.append(getInheritanceTree()); 
     281        builder.append("</component>" + StringTools.ENDLINE); 
    255282        return builder.toString(); 
    256283    } 
     
    392419        } 
    393420    } 
     421     
     422    /** 
     423     * <p> 
     424     * Constructs a string that represents inheritance of component. 
     425     * </p> 
     426     * @return 
     427     */ 
     428    private String getInheritanceTree(){ 
     429        StringBuilder builder = new StringBuilder(); 
     430        Class<? extends Object> classobject = component.getClass(); 
     431        while(classobject.getSuperclass() != null){ 
     432                classobject = classobject.getSuperclass(); 
     433                builder.append(" <ancestor name=\""); 
     434                builder.append(classobject.getName()); 
     435                builder.append("\" />" + StringTools.ENDLINE); 
     436        } 
     437        return builder.toString(); 
     438    } 
    394439} 
Note: See TracChangeset for help on using the changeset viewer.