Hi Julian,
It may seem redundant, but it's actually required in order for deferred
binding to work. The PopupImpl class is instantiated via a GWT.create()
call, which makes the compiler lookup deferred binding rules for the type
it's trying to create. If we were to instantiate directly as PopupImpl impl
= new PopupImpl(), then we wouldn't be able to replace its implementation
with other browser versioned implementations. It just so happens that the
PopupImpl class is the default when GWT.create()'ing the deferred binding
type, so the default rule uses that class.

Hope that clears things up,
-Sumit

On Fri, Aug 21, 2009 at 8:52 AM, Julian Harris <[email protected]>wrote:

>
> Thanks Sumit as always -- can I check why the fall-through class
> exists at all? It seems a little redundant for something to replace
> itself! :) I know that's what the docs say ... but why I wonder?
>
> On Aug 10, 11:53 pm, Sumit Chandel <[email protected]> wrote:
> > Hi Michael,
> > If you could elaborate a little more on which part of deferred binding
> > you're not sure about, that would help pinpoint the problem you're having
> > and setup deferred binding code for your mobile browser target.
> >
> > In general, however, the way deferred binding works is by defining the
> rules
> > for the deferred binding using replacement (see doc link below), creating
> > the default and the mobile classes that should be used for the desktop
> > browser and mobile browser versions of your widget, respectively, and
> then
> > creating your widget via the GWT.create(MyWidget.class) call to have the
> > compiler create bindings for the mobile target.
> >
> > Deferred Binding using Replacement:
> http://code.google.com/webtoolkit/doc/1.6/DevGuideCodingBasics.html#D...
> >
> > For an example, check out the inner workings of the PopupPanel widget.
> > You'll notice that the PopupImpl instance belonging to the PopupPanel
> class
> > is created using the GWT.create(PopupImpl.class) call. Looking at the
> > deferred binding rules for the PopupPanel in the Popup.gwt.xml file
> > (contained in the gwt-user.jar), you'll see that the following rules are
> > defined:
> >
> >   <!-- Fall through to this rule is the browser isn't IE or Mozilla -->
> >   <replace-with class="com.google.gwt.user.client.ui.impl.PopupImpl">
> >     <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
> >   </replace-with>
> >
> >   <!-- Mozilla needs a different implementation due to issue #410 -->
> >   <replace-with
> class="com.google.gwt.user.client.ui.impl.PopupImplMozilla">
> >     <when-type-is class="com.google.gwt.user.client.ui.impl.PopupImpl"/>
> >     <any>
> >       <when-property-is name="user.agent" value="gecko"/>
> >       <when-property-is name="user.agent" value="gecko1_8"/>
> >     </any>
> >   </replace-with>
> >
> > You could essentially follow the same pattern for the mobile version of
> > MyWidget.class, perhaps creating a MyWidget.gwt.xml file to contain the
> > deferred binding rules.
> >
> > Hope that helps,
> > -Sumit Chandel
> >
> > On Tue, Aug 4, 2009 at 3:38 AM, grue <[email protected]
> >wrote:
> >
> >
> >
> >
> >
> > > Hi,
> >
> > > I have to add a mobile-optimized version to an existing gwt
> > > application. After digging through the docs I found out that deferred
> > > binding is the technology of chioce. I believe I understand how it
> > > basically works but how do I use it in that specific use case?
> > > The mobile UI of our application differs a lot from the standard
> > > version so I need seperate stylesheets, and seperate GWT controls (we
> > > use composites a lot). Since the basic layout of our application is
> > > done in the .html file I would also need a separate html file.
> > > Now the question is: how do I do that? Are there any best practices?
> >
> > > I'd really appreciate any hint.
> >
> > > Best regards,
> > > Michael
> >
>

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

Reply via email to