Index: /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponent.java
===================================================================
--- /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponent.java	(revision 927)
+++ /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponent.java	(revision 928)
@@ -142,5 +142,5 @@
      * @param component
      *            component that is searched for
-     * @return corresponding JFComponent instance; null if the compenent is not found
+     * @return corresponding JFComponent instance; null if the component is not found
      */
     public static JFCComponent find(Component component) {
@@ -192,4 +192,11 @@
      */
     private String title = null;
+    
+    /**
+     * <p>
+     * Helper attribute that encodes the source of the title.
+     * </p>
+     */
+    private int titleSource = JFCComponentTitleHierachy.SOURCE_NOT_KNOWN;
 
     /**
@@ -303,4 +310,14 @@
     /**
      * <p>
+     * Returns an integer that encodes the source of the title.
+     * </p>
+     * @return int
+     */
+    public int getTitleSource(){
+    	return titleSource;
+    }
+    
+    /**
+     * <p>
      * Returns an XML representation of the components children.
      * </p>
@@ -363,5 +380,8 @@
      * </p>
      */
-    private void setTitle() {
+    public void setTitle() {
+    	// Note that JFCComponentTitleHierarchy depends on this method. So any changes made
+    	// here should be reflected in JFCComponentTitleHierarchy.
+    	
         title = null; // reset title
 
@@ -369,14 +389,18 @@
         if (accessibleContext != null) {
             title = accessibleContext.getAccessibleName();
+            titleSource = JFCComponentTitleHierachy.ACCESSIBLE_NAME;
         }
         if (title == null) {
             title = icon;
+            titleSource = JFCComponentTitleHierachy.ICON;
         }
         if (title == null) {
             title = component.getName();
+            titleSource = JFCComponentTitleHierachy.NAME;
         }
         if (title == null) {
             // use coordinates as last resort
             title = "Pos(" + component.getX() + "," + component.getY() + ")";
+            titleSource = JFCComponentTitleHierachy.POS;
         }
     }
Index: /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponentTitleHierachy.java
===================================================================
--- /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponentTitleHierachy.java	(revision 928)
+++ /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCComponentTitleHierachy.java	(revision 928)
@@ -0,0 +1,14 @@
+package de.ugoe.cs.autoquest.jfcmonitor;
+
+/**
+ * Class that encodes the source hierarchy for {@link JFCComponent} title.
+ * @author Fabian Glaser
+ *
+ */
+public class JFCComponentTitleHierachy {
+	static final int SOURCE_NOT_KNOWN = 10;
+	static final int ACCESSIBLE_NAME = 1;
+	static final int ICON = 2;
+	static final int NAME = 3;
+	static final int POS = 4;
+}
Index: unk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCNameChangeListener.java
===================================================================
--- /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCNameChangeListener.java	(revision 927)
+++ 	(revision )
@@ -1,84 +1,0 @@
-//   Copyright 2012 Georg-August-Universität Göttingen, Germany
-//
-//   Licensed under the Apache License, Version 2.0 (the "License");
-//   you may not use this file except in compliance with the License.
-//   You may obtain a copy of the License at
-//
-//       http://www.apache.org/licenses/LICENSE-2.0
-//
-//   Unless required by applicable law or agreed to in writing, software
-//   distributed under the License is distributed on an "AS IS" BASIS,
-//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-//   See the License for the specific language governing permissions and
-//   limitations under the License.
-
-package de.ugoe.cs.autoquest.jfcmonitor;
-
-import java.awt.Component;
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import javax.accessibility.AccessibleContext;
-
-import de.ugoe.cs.util.StringTools;
-
-/**
- * <p>
- * Listener that listens on the name change of a component.	
- * </p>
- * @author Fabian Glaser
- * @version 1.0
- */
-public class JFCNameChangeListener implements PropertyChangeListener {
-	 /**
-     * <p>
-     * Writer for logging events.
-     * </p>
-     */
-    final private JFCMonitorOutputWriter outputWriter;
-    
-    /**
-     * <p>
-     * Constructor. Creates a new JFCNameChangeListener with a given 
-     * {@link JFCMonitorOutputWriter}.	
-     * </p>
-     * @param outputWriter
-     */
-    public JFCNameChangeListener(JFCMonitorOutputWriter outputWriter){
-    	this.outputWriter = outputWriter;
-    }
-	
-	@Override
-	public void propertyChange(PropertyChangeEvent evt) {
-		String propertyName = evt.getPropertyName();
-		Component component = null;
-		
-		if (propertyName.equals("AccessibleName")){
-			AccessibleContext context = (AccessibleContext) evt.getSource();
-			component = (Component) context.getAccessibleParent();
-		}
-		
-		if (propertyName.equals("name")){
-			component = (Component) evt.getSource();
-		}
-		
-		if (propertyName.equals("")){
-			
-		}
-		
-		if (component != null){
-			if (!JFCComponent.isKnown(component)){
-				System.err.println("Referenced component is not known");
-				throw new AssertionError("Referenced component is not known.");
-			}
-			StringBuilder builder = new StringBuilder();
-			builder.append("<componentNameChange hash=\"");
-			builder.append(Integer.toHexString(component.hashCode()));
-			builder.append("\" newName=\"" + evt.getNewValue());
-			builder.append("\" source=\"" + propertyName);
-			builder.append("\" />" + StringTools.ENDLINE);
-			outputWriter.write(builder.toString());
-		}
-	}
-	
-}
Index: /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCTitleChangeListener.java
===================================================================
--- /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCTitleChangeListener.java	(revision 928)
+++ /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/JFCTitleChangeListener.java	(revision 928)
@@ -0,0 +1,105 @@
+//   Copyright 2012 Georg-August-Universität Göttingen, Germany
+//
+//   Licensed under the Apache License, Version 2.0 (the "License");
+//   you may not use this file except in compliance with the License.
+//   You may obtain a copy of the License at
+//
+//       http://www.apache.org/licenses/LICENSE-2.0
+//
+//   Unless required by applicable law or agreed to in writing, software
+//   distributed under the License is distributed on an "AS IS" BASIS,
+//   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+//   See the License for the specific language governing permissions and
+//   limitations under the License.
+
+package de.ugoe.cs.autoquest.jfcmonitor;
+
+import java.awt.Component;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import javax.accessibility.AccessibleContext;
+
+import de.ugoe.cs.util.StringTools;
+
+/**
+ * <p>
+ * Listener that listens on the name change of a component.
+ * </p>
+ * 
+ * @author Fabian Glaser
+ * @version 1.0
+ */
+public class JFCTitleChangeListener implements PropertyChangeListener {
+	/**
+	 * <p>
+	 * Writer for logging events.
+	 * </p>
+	 */
+	final private JFCMonitorOutputWriter outputWriter;
+
+	final private boolean CHECK_HIERARCHY = true;
+
+	/**
+	 * <p>
+	 * Constructor. Creates a new JFCNameChangeListener with a given
+	 * {@link JFCMonitorOutputWriter}.
+	 * </p>
+	 * 
+	 * @param outputWriter
+	 */
+	public JFCTitleChangeListener(JFCMonitorOutputWriter outputWriter) {
+		this.outputWriter = outputWriter;
+	}
+
+	@Override
+	public synchronized void propertyChange(PropertyChangeEvent evt) {
+		String propertyName = evt.getPropertyName();
+		Component component = null;
+		int titleSource = JFCComponentTitleHierachy.SOURCE_NOT_KNOWN;
+
+		// Set source component and title source
+		if (propertyName.equals("AccessibleName")) {
+			AccessibleContext context = (AccessibleContext) evt.getSource();
+			component = (Component) context.getAccessibleParent();
+			titleSource = JFCComponentTitleHierachy.ACCESSIBLE_NAME;
+		}
+
+		if (propertyName.equals("name")) {
+			component = (Component) evt.getSource();
+			titleSource = JFCComponentTitleHierachy.NAME;
+		}
+
+		if (propertyName.equals("icon")) {
+			component = (Component) evt.getSource();
+			titleSource = JFCComponentTitleHierachy.ICON;
+		}
+
+		if (propertyName.equals("x") || propertyName.equals("y")) {
+			component = (Component) evt.getSource();
+			titleSource = JFCComponentTitleHierachy.POS;
+		}
+
+		if (component != null) {
+			JFCComponent jfcComponent = JFCComponent.find(component);
+			if (jfcComponent != null) {
+				int oldTitleSource = jfcComponent.getTitleSource();
+				Object newTitle = evt.getNewValue();
+				// We only print the name change message if the new title is as
+				// least as informative as the initial title
+				if ((!CHECK_HIERARCHY || oldTitleSource <= titleSource)) {
+					StringBuilder builder = new StringBuilder();
+					builder.append("<componentNameChange hash=\"");
+					builder.append(Integer.toHexString(component.hashCode()));
+					builder.append("\" newName=\"" + newTitle);
+					builder.append("\" source=\"" + propertyName);
+					builder.append("\" />" + StringTools.ENDLINE);
+					outputWriter.write(builder.toString());
+				}
+			} else {
+				throw new AssertionError("Referenced component is not known.");
+			}
+		}
+	}
+
+}
Index: /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/Runner.java
===================================================================
--- /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/Runner.java	(revision 927)
+++ /trunk/autoquest-jfcmonitor/src/main/java/de/ugoe/cs/autoquest/jfcmonitor/Runner.java	(revision 928)
@@ -78,5 +78,5 @@
         Toolkit.getDefaultToolkit().addAWTEventListener(new JFCWindowMonitor(jfcWriter),
                                                         AWTEvent.WINDOW_EVENT_MASK);
-        JFCComponent.addPropertyChangeListener(new JFCNameChangeListener(jfcWriter));
+        JFCComponent.addPropertyChangeListener(new JFCTitleChangeListener(jfcWriter));
         JFCComponent.addContainerListener(new JFCContainerListener(jfcWriter));
 
@@ -95,5 +95,5 @@
                 Toolkit.getDefaultToolkit().addAWTEventListener(new JFCWindowMonitor(stdJfcWriter),
                         AWTEvent.WINDOW_EVENT_MASK);
-                JFCComponent.addPropertyChangeListener(new JFCNameChangeListener(stdJfcWriter));
+                JFCComponent.addPropertyChangeListener(new JFCTitleChangeListener(stdJfcWriter));
                 JFCComponent.addContainerListener(new JFCContainerListener(stdJfcWriter));
             }
