Setting styles on different faces of a GWT CustomButton using UiBinder

随声附和 提交于 2020-01-05 07:58:05

问题


I'm trying to set style names on different faces of ToggleButton (i.e. upFace, downFace, ...). It looks like setting styleName on a face doesn't work. For example the following won't work:

<g:ToggleButton>
    <g:upFace styleName='{style.myToggleButton-up}' />
</g:ToggleButton>

But I noticed when setting the style name on ToggleButton itself...

<g:ToggleButton styleName='{style.myToggleButton}' />

... the generated HTML will look something like this:

<div class="GPAKHSCBGG GPAKHSCBGG-up" role="button" aria-pressed="false">...</div>

However, even if I have {style.myToggleButton-up} defined, it is not populated to GPAKHSCBGG-up. So I'm wondering how can I do this without having to mock the global .gwt-ToggleButton-up stylesheet. Please help.


回答1:


http://examples.roughian.com/index.htm#Widgets~ToggleButton

All GWT components have predefined CSS Class definitions, what you tried didn't override the definitions.




回答2:


Solution:

Add @external myToggleButton, myToggleButton-up; to ui:binder file.



来源:https://stackoverflow.com/questions/6945538/setting-styles-on-different-faces-of-a-gwt-custombutton-using-uibinder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!