Anchor.wrap with GQuery

2009-12-08 Thread jd
Hi,

I am using GQuery to return elements that I want to attach
ClickHandlers to like this:


GQuery h2s = $("#header > h2 > a");
Anchor lowestPriceAnchor = Anchor.wrap(h2s.get(0));

But I am getting an exception:


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:136)
at com.google.gwt.user.client.ui.Anchor.wrap(Anchor.java:59)

Does anyone know what I am going wrong here?

Cheers,

John

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: Anchor.wrap with GQuery

2009-12-09 Thread Thomas Broyer


On Dec 9, 7:58 am, jd  wrote:
> Hi,
>
> I am using GQuery to return elements that I want to attach
> ClickHandlers to like this:
>
>                 GQuery h2s = $("#header > h2 > a");
>                 Anchor lowestPriceAnchor = Anchor.wrap(h2s.get(0));
>
> But I am getting an exception:
>
> 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:136)
>     at com.google.gwt.user.client.ui.Anchor.wrap(Anchor.java:59)
>
> Does anyone know what I am going wrong here?

The element you're trying to wrap is a child of an element that's the
"root" element of a widget. A widget is supposed to control its
subtree, so wrapping a widget's child element in another widget is
prohibited, as the "parent" widget would be aware of it.

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: Anchor.wrap with GQuery

2009-12-09 Thread John Patterson

On 9 Dec 2009, at 16:59, Thomas Broyer wrote:

> The element you're trying to wrap is a child of an element that's the
> "root" element of a widget. A widget is supposed to control its
> subtree, so wrapping a widget's child element in another widget is
> prohibited, as the "parent" widget would be aware of it.

My question is _why_ is this element already owned and what can be  
done about it.

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.




Re: Anchor.wrap with GQuery

2009-12-09 Thread Thomas Broyer


On Dec 9, 12:48 pm, John Patterson  wrote:
> On 9 Dec 2009, at 16:59, Thomas Broyer wrote:
>
> > The element you're trying to wrap is a child of an element that's the
> > "root" element of a widget. A widget is supposed to control its
> > subtree, so wrapping a widget's child element in another widget is
> > prohibited, as the "parent" widget would be aware of it.
>
> My question is _why_ is this element already owned and what can be  
> done about it.

First find the offending element (either set a breakpoint in
RootPanel::isElementChildOfWidget in DevMode, or look for a parent
element with a __listener property using whichever tool your like in
"prod mode" –Firebug, Web inspector, Developer Tools, etc.–), then try
to understand why it could "be a widget" already; but without seeing
your code it's impossible to help you further more...

--

You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to google-web-tool...@googlegroups.com.
To unsubscribe from this group, send email to 
google-web-toolkit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.