Index: trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/gui/MouseClickCondenser.java
===================================================================
--- trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/gui/MouseClickCondenser.java	(revision 948)
+++ trunk/autoquest-core-events/src/main/java/de/ugoe/cs/autoquest/eventcore/gui/MouseClickCondenser.java	(revision 957)
@@ -24,8 +24,13 @@
  * <p>
  * This class condenses mouse clicks, i.e. it reduces a sequence of mouse button down, mouse button
- * up and mouse click with the same button on the same event target to a single mouse click with
- * that button on that target. The mouse button down and mouse button up events are discarded. For
- * this, it iterates the provided sequence and identifies any match of the named event sequence
- * pattern. This match is condensed to the mouse click event.
+ * up and possibly a subsequent mouse click with the same button on the same event target and the
+ * same coordinates to a single mouse click with that button on that target at the coordinates.
+ * The mouse button down and mouse button up events are discarded. For this, it iterates the
+ * provided sequence and identifies any match of the named event sequence pattern. This match is
+ * condensed to the mouse click event.
+ * </p>
+ * <p>
+ * This class does not create events of proper type if the events are not of type {@link Event}
+ * but derived from it.
  * </p>
  * TODO correctly identify drag and drop
@@ -54,18 +59,33 @@
 
         int index = 0;
-        while (index < sequence.size()) // -2 because we don't need to go to the end
+        boolean mouseClickHandled;
+        while (index < sequence.size())
         {
-            if ((index + 2) < sequence.size()) {
-                Event mouseButtonDown = sequence.get(index);
-                Event mouseButtonUp = sequence.get(index + 1);
-                Event mouseClick = sequence.get(index + 2);
-                if (mouseClickSequenceFound(mouseButtonDown, mouseButtonUp, mouseClick)) {
-                    // skip the mouse button down and mouse button up event
+            mouseClickHandled = false;
+            if ((index + 1) < sequence.size()) {
+                Event mbDown = sequence.get(index);
+                Event mbUp = sequence.get(index + 1);
+                
+                if (((index + 2) < sequence.size()) &&
+                    mouseClickSequenceFound(mbDown, mbUp, sequence.get(index + 2)))
+                {
+                    // skip the mouse button down and mouse button up event and add the mouse click
                     index += 2;
+                    resultingSequence.add(sequence.get(index));
+                    index++;
+                    mouseClickHandled = true;
+                }
+                else if (mouseClickSequenceFound(mbDown, mbUp)) {
+                    // skip the mouse button down and mouse button up event and add a mouse click
+                    index += 2;
+                    resultingSequence.add(createClick(mbDown, mbUp));
+                    mouseClickHandled = true;
                 }
             }
 
-            resultingSequence.add(sequence.get(index));
-            index++;
+            if (!mouseClickHandled) {
+                resultingSequence.add(sequence.get(index));
+                index++;
+            }
         }
 
@@ -79,4 +99,47 @@
                                             Event mouseButtonUp,
                                             Event mouseClick)
+    {
+        if (!mouseClickSequenceFound(mouseButtonDown, mouseButtonUp)) {
+            return false;
+        }
+        
+        // check the third node for validity
+        if (!(mouseClick.getType() instanceof MouseClick)) {
+            return false;
+        }
+
+        IEventTarget eventTarget = mouseButtonDown.getTarget();
+
+        if (!eventTarget.equals(mouseClick.getTarget())) {
+            return false;
+        }
+
+        MouseButtonInteraction.Button button =
+            ((MouseButtonDown) mouseButtonDown.getType()).getButton();
+
+        if (!button.equals(((MouseClick) mouseClick.getType()).getButton())) {
+            return false;
+        }
+
+        int x = ((MouseButtonDown) mouseButtonDown.getType()).getX();
+
+        if (x != ((MouseClick) mouseClick.getType()).getX()) {
+            return false;
+        }
+        
+        int y = ((MouseButtonDown) mouseButtonDown.getType()).getY();
+
+        if (y != ((MouseClick) mouseClick.getType()).getY()) {
+            return false;
+        }
+        
+        return true;
+    }
+
+    /**
+     * 
+     */
+    private boolean mouseClickSequenceFound(Event mouseButtonDown,
+                                            Event mouseButtonUp)
     {
         // check the first in a row of three for validity
@@ -103,19 +166,31 @@
         }
 
-        // check the third node for validity
-        if (!(mouseClick.getType() instanceof MouseClick)) {
+        int x = ((MouseButtonDown) mouseButtonDown.getType()).getX();
+
+        if (x != ((MouseButtonUp) mouseButtonUp.getType()).getX()) {
             return false;
         }
+        
+        int y = ((MouseButtonDown) mouseButtonDown.getType()).getY();
 
-        if (!eventTarget.equals(mouseClick.getTarget())) {
+        if (y != ((MouseButtonUp) mouseButtonUp.getType()).getY()) {
             return false;
         }
-
-        if (!button.equals(((MouseClick) mouseClick.getType()).getButton())) {
-            return false;
-        }
-
+        
         return true;
     }
 
+    /**
+     *
+     */
+    private Event createClick(Event mouseButtonDown, Event mouseButtonUp) {
+        MouseButtonInteraction.Button button =
+            ((MouseButtonDown) mouseButtonDown.getType()).getButton();
+        
+        int x = ((MouseButtonDown) mouseButtonDown.getType()).getX();
+        int y = ((MouseButtonDown) mouseButtonDown.getType()).getY();
+
+        return new Event(new MouseClick(button, x, y), mouseButtonDown.getTarget());
+    }
+
 }
