我可以在GWT的UiBinder样式定义中使用变量吗

我可以在GWT的UiBinder样式定义中使用变量吗,gwt,uibinder,Gwt,Uibinder,在以下示例中,从MessageView.ui.xml文件: <ui:style> .polite { position:fixed; background-color:notice-background-color; top:1em; left:2em; white-space:nowrap; border-radius:.5em;} </ui:style> <g:PopupPanel

在以下示例中,从MessageView.ui.xml文件:

<ui:style>
    .polite {
      position:fixed;
      background-color:notice-background-color;
      top:1em;
      left:2em;
      white-space:nowrap;
      border-radius:.5em;}
</ui:style>

<g:PopupPanel styleName="{style.polite}">
    <g:HTML ui:field="message">Message goes here.</g:HTML>
</g:PopupPanel>

.礼貌{
位置:固定;
背景色:注意背景色;
顶部:1米;
左:2米;
空白:nowrap;
边界半径:.5em;}
信息就在这里。

我可以定义@notice背景色,以便其他UiBinder文件也可以使用该定义。

可以。将颜色定义为静态
字符串

package com.myproject.client.resource;

public class MyColors {
    public static String lightGreen = "#0bdc1a";
}
并定义一个
@eval
变量:

<ui:style>
    @eval notice-background-color com.myproject.client.resource.MyColors.lightGreen;

    .polite {
      position:fixed;
      background-color:notice-background-color;
      top:1em;
      left:2em;
      white-space:nowrap;
      border-radius:.5em;}
</ui:style>

<g:PopupPanel styleName="{style.polite}">
    <g:HTML ui:field="message">Message goes here.</g:HTML>
</g:PopupPanel>

@评估通知背景色com.myproject.client.resource.MyColors.lightGreen;
.礼貌{
位置:固定;
背景色:注意背景色;
顶部:1米;
左:2米;
空白:nowrap;
边界半径:.5em;}
信息就在这里。

这应该可以做到,这里有一个参考:太好了。我明天会实施这个。你知道谁可以从我的general.css文件中访问这个.lightGreen吗?然后我会在一个地方定义所有这些定义。太好了。同样的方法也可以在应用程序的.css文件中使用。在.css文件中,在css定义中使用浅绿色之前,添加相同的@eval。