private static ObservableList<Node> siblingsOf(Node node) { final Parent parent = node.getParent(); if (parent == null) { throw new NullPointerException( "Can't delete node from 'null' parent." ); } return childrenOf(parent); }
@Override protected void starting() { super.starting(); if (node.getParent() instanceof JFXRippler) { JFXRippler rippler = (JFXRippler) node.getParent(); BorderPane p = new BorderPane(node); p.setMaxWidth(((JFXHamburger) node).getWidth()); p.setMinWidth(((JFXHamburger) node).getWidth()); p.addEventHandler(MouseEvent.ANY, (event) -> { if (!event.isConsumed()) { event.consume(); node.fireEvent(event); } }); rippler.setControl(p); } if (this.getRate() == -1) { ((JFXHamburger) node).getChildren().get(1).setVisible(true); } }
private void updateDisclosureNode() { Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode(); if (disclosureNode != null) { TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem(); final S value = item == null ? null : item.getValue(); boolean disclosureVisible = value != null && !item.isLeaf() && value instanceof RecursiveTreeObject && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn(); disclosureNode.setVisible(disclosureVisible); if (!disclosureVisible) { getChildren().remove(disclosureNode); } else if (disclosureNode.getParent() == null) { getChildren().add(disclosureNode); disclosureNode.toFront(); } else { disclosureNode.toBack(); } if (disclosureNode.getScene() != null) { disclosureNode.applyCss(); } } }
/** * Return the parent of the node. * @param node child node * @return Parent nod of the <code>node</code> */ public Parent getParent(Node node) { return node.getParent(); } }
private <T extends Node> void checkWithinParagraph(T shape) { if (shape.getParent() != this) { throw new IllegalArgumentException(String.format( "This ParagraphText is not the parent of the given shape (%s):\nExpected: %s\nActual: %s", shape, this, shape.getParent() )); } } private int getClampedCaretPosition(Caret caret) {
public static List<Node> nodesWithParent(Parent p, List<Node> nodes) { List<Node> result = new ArrayList<>(); for (Node n : nodes) { if (p.equals(n.getParent())) { result.add(n); } } return result; }
public static <T> T findParentOfType( Node node, Class<T> type ){ if( node == null ) return null; Parent parent = node.getParent(); if( parent == null ) return null; if( type.isAssignableFrom(parent.getClass()) ) return (T)parent; return findParentOfType( parent, type ); }
private CalendarChart getChartParent() { Node parent = getParent(); while (parent != null) { if (parent instanceof CalendarChart) { return (CalendarChart) parent; } else { parent = parent.getParent(); } } return null; }
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; } }
@Override public FxContainer getParentContainer() { Parent parent = ((Node) getComponent()).getParent(); return parent instanceof FxContainer ? (FxContainer) parent : null; }
public static <T> void registerAccelerator(Scene scene, KeyCodeCombination key, Class<T> aClass, Consumer<T> a) { scene.getAccelerators().put(key, () -> { Node node = scene.getFocusOwner(); while (node != null) { if (aClass.isAssignableFrom(node.getClass())) { a.accept((T) node); break; } node = node.getParent(); } }); }
@Override public FxContainer getParentContainer() { Parent parent = getNode().getParent(); while (parent != null) { if (parent instanceof FxContainer) { return (FxContainer) parent; } parent = parent.getParent(); } return null; }
private void removeConnector(Connector connector) { connectorList.remove(connector); ConnectorShape connectorShape = connectors.remove(connector); if (connectorShape != null && connectorShape.getNode().getParent() != null) { // TODO: remove connectors&connections? if (connector.isInput()) { shapeLists.get(LEFT).remove(connectorShape); } else if (connector.isOutput()) { shapeLists.get(RIGHT).remove(connectorShape); } NodeUtil.removeFromParent(connectorShape.getNode()); } }
/** * * @param node * @return The X coordinate of the node within the parent. */ static public double xInParent(Node node, Node parent) { double lX = 0; while (node != parent) { double lXDelta = node.getBoundsInParent().getMinX(); lX += lXDelta; //System.out.println("xInParent " + node + " -> " + lXDelta + " " + lX); node = node.getParent(); } return lX; }
@Override public void switchToEditView() { mode.set(InputMode.EDIT); final Node parent = viewLayout.getDisplay().getParent(); if (parent != null) { parent.pseudoClassStateChanged(PseudoClass.getPseudoClass("editing"), true); } }
@Override public void switchToInfoView() { getChildren().clear(); getChildren().add(viewLayout.getDisplay()); getChildren().add(editLayout.getDisplay()); mode.set(InputMode.VIEW); final Node parent = viewLayout.getDisplay().getParent(); if (parent != null) { parent.pseudoClassStateChanged(PseudoClass.getPseudoClass("editing"), false); } }
public AquaScrollBarSkin(ScrollBar scrollBar) { super(scrollBar); if (getNode().getParent() instanceof ScrollPane) { fadeable = true; } scrollBar.setVisible(!fadeable); registerChangeListener(scrollBar.hoverProperty(), "HOVER"); registerChangeListener(scrollBar.valueProperty(), "VALUE"); registerChangeListener(scrollBar.visibleProperty(), "VISIBLE"); }