当前位置: 首页>>代码示例>>Java>>正文


Java Node.getParent方法代码示例

本文整理汇总了Java中javafx.scene.Node.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Node.getParent方法的具体用法?Java Node.getParent怎么用?Java Node.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javafx.scene.Node的用法示例。


在下文中一共展示了Node.getParent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: found

import javafx.scene.Node; //导入方法依赖的package包/类
protected List<IJavaFXElement> found(List<IJavaFXElement> pElements, IJavaFXAgent driver) {
    List<IJavaFXElement> r = new ArrayList<IJavaFXElement>();
    for (IJavaFXElement je : pElements) {
        Node component = je.getComponent();
        if (!(component instanceof Parent)) {
            continue;
        }
        int index = getIndexOfComponentInParent(component);
        if (index < 0) {
            continue;
        }
        Parent parent = component.getParent();
        JFXWindow topContainer = driver.switchTo().getTopContainer();
        ObservableList<Node> children = parent.getChildrenUnmodifiable();
        for (int i = index + 1; i < children.size(); i++) {
            Node c = children.get(i);
            IJavaFXElement je2 = JavaFXElementFactory.createElement(c, driver, driver.switchTo().getTopContainer());
            if (sibling.matchesSelector(je2).size() > 0) {
                IJavaFXElement e = topContainer.addElement(JavaFXElementFactory.createElement(c, driver, topContainer));
                if (!r.contains(e)) {
                    r.add(e);
                }
            }
        }
    }
    return r;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:28,代码来源:GeneralSiblingSelector.java

示例2: zoomInAndCenter

import javafx.scene.Node; //导入方法依赖的package包/类
private static void zoomInAndCenter(Node node, double initialWidth, double initialHeight, boolean preserveRatio) {
    Parent parent = node.getParent();

    node.toFront();

    Bounds parentBoundsInParent = parent.getBoundsInLocal();

    double xScaleRatio = parentBoundsInParent.getMaxX() / initialWidth;
    double yScaleRatio = parentBoundsInParent.getMaxY() / initialHeight;

    if (preserveRatio) {
        double bestScaleRatio = Math.min(xScaleRatio, yScaleRatio);
        node.setScaleX(bestScaleRatio);
        node.setScaleY(bestScaleRatio);
    } else {
        node.setScaleX(xScaleRatio);
        node.setScaleY(yScaleRatio);
    }

    Bounds boundsInParent = node.getBoundsInParent();

    double translateX = -1 * Math.abs(boundsInParent.getMinY());
    double translateY = -1 * Math.abs(boundsInParent.getMinY());

    node.setTranslateX(translateX);
    node.setTranslateY(translateY);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:28,代码来源:StatsDisplay.java

示例3: inHierarchy

import javafx.scene.Node; //导入方法依赖的package包/类
/**
 * Returns whether a MouseEvent happened in a certain node or not.
 * @param node The node the event happened in.
 * @param potentialHierarchyElement The node to check if the event
 *                                  happened in.
 * @return True if the event happened in the checked node, false
 * otherwise.
 */
public static boolean inHierarchy(Node node, Node potentialHierarchyElement) {
    if (potentialHierarchyElement == null) {
        return true;
    }
    while (node != null) {
        if (Objects.equals(node, potentialHierarchyElement)) {
            return true;
        }
        node = node.getParent();
    }
    return false;
}
 
开发者ID:deltadak,项目名称:plep,代码行数:21,代码来源:SlidingPane.java

示例4: getRowNumberLastFocusedTF

import javafx.scene.Node; //导入方法依赖的package包/类
/**
 * Returns the row index of the last focused textfield in the proof.
 *
 * @return row index of the last focused textfield in the proof, otherwise it returns -1
 */
public int getRowNumberLastFocusedTF() {
    if (lastFocusedTf != null) {
        Node check  = lastFocusedTf.getParent();
        if (!(check instanceof RowPane))
            check = check.getParent();
        int idx = rList.indexOf(check);
        if (idx != -1)
            return idx + 1;
    }
    return -1;
}
 
开发者ID:nonilole,项目名称:Conan,代码行数:17,代码来源:ProofView.java

示例5: found

import javafx.scene.Node; //导入方法依赖的package包/类
protected List<IJavaFXElement> found(List<IJavaFXElement> pElements, IJavaFXAgent driver) {
    List<IJavaFXElement> r = new ArrayList<IJavaFXElement>();
    for (IJavaFXElement je : pElements) {
        Node component = je.getComponent();
        if (!(component instanceof Parent)) {
            continue;
        }
        int index = getIndexOfComponentInParent(component);
        if (index < 0) {
            continue;
        }
        Parent parent = component.getParent();
        JFXWindow topContainer = driver.switchTo().getTopContainer();
        index += 1;
        if (index < parent.getChildrenUnmodifiable().size()) {
            Node c = parent.getChildrenUnmodifiable().get(index);
            IJavaFXElement je2 = JavaFXElementFactory.createElement(c, driver, driver.switchTo().getTopContainer());
            List<IJavaFXElement> matched = sibling.matchesSelector(je2);
            for (IJavaFXElement javaElement : matched) {
                IJavaFXElement e = topContainer.addElement(javaElement);
                if (!r.contains(e)) {
                    r.add(e);
                }
            }
        }
    }
    return r;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:AdjacentSiblingSelector.java

示例6: getIndexOfComponentInParent

import javafx.scene.Node; //导入方法依赖的package包/类
private int getIndexOfComponentInParent(Node component) {
    Parent parent = component.getParent();
    if (parent == null) {
        return -1;
    }
    ObservableList<Node> components = parent.getChildrenUnmodifiable();
    for (int i = 0; i < components.size(); i++) {
        if (components.get(i) == component) {
            return i;
        }
    }
    return -1;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:AdjacentSiblingSelector.java

示例7: getParentScrollPane

import javafx.scene.Node; //导入方法依赖的package包/类
private ScrollPane getParentScrollPane(Node target) {
    Parent p = target.getParent();
    while (p != null && !(p instanceof ScrollPane)) {
        p = p.getParent();
    }
    return (ScrollPane) p;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:8,代码来源:FXEventQueueDevice.java

示例8: getTopNode

import javafx.scene.Node; //导入方法依赖的package包/类
private Node getTopNode(Node n) {
    Node parent = null;
    while (parent == null) {
        if (ContextManager.isContext(n)) {
            parent = n;
        } else if (n.getScene().getRoot() == n) {
            parent = n;
        } else {
            n = n.getParent();
        }
    }
    return parent;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JavaFXElementPropertyAccessor.java

示例9: onCheckBox

import javafx.scene.Node; //导入方法依赖的package包/类
protected boolean onCheckBox(Node target) {
    Node parent = target;
    while (parent != null) {
        if (parent instanceof CheckBox)
            return true;
        parent = parent.getParent();
    }
    return false;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JavaFXElementPropertyAccessor.java

示例10: getRootNode

import javafx.scene.Node; //导入方法依赖的package包/类
static Node getRootNode(final Node node) {
	Node n = node;
	while (n.getParent() != null) {
		n = n.getParent();
	}
	return n;
}
 
开发者ID:kerner1000,项目名称:javafx-chart-zooming,代码行数:8,代码来源:ZoomManager.java

示例11: isMenuBar

import javafx.scene.Node; //导入方法依赖的package包/类
private boolean isMenuBar(Node ownerNode) {
    Node parent = ownerNode;
    while (parent != null) {
        if (parent instanceof MenuBar) {
            this.menuBar = (MenuBar) parent;
            return true;
        }
        parent = parent.getParent();
    }
    return false;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:12,代码来源:RFXMenuItem.java

示例12: setConstraint

import javafx.scene.Node; //导入方法依赖的package包/类
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();
    }
}
 
开发者ID:Jibbow,项目名称:FastisFX,代码行数:11,代码来源:PercentPane.java

示例13: isScrollBar

import javafx.scene.Node; //导入方法依赖的package包/类
private boolean isScrollBar(Node node) {
    boolean result = false;
    if (node instanceof ScrollBar) {
        result = true;
    } else if (node.getParent() != null) {
        return isScrollBar(node.getParent());
    }

    return result;
}
 
开发者ID:dlemmermann,项目名称:CalendarFX,代码行数:11,代码来源:AutoScrollPane.java

示例14: resetToOriginalIndexInParent

import javafx.scene.Node; //导入方法依赖的package包/类
private static void resetToOriginalIndexInParent(Node node, int originalIndexInParent) {
    Parent parent = node.getParent();

    VBox parentVBox = (VBox) parent;

    parentVBox.getChildren().remove(node);
    parentVBox.getChildren().add(originalIndexInParent, node);
}
 
开发者ID:schwabdidier,项目名称:GazePlay,代码行数:9,代码来源:StatsDisplay.java

示例15: findAncestor

import javafx.scene.Node; //导入方法依赖的package包/类
private static <T extends Node & MouseTrackable> LocationAware findAncestor(T subject) {
    LocationAware parent = null;

    Node descendant = subject;
    while (parent == null && descendant != null) {
        if (descendant.getParent() instanceof MouseTrackable) {
            parent = (LocationAware) descendant.getParent();
        }
        descendant = descendant.getParent();
    }

    return parent;
}
 
开发者ID:ulriknyman,项目名称:H-Uppaal,代码行数:14,代码来源:CanvasDragHelper.java


注:本文中的javafx.scene.Node.getParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。