-
FEATURED COMPONENTS
First time here? Check out the FAQ!
test.zul
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"> <window id = "test" border="normal" sizable="true" maximizable="true" use="ui.TestWindow" > <script src="http://maps.google.com/maps?file=api&v=2&key=<<MY_KEY>>" type="text/javascript"></script> <button id="btnDoOverlapped" label="doOverlapped" /> <button id="btnSendRedirect" label="sendRedirect" /> </window> </zk>
ui.TestWindow.java
package ui; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Button; import org.zkoss.zul.Window; @SuppressWarnings("serial") public class TestWindow extends Window { public void onCreate() { // Button b = (Button) getFellow("btnDoOverlapped"); EventListener myListener = new DoOverlappedEventListener(); b.addEventListener(Events.ON_CLICK, myListener); // b = (Button) getFellow("btnSendRedirect"); myListener = new sendRedirectEventListener(); b.addEventListener(Events.ON_CLICK, myListener); } public class DoOverlappedEventListener implements EventListener { public boolean isAsap() { return true; } public void onEvent(Event event) { Component comp = (Component) Executions.createComponents("test2.zul", null, null); Window window = (Window)comp.getFellow("test2"); window.doOverlapped(); } } public class sendRedirectEventListener implements EventListener { public boolean isAsap() { return true; } public void onEvent(Event event) { Executions.sendRedirect("test2.zul"); } } }
test2.zul
<zk xmlns="http://www.zkoss.org/2005/zul" xmlns:h="http://www.w3.org/1999/xhtml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.zkoss.org/2005/zul http://www.zkoss.org/2005/zul/zul.xsd"> <window id="test2" border="normal" width="100%" height="100%" sizable="true" maximizable="true" > <script src="http://maps.google.com/maps?file=api&v=2&key=<<MY_KEY>>" type="text/javascript"></script> <gmaps id="gmapDetail" width="500px" height="400px" showSmallCtrl="true" showTypeCtrl="true" lat="48" lng="11" zoom="17"/> <button id="btn" label="open" /> </window> </zk>
I narrowed down the problem to following code... still fail in Firefox.
<zk> <window id="test3" border="normal" width="500px" height="400px" > <script src="http://maps.google.com/maps?file=api&v=2&key=<<MY_KEY>>" type="text/javascript"> </script> <gmaps id="gmapDetail" width="300px" height="300px"/> </window> <button id="btn" label="overlapped"> <attribute name="onClick"> test3.doOverlapped(); </attribute> </button> </zk>
Please post to bug list, http://sourceforge.net/tracker/?group_id=152762&atid=785191, thanks.
I postedt it with Request-ID 2705656.
Thanks kindalu for narrowing down the problem.
It came up that it is'nt a bug:
Move the google script "OUT" of the window. Calling overlapped will cause
"redraw" of the window component and thus the google script inside the
window will be "evaluate" agaiin. Google maps does not expect that and
thing went wrong.
The following code shall work correctly.
-------------
<zk>
<script
src="http://maps.google.com/maps?file=api&v=2&key=<<MY_KEY>>"
type="text/javascript">
</script>
<window id="test3" border="normal" width="500px" height="400px" >
<gmaps id="gmapDetail" width="300px" height="300px"/>
</window>
<button id="btn" label="overlapped">
<attribute name="onClick">
test3.doOverlapped();
</attribute>
</button>
</zk>
Great Thanks henrichen!
Asked: 2009-03-20 08:25:28 +0800
Seen: 246 times
Last updated: Apr 11 '09