當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。