Webclient 2.0 status, ready to proceed with new development
"edburns" <[email protected]>
| Newsgroups | gmane.comp.mozilla.devel.java |
|---|---|
| Organization | http://groups.google.com |
| Message-ID | <[email protected]> |
Still trying to debug the mystery of why event listeners added via DOM
don't get fired. Posted to n.p.m.embedding. Here's a checkpoint diff.
Index: webclient/build-tests.xml
===================================================================
RCS file: /cvsroot/mozilla/java/webclient/build-tests.xml,v
retrieving revision 1.29
diff -u -r1.29 build-tests.xml
--- webclient/build-tests.xml 9 Aug 2005 04:43:00 -0000 1.29
+++ webclient/build-tests.xml 9 Aug 2005 06:52:17 -0000
@@ -161,6 +161,7 @@
<classpath refid="test.classpath"/>
<formatter type="plain" usefile="false"/>
+ <!--
<test
name="org.mozilla.webclient.BrowserControlFactoryTest"/>
<test name="org.mozilla.webclient.ProfileManagerTest"/>
<test name="org.mozilla.webclient.BookmarksTest"/>
@@ -173,8 +174,11 @@
<test name="org.mozilla.webclient.KeyListenerTest"/>
<test
name="org.mozilla.webclient.DocumentLoadListenerTest"/>
<test name="org.mozilla.webclient.WindowCreatorTest"/>
+ -->
<test name="org.mozilla.webclient.DOMTest"/>
+ <!--
<test name="org.mozilla.webclient.CurrentPageTest"/>
+ -->
<!-- non running
<test
name="org.mozilla.webclient.wrapper_native.gtk.TestGtkBrowserControlCanvas"/>
-->
Index:
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java
===================================================================
RCS file:
/cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java,v
retrieving revision 1.14
diff -u -r1.14 EventRegistrationImpl.java
---
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java 18
Jan 2005 15:20:51 -0000 1.14
+++
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/EventRegistrationImpl.java 9
Aug 2005 06:52:17 -0000
@@ -169,6 +169,12 @@
}
}
+public void pushRunnable(Runnable runnable) {
+
+ NativeEventThread.instance.pushRunnable(runnable);
+
+}
+
public void removeDocumentLoadListener(DocumentLoadListener listener)
{
ParameterCheck.nonNull(listener);
Index:
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java
===================================================================
RCS file:
/cvsroot/mozilla/java/webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java,v
retrieving revision 1.1
diff -u -r1.1 RDFTreeNode.java
---
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java 28
Sep 2003 06:29:07 -0000 1.1
+++
webclient/classes_spec/org/mozilla/webclient/impl/wrapper_native/RDFTreeNode.java 9
Aug 2005 06:52:18 -0000
@@ -150,11 +150,11 @@
public Enumeration children()
{
Assert.assert_it(-1 != nativeRDFNode);
- Enumeration enum = null;
+ Enumeration enumer = null;
- enum = new RDFEnumeration(nativeContext, this);
+ enumer = new RDFEnumeration(nativeContext, this);
- return enum;
+ return enumer;
}
public boolean getAllowsChildren()
Index:
webclient/test/automated/src/classes/org/mozilla/webclient/DOMTest.java
===================================================================
RCS file:
/cvsroot/mozilla/java/webclient/test/automated/src/classes/org/mozilla/webclient/DOMTest.java,v
retrieving revision 1.2
diff -u -r1.2 DOMTest.java
---
webclient/test/automated/src/classes/org/mozilla/webclient/DOMTest.java 14
Feb 2005 02:16:18 -0000 1.2
+++
webclient/test/automated/src/classes/org/mozilla/webclient/DOMTest.java 9
Aug 2005 06:52:19 -0000
@@ -29,17 +29,16 @@
import junit.framework.Test;
import junit.framework.TestSuite;
-import java.util.Enumeration;
-
import java.awt.Frame;
import java.awt.BorderLayout;
import java.awt.Robot;
-
-import java.io.File;
-import java.io.FileInputStream;
+import java.awt.event.InputEvent;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
+import org.w3c.dom.events.Event;
+import org.w3c.dom.events.EventListener;
+import org.w3c.dom.events.EventTarget;
// DOMTest.java
@@ -68,6 +67,12 @@
//
// Constants
//
+
+ static final int IN_X = 20;
+ static final int IN_Y = 117;
+
+ static final int OUT_X = 700;
+ static final int OUT_Y = 500;
//
// Testcases
@@ -132,6 +137,38 @@
assertEquals(1, node.getNodeType());
node = node.getFirstChild();
assertEquals("next", node.getNodeValue());
+
+ assertTrue(node instanceof EventTarget);
+ final EventTarget target = (EventTarget) node;
+ final EventListener domListener = new EventListener() {
+ public void handleEvent(Event event) {
+ System.out.println("got event:" + event.toString());
+ }
+ };
+ Runnable runnable = new Runnable() {
+ public void run() {
+ target.addEventListener("mouseover", domListener,
+ true);
+ }
+ };
+
((org.mozilla.webclient.impl.wrapper_native.EventRegistrationImpl)eventRegistration).pushRunnable(runnable);
+
+ /*********
+ Robot robot = new Robot();
+
+ robot.mouseMove(IN_X, IN_Y);
+ robot.mousePress(InputEvent.BUTTON1_MASK);
+ robot.mouseRelease(InputEvent.BUTTON1_MASK);
+*************/
+
+ MouseListenerTest.keepWaiting = true;
+ while (MouseListenerTest.keepWaiting) {
+ Thread.currentThread().sleep(1000);
+ }
+
+ /*****
+ robot.mouseMove(OUT_X, OUT_Y);
+******/
frame.setVisible(false);
BrowserControlFactory.deleteBrowserControl(firstBrowserControl);