Object node = treePath.getLastPathComponent();
if ((node != null) && (node instanceof DefaultMutableTreeNode)) {
LinkCheckBox checkbox = renderer.getRendereringComponent();
DefaultMutableTreeNode treeNode =
(DefaultMutableTreeNode) node;
Object userObject = treeNode.getUserObject();
resource = (CheckableResource) userObject;
// Don't change resource if disabled
if (!resource.isEnabled()) {
return resource;
}
boolean isChecked = checkbox.isSelected();
// Check/Uncheck the selected node. This code ONLY handles
// the clicked node. Not it's ancestors or decendants.
if (isChecked) {
((CheckableResource) resource).setSelected(true);