MCPcopy Create free account
hub / github.com/OpenSourcePhysics/osp / getExpandedDescendants

Method getExpandedDescendants

unused/javax/swing/JTree.java:1956–1987  ·  view source on GitHub ↗

Returns an Enumeration of the descendants of the path parent that are currently expanded. If parent is not currently expanded, this will return null . If you expand/collapse nodes while iterating over the returned Enumeration this may n

(TreePath parent)

Source from the content-addressed store, hash-verified

1954 * <code>parent</code> is not currently expanded
1955 */
1956 public Enumeration<TreePath> getExpandedDescendants(TreePath parent) {
1957 if(!isExpanded(parent))
1958 return null;
1959
1960 Enumeration<TreePath> toggledPaths = expandedState.keys();
1961 Vector<TreePath> elements = null;
1962 TreePath path;
1963 Object value;
1964
1965 if(toggledPaths != null) {
1966 while(toggledPaths.hasMoreElements()) {
1967 path = toggledPaths.nextElement();
1968 value = expandedState.get(path);
1969 // Add the path if it is expanded, a descendant of parent,
1970 // and it is visible (all parents expanded). This is rather
1971 // expensive!
1972 if(path != parent && value != null &&
1973 ((Boolean)value).booleanValue() &&
1974 parent.isDescendant(path) && isVisible(path)) {
1975 if (elements == null) {
1976 elements = new Vector<TreePath>();
1977 }
1978 elements.addElement(path);
1979 }
1980 }
1981 }
1982 if (elements == null) {
1983 Set<TreePath> empty = Collections.emptySet();
1984 return Collections.enumeration(empty);
1985 }
1986 return elements.elements();
1987 }
1988
1989 /**
1990 * Returns true if the node identified by the path has ever been

Callers 1

getExpandedNodesMethod · 0.80

Calls 5

isExpandedMethod · 0.95
isVisibleMethod · 0.95
booleanValueMethod · 0.80
getMethod · 0.65
addElementMethod · 0.65

Tested by

no test coverage detected