css - 如何使用 CSS 设置 GWT 的 NotificationMole 样式

标签 css gwt

有没有人成功地将您自己的 CSS 样式应用到 GWT 的 NotificationMole。

如果我添加自己的样式名称,那么该样式仅适用于隐藏痣时不会被删除的外部 DIV,而且我无法找到将样式应用于内部 div 的方法...

最佳答案

肮脏的解决方案:

package com.google.gwt.user.client.ui; // important for package visibility access

import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.SpanElement;

public class NotificationMoleHelper {

    protected NotificationMole notificationMole;

    public NotificationMoleHelper(NotificationMole notificationMole) {
        super();
        this.notificationMole = notificationMole;
    }

    public SpanElement getNotificationText() {
        return notificationMole.notificationText;
    }

    public DivElement getHeightMeasure() {
        return notificationMole.heightMeasure;
    }

public DivElement getBorderElement() {
    return notificationMole.borderElement;
}

    /**
     * Change heightMeasure's background color
     * 
     * @param backgroundColor
     */
    public void setBackgroundColor(String backgroundColor) {

        getBorderElement().getStyle().setBackgroundColor(backgroundColor);
    }
}

示例:

final NotificationMoleHelper notificationMoleHelper = new NotificationMoleHelper(notificationMole);
notificationMoleHelper.setBackgroundColor("#FF1111");

关于css - 如何使用 CSS 设置 GWT 的 NotificationMole 样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8052467/

相关文章:

javascript - 如何检查一个类是否有某个符号,如果有,则用它做一些事情?

java - 如何使用 Java 应用程序为我的 AppEngine 激活 SSL?

debugging - GWT:码头在调试时抛出空指针异常

GWT-log 如何写入特定文件?

html - 是否有将导航栏移动到标题图形下方的代码?

html - 创建一个带有左右对齐元素的导航栏

javascript - 缩放以适合, Canvas ,javascript

java - 使用自定义登录对话框的 GWT 和 Spring 安全集成

javascript - JSNI - 从 JS 函数调用 Java 方法

javascript - onclick一个元素,div的滑动切换