有没有人将您自己的CSS样式应用于GWT的NotificationMole。如何使用CSS设计GWT的NotificationMole
如果添加自己的样式名,然后这种风格只适用于外DIV当摩尔被隐藏未被排除,我不能Fing头的方式来应用样式的内部的div ...
有没有人将您自己的CSS样式应用于GWT的NotificationMole。如何使用CSS设计GWT的NotificationMole
如果添加自己的样式名,然后这种风格只适用于外DIV当摩尔被隐藏未被排除,我不能Fing头的方式来应用样式的内部的div ...
那么你的NotificationMole有一个关联的ui.xml文件,所以你想应用的任何自定义样式都应该在那里应用。
这可能很简单:首先定义你自己的风格,在NotificationMole初始化之后,用你定义的类替换它的内置类,这就是我在我的项目中所做的。使用DOM来替换类或使用gwtquery,两者都可以。
一个肮脏的解决方案:
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");
,我看着它,它只是宣布 “在线” 的UiBinder的文件的样式。我对CSS不太了解,但我不认为我可以根据这些名称设置样式。如果您检查NM元素,则会为每个“内嵌”样式定义样式,其中包含看起来像由GWT编译器生成的粗糙名称。使用我可以设计的风格,但是我怀疑当名称改变时,下一个GWT版本会崩溃。 –