Re: Attaching GWT widgets to elements inside iframes

2009-05-07 Thread jgw

Daniel,

The DOM package was updated in 1.6 to deal with all those nasty $doc
assumptions, so you can create and manipulate the DOM in multiple
documents correctly (though it's still tricky, as you have to keep
track of which element belongs to which document). However, the Widget
library was not, as this is largely intractable without a complete
redesign. The problem is that you can't mix elements from different
documents (the browser will throw an exception if you're lucky, or
simply crash if you're not), and the Swing-style construction model
makes this exceedingly difficult (every widget would have to do
something weird like require a RootPanel (or simply a Document) to be
passed into to its ctor so that it could create its elements in the
right document; even then it would be very difficult to deal with
widgets being moved from one document to another).

The browser event model unfortunately doesn't provide any useful way
to aggregate events across frames/documents, either. The current GWT
event model (not part of the DOM module itself, yet) still assumes
that there is only one document at a time. It would be really nice to
have direct native event support in the DOM module itself at some
point, but there are some very difficult memory leak problems to be
solved before that will be feasible (i.e., if Element just had the
standard add/RemoveEventListener() methods, people would start
creating massive memory leaks).

I don't know the details of your application, but my inclination would
be to do as you suggest in the last paragraph and load separate
"instances" of the application into each iframe if you're going to be
doing significant UI within them. You could also try and manipulate
the iframes' DOMs directly, but you'd have to handle events with JSNI
methods, and you'd have to be very careful about leaks.

Cheers,
joel.

On May 7, 3:51 pm, DanG  wrote:
> Can someone explain the way that GWT deals with iframes in this
> regard.
> If I want to create my own widgets or for that matter, use other
> widgets in an iframe.
>
> The situation is that I have cached versions of arbitrary webpages
> loaded into iframes (to get around the iframe domain problem)
> and then I want my code to annotate these pages in some fashion,
> ideally using floating GWT widgets.
>
> I would expect to do something like this.
>
> Document doc = iframe.getFrameDocument(); //wraps up the Document of
> an iframe using managed iframe from gwt-ext for now but thinking of
> doing this myself later and giving up on ext.
> BodyElement body = doc.getBody();
> Element div = DOM.createDiv();
> body.appendChild(div);
> div.setId("id123");
> RootPanel panel = RootPanel.get("id123");
> //or better would be RootPanel panel = RootPanel.get(div); //but this
> is not a public method.
> panel.add(firstWidgetOfMany)
>
> But because RootPanel uses Document.get().getElementById(id).cast()
> to find the element AND (shock horror) Document.get() assumes there is
> only ever one document for a gwt application I don't understand how
> one could tie up the elements in the frame to widgets in GWT without
> completely rewriting RootPanel and possibly other classes.
>
> I also want to ask what the potential pitfalls with this scenario are
> and the GWT event model.
> When I create widgets and parent/register them to existing widgets,
> will the events that the elements raise find their way back to the GWT
> widgets if the elements exist in the iframe?
>
> Am I thinking about this incorrectly? Is it better to create a new
> 'instance' of GWT inside the iframe and then try and get the parent
> and child instances talking together (i imagine this could also cause
> problems)? Or is it simply not worth using GWT widget infrastructure
> and build my own infrastructure based on DOM elements for this
> scenario (a real pity)?
>
> Thanx, Daniel.
--~--~-~--~~~---~--~~
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-Toolkit@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: DockLayoutPanel and YUI

2009-10-05 Thread jgw

Could you post code that reproduces either of these cases? The yui-
grids thing sounds a little odd, but I'd still like to look into it.
But a DockLayoutPanel not working properly on IE6 is very surprising,
as those cases should already be tested (and because I've tested them
manually). Again, code would be really helpful.

Thanks,
joel.

On Oct 4, 4:14 am, jd  wrote:
> ... and while I am bashing IE6 - I found another issue:
>
> When DockLayoutPanel is set to use Unit.EM I found that a child in the
> east overlapped with the centre child by about 10 px.  When I changed
> to Unit.PX it works OK.  Again, in Safari Unit.EM worked fine.
>
> Bring on Chrome Frame!
>
> On Oct 4, 2:42 pm, jd  wrote:
>
>
>
> > Hi,
>
> > I am using DockLayoutPanel and have found that it seems to be
> > imcompatible with YUI Grids.
>
> > Specifically, when I include this on my page:
>
> >          > href="http://yui.yahooapis.com/
> > 2.8.0r4/build/grids/grids-min.css">
>
> > The page does not layout correctly in IE6.  In Safari 4.0 it seems to
> > work fine.
>
> > The internal "layers" appear to be offset of the right or not visible
> > at all.
>
> > This is not a big issue for me as I don't need to use YUI grids now
> > anyway... it was just a left over from using reset-fonts-grids of
> > which I only want the reset and fonts part.  Just thought I would
> > mention it.
>
> > 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-toolkit@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
-~--~~~~--~~--~--~---