public void setIcon(XElement parent, ImageResource icon) {
XElement anchor = getAnchor(parent);
XElement oldIcon = parent.selectNode("." + style.menuItemIcon());
if (oldIcon != null) {
oldIcon.removeFromParent();
}
if (icon != null) {
Element e = IconHelper.getElement(icon);
e.addClassName(style.menuItemIcon());
anchor.insertChild(e, 0);