gwt-maps-1.0.4.jar and gwt-user-1.5.3

13 views
Skip to first unread message

everlongh

unread,
Jun 16, 2009, 4:07:57 PM6/16/09
to Google Web Toolkit
I noticed a dependancy between the new gwt-maps and gwt-1.5.3.

I am having some issues with my maps application using the new
jars...original code works fine with gwt-maps-1.0.2 and gwt-1.5.3...

Here one exception I get with no code changes:



link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
// remoteService.remoteMethod("Hi Server", callback);
final Widget sender = (Widget) event.getSource();
if (sender instanceof Hyperlink) {

final Hyperlink link = ((Hyperlink) sender);

System.out.println("Polling link ="
+ link.getTargetHistoryToken());

link.setText("Polling...");

final String key = link.getTargetHistoryToken();
// int index = html.indexOf("?");
// final String key = html.substring(index);

// link.setHTML("Polling site...");

Timer t = new Timer() {
public void run() {

// Window.alert("Site "+key+" ATG's could not be reached.");
// Window.alert("Site ATG's could not be reached.");
TankInventoryVO[] tivos = inventoryVOMap.get(key);

for (int x = 0; x < tivos.length; x++) {
TankInventoryVO tivo = tivos[x];

DateTimeFormat formatter;
formatter = DateTimeFormat
.getFormat("yyyy.MM.ddHH:mm:ss");

Date date = new Date(System.currentTimeMillis());

String dt = formatter.format(date);
tivo.setInventoryDateTime(dt);
// tivo.setInventoryDateTime("2009-03-04 12:15:00");

double volume = tivo.getInventoryVolume();
volume = volume - Random.nextInt(100);

tivo.setInventoryVolume(Float.parseFloat(Double
.toString(volume)));
tivo.setVolumeUom("gal");
String divId = key + "-TankInventory-" + x;
System.out.println("Updating panel for "
+ divId);
RootPanel.get(divId).getElement().setInnerHTML(
getTankInventoryForMapTree(tivo));
}

link.setHTML("Poll Now");

}
};
t.schedule(5000);

}


}
});


Eric Ayers

unread,
Jun 17, 2009, 10:16:53 AM6/17/09
to Google-We...@googlegroups.com
Hi,

I see your code, but I don't see any code in gwt-maps being called (at
least, not directly) and I am not sure what exception you are
referring to.
--
Eric Z. Ayers - GWT Team - Atlanta, GA USA
http://code.google.com/webtoolkit/

everlongh

unread,
Jun 22, 2009, 6:09:46 PM6/22/09
to Google Web Toolkit
Sorry, I thought I had included the exception... here it is below, it
occurs on the line

RootPanel.get(divId).getElement().setInnerHTML(

getTankInventoryForMapTree(tivo));

The link in the code is inside a gwt-,maps InfoWindow

link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {

I do not get the excpetion with gwt-1.5.3.

[ERROR] A widget that has an existing parent widget may not be added
to the detach list
java.lang.AssertionError: A widget that has an existing parent widget
may not be added to the detach list
at com.google.gwt.user.client.ui.RootPanel.detachOnWindowClose
(RootPanel.java:122)
at com.google.gwt.user.client.ui.RootPanel.get(RootPanel.java:197)
at com.fuelquest.darkstar.client.DarkStar$14$1.run(DarkStar.java:
1062)
at com.google.gwt.user.client.Timer.fireImpl(Timer.java:160)
at com.google.gwt.user.client.Timer.fireAndCatch(Timer.java:146)
at com.google.gwt.user.client.Timer.fire(Timer.java:138)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke
(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke
(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:
103)
at com.google.gwt.dev.shell.ie.IDispatchImpl.callMethod
(IDispatchImpl.java:126)
at com.google.gwt.dev.shell.ie.IDispatchProxy.invoke
(IDispatchProxy.java:155)
at com.google.gwt.dev.shell.ie.IDispatchImpl.Invoke
(IDispatchImpl.java:294)
at com.google.gwt.dev.shell.ie.IDispatchImpl.method6
(IDispatchImpl.java:194)
at org.eclipse.swt.internal.ole.win32.COMObject.callback6
(COMObject.java:117)
at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1925)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2966)
at com.google.gwt.dev.SwtHostedModeBase.processEvents
(SwtHostedModeBase.java:235)
at com.google.gwt.dev.HostedModeBase.pumpEventLoop
(HostedModeBase.java:558)
at com.google.gwt.dev.HostedModeBase.run(HostedModeBase.java:405)
at com.google.gwt.dev.HostedMode.main(HostedMode.java:232)


On Jun 17, 9:16 am, Eric Ayers <zun...@google.com> wrote:
> Hi,
>
> I see your code, but I don't see any code ingwt-mapsbeing called (at

Eric Ayers

unread,
Jun 22, 2009, 6:32:49 PM6/22/09
to Google-We...@googlegroups.com
So, what is the code at:

at com.fuelquest.darkstar.client.DarkStar$14$1.run(DarkStar.java:
1062)

everlongh

unread,
Jun 22, 2009, 10:01:31 PM6/22/09
to Google Web Toolkit
here it is below, it occurs on the line

RootPanel.get(divId).getElement().setInnerHTML
(getTankInventoryForMapTree(tivo));

DEBUGGED BACK TO... RootPanel.get(divId)

In RootPanel.java

// Create the panel and put it in the map.
if (elem == null) {
// 'null' means use document's body element.
rp = new DefaultRootPanel();
} else {
// Otherwise, wrap the existing element.
rp = new RootPanel(elem);
}

rootPanels.put(id, rp);
detachOnWindowClose(rp);
return rp;

everlongh

unread,
Jun 23, 2009, 5:34:50 PM6/23/09
to Google Web Toolkit
Just to be comletely clear the div id being updated is html in a
com.google.gwt.widgetideas.client.FastTree widget inside a map marker
infowindow

below is the code that adds the widget

private void addInfoWindowWidget(final Marker marker, final Widget
widget) {

marker.addMarkerClickHandler(new MarkerClickHandler() {
public void onClick(MarkerClickEvent event) {
InfoWindow info = map.getInfoWindow();
InfoWindowContent content = new InfoWindowContent(widget);
info.open(marker, content);
}
});
}

The FastTree that has html with the divID updated in the loop below,
each tree node html gets update with a call
to RootPanel.get(divId).getElement().setInnerHTML
(getTankInventoryForMapTree(tivo));

The whole loop is below:

for (int x = 0; x < tivos.length; x++)
{
TankInventoryVO tivo = tivos
[x];

DateTimeFormat formatter;
formatter = DateTimeFormat
.getFormat
("yyyy.MM.ddHH:mm:ss");
Date date = new Date
(System.currentTimeMillis());
String dt = formatter.format
(date);
tivo.setInventoryDateTime
(dt);
double volume =
tivo.getInventoryVolume();
volume = volume -
Random.nextInt(100);
tivo.setInventoryVolume
(Float.parseFloat(Double
.toString
(volume)));
tivo.setVolumeUom("gal");
String divId = key + "-
TankInventory-" + x;
System.out.println("Updating
panel for "
+ divId);
RootPanel.get(divId).getElement
().setInnerHTML(

getTankInventoryForMapTree(tivo));
}




Eric Ayers

unread,
Jun 23, 2009, 7:00:13 PM6/23/09
to Google-We...@googlegroups.com
I think the problem is that you are clobbering a tree in the DOM using setInnerHTML() that you created with GWT widgets.  Can you find a way to comment out the setInnerHTML() or attach to the div some other way?

mel

unread,
Jul 15, 2009, 1:43:53 PM7/15/09
to Google Web Toolkit
I have a similar problem that only started when I started using GWT
1.6.

In my code I create a fieldset HTML elememt and add it to a flex table
thus.

<code>
public static HTML createFieldSet(String as_legend, String
div_element_id) {
return new HTML("<fieldset>"
+ "<legend>" + as_legend+ "</legend>"
+ "<div id='" + div_element_id + "'></div>"
+ "</fieldset>");
}

HTML html = createFieldSet("My Fieldset", "MYID");
FlexTable table = new FlexTable();
table.setWidget(0, 0, html);
</code>


In the onload method of my window, I then inject a new widget into the
ID for the fieldset div with ID "MYID" as follows

Widget somewidget ...
RootPanel.get("MYID").add(somewidget);

I get the same error as described above in hosted mode. In web mode it
works fine.


I tired using the following to fix the problem.

<code>
Element p = DOM.getElementById("MYID");
p.appendChild(somewsidget.getElement());
</code>

THis works in hosted mode but fails in web mode.

Any ideas?

Thanks,

Melody

Reply all
Reply to author
Forward
0 new messages