Friday, October 14, 2011

UiBinder & setVisible - Confusing (Inconsistent?) Behaviour

Hi all,

If I use (in UiBinder) something like

<g:Label visible="false">Hello World!</g:Label>

then the widget is hidden as expected. This calls
UIObject.setVisible(boolean), IIUC.

When I try this for my own widgets this doesn't work, however. I have

public interface MiniGameWidget
{
@UiTemplate("MiniGameWidget.ui.xml")
interface UiBinder
extends
com.google.gwt.uibinder.client.UiBinder<Widget, DefaultMiniGameWidgetView>
{}
interface View
extends IsWidget, HasVisibility
{ ... }
...
}

and

public class DefaultMiniGameWidgetView
extends Composite
implements View
{ ... }

Using

<ip:MiniGameWidget.View visible="false"/>

(in another widget) fails with

[ERROR] Class MiniGameWidget.View has no appropriate setVisible()
method Element <ip:MiniGameWidget.View visible='false'> (:17)

even though View extends HasVisibility.

But it gets stranger. If I add a different method (like setXyz) which
then calls this.setVisible() everything works fine. So

<ip:MiniGameWidget.View xyz="false"/>

and

void setXyz(boolean visible) {
this.setVisible(visible);
}

works like a charm.

So it looks like the "visible" property is special somehow? How do I
get it to work for my widget?

Cheers,
Hilco

--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate