wicket中改变TreeTable列表中选中一行的背景颜色
2011-06-27 20:29
561 查看
final TreeTable tree = new TreeTable("treeTable", buildTreeModel(lll, cccc), columns) {
protected void populateTreeItem(WebMarkupContainer item, int level) {
super.populateTreeItem(item, level);
final TreeNode node = (TreeNode)item.getDefaultModelObject();
item.add(new AbstractBehavior() {
private static final long serialVersionUID = 1L;
//重写onComponentTag方法
public void onComponentTag(Component component, ComponentTag tag)
{
super.onComponentTag(component, tag);
if (getTreeState().isNodeSelected(node)) {
tag.put("style", "background-color:#CCCCCC");//背景颜色设为深灰色
} else {
tag.put("class", "row");
}
}
});
}
};
//控制多重选择
tree.getTreeState().setAllowSelectMultiple(false);
protected void populateTreeItem(WebMarkupContainer item, int level) {
super.populateTreeItem(item, level);
final TreeNode node = (TreeNode)item.getDefaultModelObject();
item.add(new AbstractBehavior() {
private static final long serialVersionUID = 1L;
//重写onComponentTag方法
public void onComponentTag(Component component, ComponentTag tag)
{
super.onComponentTag(component, tag);
if (getTreeState().isNodeSelected(node)) {
tag.put("style", "background-color:#CCCCCC");//背景颜色设为深灰色
} else {
tag.put("class", "row");
}
}
});
}
};
//控制多重选择
tree.getTreeState().setAllowSelectMultiple(false);
相关文章推荐
- winform中GridView控件在选中一行后改变选中行的背景颜色
- 点击table中的一行选中checkbox,并改变该行的颜色
- 改变tableView中的cell选中的颜色和背景颜色 从父视图上删除所有的子视图
- tableview 选中一行后,不显示选中颜色的方法 tableview 选中一行后,不显示选中颜色,不要将tableview的allowsSelection设置成NO,那样的话可能导致tablev
- Android RadioButton设置选中时文字和背景颜色同时改变
- Android RadioButton设置选中时文字和背景颜色同时改变
- 设置ListCtrl列表控件其中某一行的字体和背景颜色
- 改变List列表控件中的字体颜色和单元格背景颜色
- 微信小程序中的循环列表,在点击时改变当前项的背景颜色
- iOS tableview 选中一行后,不显示选中颜色
- cell上label的背景颜色在选中状态下改变的解决办法
- 多个button,改变选中button的背景颜色、字体颜色
- WPF中ListView如何改变选中条背景颜色
- 转 Android RadioButton设置选中时文字和背景颜色同时改变
- iOS tableview 选中Cell后的背景颜色和文字颜色
- 设置ListCtrl列表控件其中某一行的字体和背景颜色
- 改变选中Treeview的节点的背景颜色
- 选择下拉列表的颜色,背景颜色跟着改变
- IOS tableView 选中时的背景颜色设置
- tableView cell 选中颜色的改变