Package eu.essilab.lablib.checkboxtree
Interface CheckboxTreeCellRenderer
- All Superinterfaces:
TreeCellRenderer
- All Known Implementing Classes:
DefaultCheckboxTreeCellRenderer
,RadioButtonTree
The renderer for a cell in a CheckboxTree.
- Author:
- bigagli
-
Method Summary
Modifier and TypeMethodDescriptiongetTreeCellRendererComponent
(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) This method is redeclared just to underline that the implementor has to properly display the checking/graying state ofvalue
.boolean
isOnHotspot
(int x, int y) Returns whether the specified relative coordinates insist on the intended checkbox control.
-
Method Details
-
getTreeCellRendererComponent
Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) This method is redeclared just to underline that the implementor has to properly display the checking/graying state ofvalue
. This should go in the method parameters, but would imply changes to Swing classes that were considered unpractical. For example in DefaultCheckboxTreeCellRenderer the following code is used to get the checking/graying states:TreeCheckingModel checkingModel = ((CheckboxTree) tree).getCheckingModel(); TreePath path = tree.getPathForRow(row); boolean enabled = checkingModel.isPathEnabled(path); boolean checked = checkingModel.isPathChecked(path); boolean greyed = checkingModel.isPathGreyed(path);
You could use a QuadristateCheckbox to properly renderer the states (as in DefaultCheckboxTreeCellRenderer). -
isOnHotspot
boolean isOnHotspot(int x, int y) Returns whether the specified relative coordinates insist on the intended checkbox control. It is used by the CheckboxTree mouse listener to figure out whether to toggle a node or not.
-