void (boolean accepted, SettingsTreeNode node) { TreeNode parent = node.getParent(); if (parent instanceof SettingsTreeNode settingsParent) { settingsParent.accepted = false; if (!accepted) { //propagate disabled settings upwards updateAncestorsUi(false, settingsParent); } else { for (Enumeration children = parent.children(); children.hasMoreElements(); ) { Object child = children.nextElement(); if ((child instanceof SettingsTreeNode) && !((SettingsTreeNode) child).accepted) return; } settingsParent.accepted = true; updateAncestorsUi(true, settingsParent); } } }