Java Code Examples for javafx.scene.Node#toFront()

The following examples show how to use javafx.scene.Node#toFront() . 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: JFXTreeTableCellSkin.java    From JFoenix with Apache License 2.0 6 votes vote down vote up
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();
        }
    }
}
 
Example 2
Source File: ContentZoomPane.java    From JavaFXSmartGraph with MIT License 5 votes vote down vote up
public ContentZoomPane(Node content) {
    if (content == null) {
        throw new IllegalArgumentException("Content cannot be null.");
    }

    this.content = content;

    Node center = content;
    content.toFront();

    setCenter(center);
    setRight(createSlider());

    enablePanAndZoom();
}
 
Example 3
Source File: MosaicPane.java    From Mosaic with Apache License 2.0 4 votes vote down vote up
public SurfaceListener<T> getSurfaceObserver() {
	SurfaceListener<T> l = new SurfaceListener<T>() {
		public void changed(ChangeType changeType, Node n, String id, Rectangle2D r1, Rectangle2D r2) {
			switch(changeType) {
		    	case REMOVE_DISCARD: {
		    		content.getChildren().remove(n);
		    		requestLayout();
		    		break;
		    	}
		    	case RESIZE_RELOCATE: {
		    		n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight());
					requestLayout();
			        
			        break;
		    	}
		    	case ADD_COMMIT: {
		    		content.getChildren().add(n);
		    		n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight());
					requestLayout();
			        break;
		    	}
		    	case MOVE_BEGIN: {
		    		DropShadow shadow = new DropShadow();
		    		shadow.setOffsetX(10);
		    		shadow.setOffsetY(10);
		    		shadow.setRadius(5);
		    		shadow.setColor(Color.GRAY);
		    		n.setEffect(shadow);
		    		n.toFront();
		    		n.setOpacity(.5);
		    		break;
		    	}
		    	case RELOCATE_DRAG_TARGET: {
		    		n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight());
					requestLayout();
		    		break;
		    	}
		    	case RESIZE_DRAG_TARGET: {
		    		n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight());
					requestLayout();
			        break;
		    	}
		    	case MOVE_END: {
		    		n.setOpacity(1);
		    		n.setEffect(null);
		    		break;
		    	}
		    	case ANIMATE_RESIZE_RELOCATE: {
		    		n.resizeRelocate(r2.getX(), r2.getY(), r2.getWidth(), r2.getHeight());
					requestLayout();
			        break;
		    	}
		    	default: break;
	    	}
		}
	};
	return l;
}