for (Node child : nodes.getChildrenUnmodifiable()) {
private static void setConstraint(Node node, Object key, Object value) { if (value == null) { node.getProperties().remove(key); } else { node.getProperties().put(key, value); } if (node.getParent() != null) { node.getParent().requestLayout(); } }
((Parent) child).layout(); double alignedWidth = alignToChild.getLayoutBounds().getWidth(); double alignedX = alignToChild.getLayoutX();
private void removeEmptyGroups() { for (Parent p : emptyParents) { Parent parent = p.getParent(); Group g = (Group) parent; g.getChildren().addAll(p.getChildrenUnmodifiable()); g.getChildren().remove(p); } }
public static Node getFirstTargetNode(Parent p) { if (p == null || isDisabledOrInvisible(p)) return null; final ParentTraversalEngine impl_traversalEngine = p.getImpl_traversalEngine(); if (impl_traversalEngine!= null && impl_traversalEngine.canTraverse()) { Node selected = impl_traversalEngine.selectFirst(); if (selected != null) { return selected; } } List<Node> parentsNodes = p.getChildrenUnmodifiable(); for (Node n : parentsNodes) { if (isDisabledOrInvisible(n)) continue; final ParentTraversalEngine parentEngine = n instanceof Parent ? ((Parent)n).getImpl_traversalEngine() : null; if (parentEngine != null ? parentEngine.isParentTraversable() : n.isFocusTraversable()) { return n; } if (n instanceof Parent) { Node result = getFirstTargetNode((Parent)n); if (result != null) return result; } } return null; }
@SuppressWarnings("deprecation") private static void registerTraversalEngine(final Parent parent, final TraversalEngine te) { parent.setImpl_traversalEngine(te); for (Node child : parent.getChildrenUnmodifiable()) { if (child instanceof Parent) { registerTraversalEngine((Parent) child, te); } } if (parent instanceof TitledPane) { final TitledPane tp = (TitledPane) parent; if (tp.getContent() instanceof Parent) { registerTraversalEngine((Parent) tp.getContent(), te); } } }
public static void addToNode(Parent node ){ node.getStylesheets().add(CssUtil.class.getResource("/de/factoryfx/javafx/css/app.css").toExternalForm()); }
result.addAll(((Parent) n).getStylesheets()); result.addAll(p.getStylesheets()); scene = p.getScene();
private InfoPopup(@Nonnull String message) { setAutoHide(true); setAutoFix(true); Parent root = createContent(message); root.getStylesheets().add(getClass().getResource("InfoPopupService.css").toExternalForm()); root.getStyleClass().add("sick-uiglv2"); root.getStyleClass().add("info-popup"); getContent().add(root); }
T controller = (T) controllers.get(controllerClass); if (controller != null) { if (controller.getView().isVisible()) { throw new FxRuntimeException(controllerClass + " is a singleton and already visible"); view.getStylesheets().add(cssUrl.toExternalForm());
@Override public Stage getStage() { Stage stage = null; Scene scene = getView().getScene(); if (scene != null && scene.getRoot() == getView()) { Window window = scene.getWindow(); if (window instanceof Stage) { stage = (Stage) window; } } return stage; }
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; } }
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()); }
groupsTotal++; Parent p = (Parent) node; for (Node n : p.getChildrenUnmodifiable()) { optimize(n); Parent parent = p.getParent(); if (parent instanceof Group) { trEmpty++;
public static void addToParent(Parent parent) { parent.getStylesheets().add(IconFonts.class.getResource("fonts.css").toExternalForm()); } }
@Override public void start(Stage stage) throws Exception { Preconditions.checkNotNull(viewBean, "No view to set up! Have you called init() before?"); Scene scene = viewBean.getView().getScene(); if (scene == null) { Scene x = new Scene(viewBean.getView()); stage.setScene(x); } else { stage.setScene(scene); } stage.show(); }
/** * 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; }
parent.getChildrenUnmodifiable().addListener(new ListChangeListener<Node>() { @Override public void onChanged(javafx.collections.ListChangeListener.Change<? extends Node> c) { for (Node component : parent.getChildrenUnmodifiable()) { if (component instanceof Pane) { ((Pane) component).getChildren().addListener(new ListChangeListener<Node>() {
void addCSSIfAvailable(Parent parent) { URL uri = getClass().getResource(getStyleSheetName()); if (uri == null) { return; } String uriToCss = uri.toExternalForm(); parent.getStylesheets().add(uriToCss); }
@Override protected void layoutChildren() { getParent().requestLayout(); super.layoutChildren(); for (Node n : getManagedChildren()) { if (n instanceof Region) { Region p = (Region) n; double width = Math.max(p.getMinWidth(), p.getPrefWidth()); double height = Math.max(p.getMinHeight(), p.getPrefHeight()); n.resize(width, height); double nX = Math.min(0, n.getLayoutX()); double nY = Math.min(0, n.getLayoutY()); n.relocate(nX, nY); } } }