javafx.scene.Node.getParent()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(6.8k)|赞(0)|评价(0)|浏览(233)

本文整理了Java中javafx.scene.Node.getParent()方法的一些代码示例,展示了Node.getParent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Node.getParent()方法的具体详情如下:
包路径:javafx.scene.Node
类名称:Node
方法名:getParent

Node.getParent介绍

暂无

代码示例

代码示例来源:origin: speedment/speedment

  1. private static ObservableList<Node> siblingsOf(Node node) {
  2. final Parent parent = node.getParent();
  3. if (parent == null) {
  4. throw new NullPointerException(
  5. "Can't delete node from 'null' parent."
  6. );
  7. }
  8. return childrenOf(parent);
  9. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private static void setConstraint(Node node, Object key, Object value) {
  2. if (value == null) {
  3. node.getProperties().remove(key);
  4. } else {
  5. node.getProperties().put(key, value);
  6. }
  7. if (node.getParent() != null) {
  8. node.getParent().requestLayout();
  9. }
  10. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. @Override
  2. protected void starting() {
  3. super.starting();
  4. if (node.getParent() instanceof JFXRippler) {
  5. JFXRippler rippler = (JFXRippler) node.getParent();
  6. BorderPane p = new BorderPane(node);
  7. p.setMaxWidth(((JFXHamburger) node).getWidth());
  8. p.setMinWidth(((JFXHamburger) node).getWidth());
  9. p.addEventHandler(MouseEvent.ANY, (event) -> {
  10. if (!event.isConsumed()) {
  11. event.consume();
  12. node.fireEvent(event);
  13. }
  14. });
  15. rippler.setControl(p);
  16. }
  17. if (this.getRate() == -1) {
  18. ((JFXHamburger) node).getChildren().get(1).setVisible(true);
  19. }
  20. }

代码示例来源:origin: jfoenixadmin/JFoenix

  1. if (scrollPane.getContent().getParent() != null) {
  2. scrollPane.getContent().getParent().addEventHandler(MouseEvent.DRAG_DETECTED, dragHandler);
  3. scrollPane.getContent().getParent().addEventHandler(ScrollEvent.ANY, scrollHandler);

代码示例来源:origin: jfoenixadmin/JFoenix

  1. private void updateDisclosureNode() {
  2. Node disclosureNode = ((JFXTreeTableCell<S, T>) getSkinnable()).getDisclosureNode();
  3. if (disclosureNode != null) {
  4. TreeItem<S> item = getSkinnable().getTreeTableRow().getTreeItem();
  5. final S value = item == null ? null : item.getValue();
  6. boolean disclosureVisible = value != null
  7. && !item.isLeaf()
  8. && value instanceof RecursiveTreeObject
  9. && ((RecursiveTreeObject) value).getGroupedColumn() == getSkinnable().getTableColumn();
  10. disclosureNode.setVisible(disclosureVisible);
  11. if (!disclosureVisible) {
  12. getChildren().remove(disclosureNode);
  13. } else if (disclosureNode.getParent() == null) {
  14. getChildren().add(disclosureNode);
  15. disclosureNode.toFront();
  16. } else {
  17. disclosureNode.toBack();
  18. }
  19. if (disclosureNode.getScene() != null) {
  20. disclosureNode.applyCss();
  21. }
  22. }
  23. }

代码示例来源:origin: ch.sahits.game/OpenPatricianDisplay

  1. /**
  2. * Return the parent of the node.
  3. * @param node child node
  4. * @return Parent nod of the <code>node</code>
  5. */
  6. public Parent getParent(Node node) {
  7. return node.getParent();
  8. }
  9. }

代码示例来源:origin: org.fxmisc.richtext/richtextfx

  1. private <T extends Node> void checkWithinParagraph(T shape) {
  2. if (shape.getParent() != this) {
  3. throw new IllegalArgumentException(String.format(
  4. "This ParagraphText is not the parent of the given shape (%s):\nExpected: %s\nActual: %s",
  5. shape, this, shape.getParent()
  6. ));
  7. }
  8. }
  9. private int getClampedCaretPosition(Caret caret) {

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. public static List<Node> nodesWithParent(Parent p, List<Node> nodes) {
  2. List<Node> result = new ArrayList<>();
  3. for (Node n : nodes) {
  4. if (p.equals(n.getParent())) {
  5. result.add(n);
  6. }
  7. }
  8. return result;
  9. }

代码示例来源:origin: no.tornado/tornadofx-controls

  1. public static <T> T findParentOfType( Node node, Class<T> type ){
  2. if( node == null ) return null;
  3. Parent parent = node.getParent();
  4. if( parent == null ) return null;
  5. if( type.isAssignableFrom(parent.getClass()) ) return (T)parent;
  6. return findParentOfType( parent, type );
  7. }

代码示例来源:origin: nl.cloudfarming.client/calendar-api

  1. private CalendarChart getChartParent() {
  2. Node parent = getParent();
  3. while (parent != null) {
  4. if (parent instanceof CalendarChart) {
  5. return (CalendarChart) parent;
  6. } else {
  7. parent = parent.getParent();
  8. }
  9. }
  10. return null;
  11. }

代码示例来源:origin: org.controlsfx/controlsfx

  1. private static DecorationPane getDecorationPaneInParentHierarchy(Node target) {
  2. Parent p = target.getParent();
  3. while (p != null) {
  4. if (p instanceof DecorationPane) {
  5. return (DecorationPane) p;
  6. }
  7. p = p.getParent();
  8. }
  9. return null;
  10. }
  11. }

代码示例来源:origin: org.tentackle/tentackle-fx

  1. @Override
  2. public FxContainer getParentContainer() {
  3. Parent parent = ((Node) getComponent()).getParent();
  4. return parent instanceof FxContainer ? (FxContainer) parent : null;
  5. }

代码示例来源:origin: com.powsybl/powsybl-gse-util

  1. public static <T> void registerAccelerator(Scene scene, KeyCodeCombination key, Class<T> aClass, Consumer<T> a) {
  2. scene.getAccelerators().put(key, () -> {
  3. Node node = scene.getFocusOwner();
  4. while (node != null) {
  5. if (aClass.isAssignableFrom(node.getClass())) {
  6. a.accept((T) node);
  7. break;
  8. }
  9. node = node.getParent();
  10. }
  11. });
  12. }

代码示例来源:origin: org.tentackle/tentackle-fx

  1. @Override
  2. public FxContainer getParentContainer() {
  3. Parent parent = getNode().getParent();
  4. while (parent != null) {
  5. if (parent instanceof FxContainer) {
  6. return (FxContainer) parent;
  7. }
  8. parent = parent.getParent();
  9. }
  10. return null;
  11. }

代码示例来源:origin: eu.mihosoft.vrl.workflow/vworkflows-fx

  1. private void removeConnector(Connector connector) {
  2. connectorList.remove(connector);
  3. ConnectorShape connectorShape = connectors.remove(connector);
  4. if (connectorShape != null && connectorShape.getNode().getParent() != null) {
  5. // TODO: remove connectors&connections?
  6. if (connector.isInput()) {
  7. shapeLists.get(LEFT).remove(connectorShape);
  8. } else if (connector.isOutput()) {
  9. shapeLists.get(RIGHT).remove(connectorShape);
  10. }
  11. NodeUtil.removeFromParent(connectorShape.getNode());
  12. }
  13. }

代码示例来源:origin: org.jfxtras/jfxtras-common

  1. /**
  2. *
  3. * @param node
  4. * @return The X coordinate of the node within the parent.
  5. */
  6. static public double xInParent(Node node, Node parent) {
  7. double lX = 0;
  8. while (node != parent) {
  9. double lXDelta = node.getBoundsInParent().getMinX();
  10. lX += lXDelta;
  11. //System.out.println("xInParent " + node + " -> " + lXDelta + " " + lX);
  12. node = node.getParent();
  13. }
  14. return lX;
  15. }

代码示例来源:origin: com.jfoenix/jfoenix

  1. private static void setConstraint(Node node, Object key, Object value) {
  2. if (value == null) {
  3. node.getProperties().remove(key);
  4. } else {
  5. node.getProperties().put(key, value);
  6. }
  7. if (node.getParent() != null) {
  8. node.getParent().requestLayout();
  9. }
  10. }

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

  1. @Override
  2. public void switchToEditView() {
  3. mode.set(InputMode.EDIT);
  4. final Node parent = viewLayout.getDisplay().getParent();
  5. if (parent != null) {
  6. parent.pseudoClassStateChanged(PseudoClass.getPseudoClass("editing"), true);
  7. }
  8. }

代码示例来源:origin: com.nexitia.emaginplatform/emagin-jfxcore-engine

  1. @Override
  2. public void switchToInfoView() {
  3. getChildren().clear();
  4. getChildren().add(viewLayout.getDisplay());
  5. getChildren().add(editLayout.getDisplay());
  6. mode.set(InputMode.VIEW);
  7. final Node parent = viewLayout.getDisplay().getParent();
  8. if (parent != null) {
  9. parent.pseudoClassStateChanged(PseudoClass.getPseudoClass("editing"), false);
  10. }
  11. }

代码示例来源:origin: com.aquafx-project/aquafx

  1. public AquaScrollBarSkin(ScrollBar scrollBar) {
  2. super(scrollBar);
  3. if (getNode().getParent() instanceof ScrollPane) {
  4. fadeable = true;
  5. }
  6. scrollBar.setVisible(!fadeable);
  7. registerChangeListener(scrollBar.hoverProperty(), "HOVER");
  8. registerChangeListener(scrollBar.valueProperty(), "VALUE");
  9. registerChangeListener(scrollBar.visibleProperty(), "VISIBLE");
  10. }

相关文章

Node类方法