UiBinder 与 ToggleButton 配合使用
我喜欢新的 GWT2 UiBinder,但是,尚不清楚使用声明式 UI 风格是否可以实现某些功能。
例如,ToggleButton 仅在构造时获取图像实例(没有向上/向下图像的设置器)。据我了解,UiBinder 以类似 JavaBean 的反射方式工作,其中可分配的属性被映射到相应的 setter。这种样式是否可以用于像 ToggleButton 这样的小部件,其中某些属性必须在构造时指定?
<g:ToggleButton ui:field="myBtn"></g:ToggleButton>
I'm liking the new GWT2 UiBinder, however, it's not clear whether certain things are achievable using the declarative UI style.
For instance, ToggleButton only takes the image instances at construction time (no setters for up/down images). As I understand, UiBinder works in a JavaBean-like reflective way, where the assignable attributes are mapped to corresponding setters. Is this style possible with widgets like ToggleButton, where certain attributes have to be specified at construction time?
<g:ToggleButton ui:field="myBtn"></g:ToggleButton>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@马特·莫里亚蒂:谢谢你的提示!我发现我必须这样做:
如果您不指定其他面(例如 downFace),则该图像将用于所有按钮状态。
编辑:我猜您在正式指定 external 时使用 ui:image资源?
@Matt Moriarity: Thanks for the tip! I found I had to do it like this:
If you don't specify other faces (e.g. downFace), that image is used for all button states.
Edit: I guess you use ui:image when you're formally specifying external resources?
您可以使用
@UiFactory
或使用@UiField(provided=true)
提供这些小部件来创建这些小部件,请参阅http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_a_widget
You can create these widgets using a
@UiFactory
or by providing it using@UiField(provided=true)
See http://code.google.com/webtoolkit/doc/latest/DevGuideUiBinder.html#Using_a_widget
尝试这样的事情:
Try something like this: