writer.element("li");
if (isLast)
writer.attributes("class", "t-last");
Element e = writer.element("span", "class", "t-tree-icon");
if (node.isLeaf())
e.addClassName("t-leaf-node");
else if (!node.getHasChildren())
e.addClassName("t-empty-node");
boolean hasChildren = !node.isLeaf() && node.getHasChildren();
boolean expanded = hasChildren && expansionModel.isExpanded(node);
if (hasChildren)
{
String clientId = jss.allocateClientId(resources);
e.attribute("id", clientId);
Link expandChildren = resources.createEventLink("expandChildren", node.getId());
Link markExpanded = resources.createEventLink("markExpanded", node.getId());
Link markCollapsed = resources.createEventLink("markCollapsed", node.getId());