Do you have the following in your ui.xml file:

<ui:with field='res' type='com.google.gwt.sandbox.client.Resources'/>

...where 'com.google.gwt.sandbox.client.Resources' is replaced with your
resources class.


On Thu, Jan 7, 2010 at 5:24 AM, emerix <rafa...@gmail.com> wrote:

> Hello,
>
> I tried using relative paths for the resource property :
> <ui:image field='logo' resource='../resources/my_logo.png'></ui:image>
>
> but I got the error : No com.google.gwt.resources.client.ClientBundle
> $Source annotation and no resources found with default extensions
>
> if I use the src property, everything is ok :
> <ui:image field='logo' src='../resources/my_logo.png'></ui:image>
>
> hope someone find this useful :)
>
>
> However what I really wanted is using your 2nd solution :
> <ui:image field='logo' resource='{res.logo}'></ui:image>
> but when I load the page I also get the error : No
> com.google.gwt.resources.client.ClientBundle$Source annotation and no
> resources found with default extensions
>
> am I missing something ?
>
> thanks a lot :)
>
> ++emerix
>
> On Jan 4, 11:15 pm, Chris Ramsdale <cramsd...@google.com> wrote:
> > One option would be to use relative paths within the <ui:image> element.
> For
> > example:
> >
> > <ui:image field='logo' resource='../resources/my_logo.png'></ui:image>
> >
> > Another option would be to use <ui:with>, get a hold of the ClientBundle,
> > and reference an image within it.
> >
> > public interface Resources extends ClientBundle {
> >   @Source("com/google/gwt/sandbox/resources/my_logo.png")
> >   ImageResource logo();
> >
> > }
> >
> > <ui:UiBinder>
> >   ...
> >   <ui:with field='res' type='com.google.gwt.sandbox.client.Resources'/>
> >   <ui:image field='logo' resource='{res.logo}'></ui:image>
> >   ...
> > </ui:UiBinder>
> >
> > Underscores within the filename are completely valid (the above examples
> > compile and run w/o issue).
> >
> >
> >
> > On Thu, Dec 31, 2009 at 3:30 AM, Daniel <doubleagen...@gmail.com> wrote:
> > > Here's a valid ui.xml file:
> >
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/
> > > xhtml.ent">
> >
> > > <ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
> > > xmlns:g="urn:import:com.google.gwt.user.client.ui">
> >
> > >  <ui:style field="IekyStyle">
> > >    .anchorWrapper a {
> > >        display: block;
> > >    }
> >
> > >    @sprite .left {
> > >        gwt-image: 'left';
> > >    }
> >
> > >    @sprite .logo {
> > >        gwt-image: 'logo';
> > >        background-position: 0 -197px;
> > >        height: 197px;
> > >    }
> >
> > >    div.logo:hover {
> > >        background-position: 0 0;
> > >    }
> >
> > >    @sprite .slogans {
> > >        gwt-image: 'animatedSloganArea';
> > >    }
> >
> > >    @sprite .menuTop {
> > >        gwt-image: 'menuTop';
> > >    }
> >
> > >    @sprite .right {
> > >        gwt-image: 'right';
> > >    }
> >
> > >    @sprite .home {
> > >        gwt-image: 'home';
> > >        height: 25px;
> > >    }
> >
> > >    div.home:hover {
> > >        background-position: 0 -25px;
> > >    }
> >
> > >    @sprite .services {
> > >        gwt-image: 'services';
> > >        height: 25px;
> > >    }
> >
> > >    div.services:hover {
> > >        background-position: 0 -25px;
> > >    }
> >
> > >    @sprite .about {
> > >        gwt-image: 'about';
> > >        height: 25px;
> > >    }
> >
> > >    div.about:hover {
> > >        background-position: 0 -25px;
> > >    }
> >
> > >    @sprite .contact {
> > >        gwt-image: 'contact';
> > >        height: 25px;
> > >    }
> >
> > >    div.contact:hover {
> > >        background-position: 0 -25px;
> > >    }
> >
> > >    @sprite .menuBottom {
> > >        gwt-image: 'menuBottom';
> > >    }
> >
> > >    @sprite .floatingBar {
> > >        gwt-image: 'floatingBarArea';
> > >    }
> >
> > >    @sprite .bottom {
> > >        gwt-image: 'bottom';
> > >    }
> > >  </ui:style>
> >
> > >  <ui:image field="about" resource="about.png"></ui:image>
> > >  <ui:image field="animatedSloganArea"
> > > resource="animatedSloganArea.png"></ui:image>
> > >  <ui:image field="bottom" resource="bottom.png"></ui:image>
> > >  <ui:image field="contact" resource="contact.png"></ui:image>
> > >  <ui:image field="floatingBarArea" resource="floatingBarArea.png"></
> > > ui:image>
> > >  <ui:image field="home" resource="home.png"></ui:image>
> > >  <ui:image field="left" resource="left.png"></ui:image>
> > >  <ui:image field="logo" resource="logo.png"></ui:image>
> > >  <ui:image field="menuBottom" resource="menuBottom.png"></ui:image>
> > >  <ui:image field="menuTop" resource="menuTop.png"></ui:image>
> > >  <ui:image field="right" resource="right.png"></ui:image>
> > >  <ui:image field="services" resource="services.png"></ui:image>
> >
> > >  <g:HTMLPanel>
> > >    <div class="{IekyStyle.anchorWrapper}">
> > >      <table border="0" cellspacing="0.0" cellpadding="0">
> > >        <tr>
> > >          <td rowspan="6"><div class="{IekyStyle.left}" /></td>
> > >          <td rowspan="6"><a href="#home"><div
> > > class="{IekyStyle.logo}" /></a></td>
> > >          <td colspan="5"><div class="{IekyStyle.slogans}"></div></td>
> > >        </tr>
> > >        <tr>
> > >          <td colspan="4"><div class="{IekyStyle.menuTop}"></div></td>
> > >          <td rowspan="5"><div class="{IekyStyle.right}"></div></td>
> > >        </tr>
> > >        <tr>
> > >          <td><a href="#home"><div class="{IekyStyle.home}" /></a></
> > > td>
> > >          <td><a href="#business_services"><div
> > > class="{IekyStyle.services}" /></a></td>
> > >          <td><a href="#about"><div class="{IekyStyle.about}" /></a></
> > > td>
> > >          <td><a href="#contact"><div class="{IekyStyle.contact}" /></
> > > a></td>
> > >        </tr>
> > >        <tr>
> > >          <td colspan="4"><div class="{IekyStyle.menuBottom}"></div></
> > > td>
> > >        </tr>
> > >        <tr>
> > >          <td colspan="4"><div class="{IekyStyle.floatingBar}"></div></
> > > td>
> > >        </tr>
> > >        <tr>
> > >          <td colspan="4"><div class="{IekyStyle.bottom}"></div></td>
> > >        </tr>
> > >      </table>
> > >    </div>
> > >  </g:HTMLPanel>
> >
> > > </ui:UiBinder>
> >
> > > It's the lines that read <ui:image> that I'm somewhat bothered by.  If
> > > I rename the image to 'animatedSloganArea.png' to
> > > 'animated_slogan_area.png', and alter the resource tag the compiler
> > > throws an error.  If I move 'animated_slogan_area.png' to a different
> > > directory, like 'resources/images/banner', and update the resource tag
> > > to reflect that change, the compiler blows up there too.
> >
> > > This makes it seem like the resource tag is useless, but I want my
> > > images in a separate directory, and I want them to have underscores,
> > > not this silly java coding convention.
> >
> > > How do I do this?
> >
> > > --
> >
> > > 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<google-web-toolkit%2bunsubscr...@googlegroups.com><google-web-toolkit%2Bunsubs
> cr...@googlegroups.com>
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-web-toolkit?hl=en.
>
> --
> 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<google-web-toolkit%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-web-toolkit?hl=en.
>
>
>
>
--
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.

Reply via email to