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

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

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

Node.getParent介绍

暂无

代码示例

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

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);
}

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

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();
  }
}

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

@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);
  }
}

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

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

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

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();
    }
  }
}

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

/**
   * 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();
  }
}

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

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) {

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

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;
}

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

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 );
}

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

private CalendarChart getChartParent() {
  Node parent = getParent();
  while (parent != null) {
    if (parent instanceof CalendarChart) {
      return (CalendarChart) parent;
    } else {
      parent = parent.getParent();
    }
  }
  return null;
}

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

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;
  }
}

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

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

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

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();
    }
  });
}

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

@Override
public FxContainer getParentContainer() {
 Parent parent = getNode().getParent();
 while (parent != null) {
  if (parent instanceof FxContainer) {
   return (FxContainer) parent;
  }
  parent = parent.getParent();
 }
 return null;
}

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

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());
  }
}

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

/**
*
* @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;
}

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

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();
  }
}

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

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

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

@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);
 }
}

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

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");
}

相关文章

微信公众号

最新文章

更多

Node类方法