void (ActionEvent e) { int selectedRow = getSelectedRow(); if (isEditing() || selectedRow == -1) { return; } Property property = myProperties.get(selectedRow); List<Property> children = getChildren(property); if (!children.isEmpty()) { if (myExpand) { if (!isExpanded(property)) { expand(selectedRow); } else if (mySelect) { restoreSelection(children.get(0)); } } else if (isExpanded(property)) { collapse(selectedRow); } else if (mySelect) { Property parent = property.getParent(); if (parent != null) { restoreSelection(parent); } } } else if (!myExpand && mySelect) { Property parent = property.getParent(); if (parent != null) { restoreSelection(parent); } } }