gpt4 book ai didi

css - 添加到单元格时,混淆的类名不会添加到样式表中

转载 作者:行者123 更新时间:2023-11-27 22:29:13 26 4
gpt4 key购买 nike

混淆的类名 (GPGOA3-B) 确实被添加到单元格中,但类本身没有被添加到任何样式表中。

我做错了什么?

public final class HyperlinkCell extends AbstractCell<HyperlinkCellData> {

// TODO
private interface MyCss extends CssResource {
String red();
}

// TODO
private interface MyResources extends ClientBundle {
@Source("HyperlinkCell.css")
MyCss css();
}

// TODO
private static MyResources resources = GWT.create(MyResources.class);

HyperlinkCell() {
super("click");
}

@Override
public void onBrowserEvent(Element parent, HyperlinkCellData value,
Object key, NativeEvent event,
ValueUpdater<HyperlinkCellData> valueUpdater) {
// handle click event
History.newItem(value.targetHistoryToken, true);
}

@Override
public void render(HyperlinkCellData value, Object key, SafeHtmlBuilder sb) {
String childGroupObfuscatedClass = resources.css().red();
sb.append(SafeHtmlUtils.fromTrustedString("<a class=\""))
.append(SafeHtmlUtils
.fromTrustedString(childGroupObfuscatedClass))
.append(SafeHtmlUtils.fromTrustedString("\""))
.append(SafeHtmlUtils.fromTrustedString(" href=\"#"))
.append(SafeHtmlUtils.fromString(value.targetHistoryToken))
.append(SafeHtmlUtils.fromTrustedString("\">"))
.append(SafeHtmlUtils.fromString(value.text))
.append(SafeHtmlUtils.fromTrustedString("</a>"));
}
}

超链接单元格.css

.red {
color: red;
}

生成的 DOM 元素

<a href="#target" class="GPGOA3-B">text</a>

最佳答案

MyResources.resources.css().ensureInjected();

Calls com.google.gwt.dom.client.StyleInjector.injectStylesheet(String) to inject the contents of the CssResource into the DOM. Repeated calls to this method on an instance of a CssResources will have no effect.

关于css - 添加到单元格时,混淆的类名不会添加到样式表中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4308978/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com