我想在树中只加粗父项,并保持子项正常大小。
我尝试以这种方式使用 css,但它不起作用:
.gwt-Tree{
font-weight: bold;
}
.gwt-TreeItem {
font-weight: normal;
}
.gwt-Tree .gwt-TreeItem-selected {
font-weight: normal;
}
有没有办法到达那里?
先感谢您
编辑-Java代码:
String[] composers = new String[]{"Item 1","Item 2","Item 3"};
Resources treeResource = GWT.create(TreeResources.class);
Tree staticTree = new Tree(treeResource);
TreeItem item1 = staticTree.addTextItem(composers[0]);
TreeItem item2 = staticTree.addTextItem(composers[1]);
// add sub items
addItemSection(item1, "item 1 - 1",new String[]{});
addItemSection(item1, "item 1 - 2", new String[]{});
addItemSection(item2, "item 2 - 1",new String[]{});
addItemSection(item2, "item 2 - 2", new String[]{});
addItemSection(item2, "item 2 - 3", new String[]{});
TreeItem item = new TreeItem();
item1.addItem(item);
item2.addItem(item);
Tree t = new Tree();
t.addItem(item1);
t.addItem(item2);
private void addItemSection(TreeItem parent, String label, String[] composerWorks)
{
TreeItem section = parent.addTextItem(label);
for (String work : composerWorks) {
section.addTextItem(work);
}
}
结果:
项目 1
项目 1 - 1
项目 1 - 2
项目 2
项目 2 - 1
项目 2 - 2
项目 2 - 3
但就我而言,一切都是粗体:/