UI Binder Button Problem

48 views
Skip to first unread message

walker1c

unread,
Aug 15, 2011, 1:14:32 PM8/15/11
to Google Web Toolkit
Can anyone tell me what I'm doing wrong here? g:Image gets an image
URL, but g:upFace just gets a text input field.

ButtonPanel.ui.xml
---------------------------
<ui:UiBinder xmlns:ui="urn:ui:com.google.gwt.uibinder"
xmlns:g="urn:import:com.google.gwt.user.client.ui">

<ui:with field='img' type='test.client.Images'/>

<g:HTMLPanel ui:field='htmlPanel'>
<h3>Button panel</h3>
The image:
<g:Image resource="{img.saveButton}" />
<hr />
The button:
<g:PushButton ui:field="button">
<g:upFace image="{img.saveButton}" />
</g:PushButton>
</g:HTMLPanel>
</ui:UiBinder>

ButtonPanel.java
------------------------
public class ButtonPanel extends Composite
{
interface MyUiBinder extends UiBinder<Widget, ButtonPanel> {}
private static MyUiBinder uiBinder = GWT.create(MyUiBinder.class);

@UiField PushButton button;

public ButtonPanel()
{
initWidget(uiBinder.createAndBindUi(this));
}
}

Resulting HTML (part)
-------------------------------
<h3>Button panel</h3>
The image:
<img class="gwt-Image" border="0" style="width: 20px; height: 20px;
background: url(data:image/
png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAABCUlEQVR42mP4DwX79+//
X19fTxZevnw5zJj/DN+/f/9vZKr1X9dM4L9PGgNZ2MqT77+0nMj/+/fv/
2cAmQ4SmHmGgSIcXsLyPycv9T9DdFzI//h6BooNLJ7J8N/S1gC7gdb
+DP8NHbFjFQMIBqkh2kCQRlwuARnGwAChqWpgUhMJBsK8BcPI3hWTgxhIkpdhrgBhkAEwcZhhJHsZl4HI4mQbCDMUXYwiA91iGf4HZFHRQJBhFBkIikH0mEbHJMUy1bPe4DIwJS3uf3Ql5QbmTWL47+Rq8Z/
h/Pnz/5U1+f937yTfsP79DP9t/Tn/9/Z1/2cAFds9vW3/
RcT4UJIFKZiXnxNcuIJKfwBn9ylqL8bV6QAAAABJRU5ErkJggg==) no-repeat 0px
0px" src="http://127.0.0.1:8888/gwttest/clear.cache.gif"
onload="this.__gwtLastUnhandledEvent="load";">
<hr>
The button:
<div class="gwt-PushButton" tabindex="0" role="button">
<input type="text" tabindex="-1" style="opacity: 0; height: 1px;
width: 1px; z-index: -1; overflow: hidden; position: absolute;">
</div>

Alex Dobjanschi

unread,
Aug 16, 2011, 10:00:33 AM8/16/11
to google-we...@googlegroups.com
What are you trying to do exactly? Setting the upFace of a PushButton?

Then go with
{{{
   <g:PushButton ui:field="button"
          upFace="{img.button}" />
}}}

(not sure highlight will work)

walker1c

unread,
Aug 17, 2011, 5:11:25 AM8/17/11
to Google Web Toolkit
Hi Alex,

That would be a start.

Does the tag in your post work? The Javadoc at
http://google-web-toolkit.googlecode.com/svn/javadoc/latest/com/google/gwt/user/client/ui/CustomButton.html
shows upFace as a sub-node of the PushButton tag. If I'm reading the
UIBinder documentation correctly, upFace can only be an attribute of
the PushButton tag if the class has a method called setUpFace().

As a matter of fact this seems to be really a problem with UiBinder
and PushButton. I've converted my button to @UiField(provided =
true), and I'm loading the images direct from URLs when I construct
the PushButton, and even then the button isn't rendered.

Thanks for the reply.

Chris
Reply all
Reply to author
Forward
0 new messages