Changeset 853


Ignore:
Timestamp:
10/02/12 11:43:50 (12 years ago)
Author:
fglaser
Message:
  • JFCMonitor now logs component class parents
  • Renamed WindowMonitor? to JFCWindowMonitor
Location:
trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor
Files:
5 edited
1 moved

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} 
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCListener.java

    r850 r853  
    1717 * </p> 
    1818 *  
    19  * @author Steffen Herbold, Fabian Glaser 
     19 * @author Steffen Herbold  
     20 * @author Fabian Glaser 
    2021 * @version 1.0 
    2122 */ 
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCMonitorOutputWriter.java

    r850 r853  
    3838    } 
    3939     
    40     public void write(String str){ 
     40    /** 
     41     * <p> 
     42     * Writes a string to the internal OutputStreamWriter. 
     43     * </p> 
     44     * @param str 
     45     */ 
     46    public synchronized void write(String str){ 
    4147        try { 
    4248                        outputWriter.write(str); 
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCNameChangeListener.java

    r851 r853  
    1313 
    1414/** 
     15 * <p> 
     16 * Listener that listens on the name change of a component.      
     17 * </p> 
    1518 * @author Fabian Glaser 
    16  * 
     19 * @version 1.0 
    1720 */ 
    1821public class JFCNameChangeListener implements PropertyChangeListener { 
     
    2225     * </p> 
    2326     */ 
    24     final private JFCMonitorOutputWriter outputWriter;   
     27    final private JFCMonitorOutputWriter outputWriter; 
    2528     
     29    /** 
     30     * <p> 
     31     * Constructor. Creates a new JFCNameChangeListener with a given  
     32     * {@link JFCMonitorOutputWriter}    
     33     * </p> 
     34     * @param outputWriter 
     35     */ 
    2636    public JFCNameChangeListener(JFCMonitorOutputWriter outputWriter){ 
    2737        this.outputWriter = outputWriter; 
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/JFCWindowMonitor.java

    r852 r853  
    1212 * </p> 
    1313 *  
    14  * @author Steffen Herbold, Fabian Glaser 
     14 * @author Steffen Herbold  
     15 * @author Fabian Glaser 
    1516 * @version 1.0 
    1617 */ 
    17 public class WindowMonitor implements AWTEventListener { 
     18public class JFCWindowMonitor implements AWTEventListener { 
    1819         /** 
    1920     * <p> 
     
    2526    /** 
    2627     * <p> 
    27      * Constructor. Creates a new WindowMonitor with a given {@link JFCMonitorOutputWriter}, where the 
     28     * Constructor. Creates a new JFCWindowMonitor with a given {@link JFCMonitorOutputWriter}, where the 
    2829     * monitored information is logged. 
    2930     * </p> 
     
    3233     *            writer for the logged information 
    3334     */ 
    34     public WindowMonitor(JFCMonitorOutputWriter outputWriter) { 
     35    public JFCWindowMonitor(JFCMonitorOutputWriter outputWriter) { 
    3536        this.outputWriter = outputWriter; 
    3637    } 
  • trunk/quest-jfcmonitor/src/main/java/de/ugoe/cs/quest/jfcmonitor/Runner.java

    r851 r853  
    2020 * </p> 
    2121 *  
    22  * @author Steffen Herbold, Fabian Glaser 
     22 * @author Steffen Herbold 
     23 * @author Fabian Glaser 
    2324 * @version 1.0 
    2425 */ 
     
    6263        Toolkit.getDefaultToolkit().addAWTEventListener(listenerFile, AWTEvent.MOUSE_EVENT_MASK); 
    6364        Toolkit.getDefaultToolkit().addAWTEventListener(listenerFile, FocusEvent.FOCUS_EVENT_MASK); 
    64         Toolkit.getDefaultToolkit().addAWTEventListener(new WindowMonitor(jfcWriter), 
     65        Toolkit.getDefaultToolkit().addAWTEventListener(new JFCWindowMonitor(jfcWriter), 
    6566                                                        AWTEvent.WINDOW_EVENT_MASK); 
    6667        JFCComponent.addPropertyChangeListener(new JFCNameChangeListener(jfcWriter)); 
     68        JFCComponent.addContainerListener(new JFCContainerListener(jfcWriter)); 
    6769 
    6870        if (stdOutputWrite) { 
     
    7880                Toolkit.getDefaultToolkit().addAWTEventListener(listenerStdOut, 
    7981                                                                FocusEvent.FOCUS_EVENT_MASK); 
    80                 Toolkit.getDefaultToolkit().addAWTEventListener(new WindowMonitor(stdJfcWriter), 
     82                Toolkit.getDefaultToolkit().addAWTEventListener(new JFCWindowMonitor(stdJfcWriter), 
    8183                        AWTEvent.WINDOW_EVENT_MASK); 
    8284                JFCComponent.addPropertyChangeListener(new JFCNameChangeListener(stdJfcWriter)); 
Note: See TracChangeset for help on using the changeset viewer.