使用UiBinder在GWT CustomButton的不同面上设置样式

使用UiBinder在GWT CustomButton的不同面上设置样式

问题描述:

我试图在ToggleButton的不同面上设置样式名称(即upFace,downFace,...)。它看起来像在脸上设置styleName不起作用。例如,以下内容不起作用:

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>

但是我注意到在ToggleButton本身设置样式名称时...

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

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

...生成的HTML看起来是这样的:

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

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

但是,即使我定义了{style.myToggleButton-up},也不会将其填充到GPAKHSCBGG -向上。所以我想知道如何做到这一点,而不必模拟全局的.gwt-ToggleButton-up样式表。

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.

解决方案:

Solution:


添加@external myToggleButton,myToggleButton-up;到ui:活页夹文件。

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