public int compare(CheckedTreeNode o1, CheckedTreeNode o2) { final int w1 = getWeight(o1); final int w2 = getWeight(o2); if (w1 != w2) { return w1 - w2; } final TreeDescriptor d1 = (TreeDescriptor) o1.getUserObject(); final TreeDescriptor d2 = (TreeDescriptor) o2.getUserObject(); if (d1 instanceof BreakpointDescriptor && d2 instanceof BreakpointDescriptor) { return 0; } return d1.getDisplayString().compareTo(d2.getDisplayString()); }
public void customizeRenderer( JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { if (value instanceof CheckedTreeNode) { final CheckedTreeNode node = (CheckedTreeNode) value; final TreeDescriptor descriptor = getDescriptor(node); descriptor.customizeCellRenderer( getTextRenderer(), node, selected, node.isChecked(), expanded, leaf, hasFocus); if (descriptor instanceof BreakpointDescriptor) { myCheckbox.setEnabled(node.isEnabled() && !((BreakpointDescriptor) descriptor).isSlave()); } } }