UiBinder use ImageResource height and width to specify a elements height and width

32 views
Skip to first unread message

Patrick Tucker

unread,
Dec 20, 2011, 1:47:52 PM12/20/11
to Google Web Toolkit
I'm trying to convert one of my Widgets to a UiBinder in GWT 2.4. The
current Widget uses the width from an ImageResource to size a parent
TD element.

The parent TD has to be the exact same size as the image or the
overall Widget will not look right. I do not want to hard code the
value...

I have the resource defined as follows:
<ui:with field='res' type='package.PanelName.DefaultImages'/>

When I try the following ways I get the error "Returns int, can't be
used as class java.lang.String":
<td width="{res.refreshButton.getWidth}">...</td>
<td style='width:{res.refreshButton.getWidth}'>...</td>

I tried a few other things that resulted in the same error.

I don't understand why the UiBinder does not like width="22" when this
is valid HTML. Is there some other way to do what I am trying to do?

Thanks,
Pat

Ed

unread,
Dec 20, 2011, 5:40:43 PM12/20/11
to google-we...@googlegroups.com
Try "22px"

BTW: I these day's I would build my widgets tabless as much as possible

Patrick Tucker

unread,
Dec 21, 2011, 5:24:41 PM12/21/11
to Google Web Toolkit
It is not me that is entering the width="22", the value 22 is
programatically injected by {res.refreshButton.getWidth}.

The error message is complaining because the function getWidth does
not return a String.

I also try to use tables as little as possible, but in this case I
have to use one in order to constrain a TextBox to 100% of its
parent. The requirement indicates that the TextBox grow with a
resizable parent element... I haven't been able to find a better way
to get around this.

Thanks,
Pat

Patrick Tucker

unread,
Jan 5, 2012, 11:31:31 AM1/5/12
to Google Web Toolkit
I guess I should file an issue?
> > BTW: I these day's I would build my widgets tabless as much as possible- Hide quoted text -
>
> - Show quoted text -
Reply all
Reply to author
Forward
0 new messages