0

doOverlapped with gmaps doesn't work in firefox - do i something wrong or is it a bug?

asked 2009-03-20 08:25:28 +0800

beginner gravatar image beginner
123 2

updated 2009-03-20 08:28:32 +0800

Hello, i want to open a window with Google Maps on it via window.doOverlapped. This only works for me in Internet-Explorer and i also recognized it works in Safari. But it doesn't work in FireFox. Do i something wrong by realizing it? Is there a simple Workaround to fix the problem? i made an simple example to demonstrate my problem:
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 currently use ZK 3.5.2 Thanks!
delete flag offensive retag edit

4 Replies

Sort by ยป oldest newest

answered 2009-03-20 10:52:34 +0800

kindalu gravatar image kindalu
255

updated 2009-03-20 10:53:19 +0800

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>

link publish delete flag offensive edit

answered 2009-03-23 02:11:56 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

Please post to bug list, http://sourceforge.net/tracker/?group_id=152762&atid=785191, thanks.

link publish delete flag offensive edit

answered 2009-03-23 09:41:36 +0800

beginner gravatar image beginner
123 2

updated 2009-03-23 09:42:06 +0800

I postedt it with Request-ID 2705656.

Thanks kindalu for narrowing down the problem.

link publish delete flag offensive edit

answered 2009-04-11 08:47:16 +0800

beginner gravatar image beginner
123 2

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!

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-03-20 08:25:28 +0800

Seen: 246 times

Last updated: Apr 11 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More