private static DecorationPane getDecorationPaneInParentHierarchy(Node target) { Parent p = target.getParent(); while (p != null) { if (p instanceof DecorationPane) { return (DecorationPane) p; } p = p.getParent(); } return null; } }
/** * Returns all ancestors of the specified node till the specified one is * reached. * * @param n scene graph node * @param parent scene graph parent * @return a list that contains all ancestors of the specified node */ public static List<Parent> getAncestors(Node n, Parent parent) { List<Parent> nParents = new ArrayList<>(); Parent p = n.getParent(); while (p != null && p != parent) { nParents.add(p); p = p.getParent(); } return nParents; }
@Override public FxContainer getParentContainer() { Parent parent = getNode().getParent(); while (parent != null) { if (parent instanceof FxContainer) { return (FxContainer) parent; } parent = parent.getParent(); } return null; }
public static void injectPane(Parent parent, Parent injectedParent, boolean useReflection) { if (parent == null) { throw new IllegalArgumentException("parent can not be null"); //$NON-NLS-1$ } List<Node> ownerParentChildren = getChildren(parent.getParent(), useReflection); // we've got the children list, now we need to insert a temporary // layout container holding our dialogs and opaque layer / effect // in place of the owner (the owner will become a child of the dialog // stack) int ownerPos = ownerParentChildren.indexOf(parent); ownerParentChildren.remove(ownerPos); ownerParentChildren.add(ownerPos, injectedParent); // now we install the parent as a child of the injectedParent getChildren(injectedParent, useReflection).add(0, parent); // copy in layout properties, etc, so that the dialogStack displays // properly in (hopefully) whatever layout the owner node is in injectedParent.getProperties().putAll(parent.getProperties()); }
Parent parent = p.getParent(); if (parent instanceof Group) { trEmpty++;
private void removeEmptyGroups() { for (Parent p : emptyParents) { Parent parent = p.getParent(); Group g = (Group) parent; g.getChildren().addAll(p.getChildrenUnmodifiable()); g.getChildren().remove(p); } }