Java Code Examples for javafx.scene.Parent#getParent()

The following examples show how to use javafx.scene.Parent#getParent() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RFXComponent.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public JSONObject findContextHeirarchy(Parent parent) {
    JSONObject r = null;
    JSONObject current = null;
    while (parent != null) {
        if (ContextManager.isContext(parent)) {
            JSONObject pContext = getContextJSONObject(parent);
            if (r == null) {
                r = pContext;
            }
            if (current != null) {
                current.put("container", pContext);
            }
            current = pContext;
        }
        parent = parent.getParent();
    }
    return addWindowParents(r, current);
}
 
Example 2
Source File: JavaFxUtils.java    From milkman with MIT License 5 votes vote down vote up
public static boolean isParent(Parent parent, Node child) {
    if (child == null) {
        return false;
    }
    Parent curr = child.getParent();
    while (curr != null) {
        if (curr == parent) {
            return true;
        }
        curr = curr.getParent();
    }
    return false;
}
 
Example 3
Source File: InternalWindow.java    From desktoppanefx with Apache License 2.0 5 votes vote down vote up
private List<String> collectStylesheets() {
    List<String> stylesheets = new ArrayList<>();
    Parent parent = getParent();
    while (parent != null) {
        stylesheets.addAll(parent.getStylesheets());
        parent = parent.getParent();
    }
    stylesheets.addAll(getScene().getStylesheets());
    return stylesheets;
}
 
Example 4
Source File: FXEventQueueDevice.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
private ScrollPane getParentScrollPane(Node target) {
    Parent p = target.getParent();
    while (p != null && !(p instanceof ScrollPane)) {
        p = p.getParent();
    }
    return (ScrollPane) p;
}
 
Example 5
Source File: JavaFXElementPropertyAccessor.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
final public List<String> getFieldNames() {
    List<String> fieldNames = new ArrayList<String>();
    Parent container = node.getParent();
    while (container != null) {
        findFields(node, container, fieldNames);
        container = container.getParent();
    }
    return fieldNames;
}
 
Example 6
Source File: TabToolComponent.java    From jmonkeybuilder with Apache License 2.0 5 votes vote down vote up
/**
 * Handle a click to a tab.
 */
private void processMouseClick(@NotNull final MouseEvent event) {
    final EventTarget target = event.getTarget();
    if (!(target instanceof Node)) return;

    final Node node = (Node) target;

    if (!(node instanceof Text) || node.getStyleClass().contains("tab-container")) {
        return;
    }

    final Parent label = node.getParent();

    if (!(label instanceof Label)) {
        return;
    }

    final Parent tabContainer = label.getParent();

    if (!tabContainer.getStyleClass().contains("tab-container")) {
        return;
    }

    if (isChangingTab()) {
        setChangingTab(false);
        return;
    }

    processExpandOrCollapse();
}
 
Example 7
Source File: DiagramTabToolBar.java    From JetUML with GNU General Public License v3.0 5 votes vote down vote up
private void copyToClipboard()
{
	Parent parent = getParent();
	while( parent.getClass() != EditorFrame.class )
	{
		parent = parent.getParent();
	}
	((EditorFrame)parent).copyToClipboard();	
}
 
Example 8
Source File: ViewShape.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
protected Optional<Canvas> getCanvasParent() {
	Parent parent = getParent();
	while(parent != null && !(parent instanceof Canvas)) {
		parent = parent.getParent();
	}

	if(parent != null) {
		return Optional.of((Canvas) parent);
	}
	return Optional.empty();
}
 
Example 9
Source File: Canvas.java    From latexdraw with GNU General Public License v3.0 5 votes vote down vote up
public ScrollPane getScrollPane() {
	Parent parent = getParent();
	while(parent != null && !(parent instanceof ScrollPane)) {
		parent = parent.getParent();
	}
	return (ScrollPane) parent;
}
 
Example 10
Source File: ScrollPaneSample2.java    From marathonv5 with Apache License 2.0 4 votes vote down vote up
private ScrollPane getParentScrollPane(Node target) {
    Parent p = target.getParent();
    while (p != null && !(p instanceof ScrollPane))
        p = p.getParent();
    return (ScrollPane) p;
}