558 if (skinBase != null) { 559 return skinBase.computeBaselineOffset(snappedTopInset(), snappedRightInset(), snappedBottomInset(), snappedLeftInset()); 560 } else { 561 final Node skinNode = getSkinNode(); 562 return skinNode == null ? 0 : skinNode.getBaselineOffset(); 563 } 564 } 565 566 /*************************************************************************** 567 * Implementation of layout bounds for the Control. We want to preserve * 568 * the lazy semantics of layout bounds. So whenever the width/height * 569 * changes on the node, we end up invalidating layout bounds. We then * 570 * recompute it on demand. * 571 **************************************************************************/ 572 573 /** {@inheritDoc} */ 574 @Override protected void layoutChildren() { 575 if (skinBase != null) { 576 final double x = snappedLeftInset(); 577 final double y = snappedTopInset(); 578 final double w = snapSize(getWidth()) - x - snappedRightInset(); 579 final double h = snapSize(getHeight()) - y - snappedBottomInset(); 580 skinBase.layoutChildren(x, y, w, h); 581 } else { 582 Node n = getSkinNode(); 583 if (n != null) { 584 n.resizeRelocate(0, 0, getWidth(), getHeight()); 585 } 586 } 587 } 588 589 /*************************************************************************** 590 * Forward the following to the skin * 591 **************************************************************************/ 592 593 /** 594 * Create a new instance of the default skin for this control. This is called to create a skin for the control if 595 * no skin is provided via CSS {@code -fx-skin} or set explicitly in a sub-class with {@code setSkin(...)}. 596 * 597 * @return new instance of default skin for this control. If null then the control will have no skin unless one 598 * is provided by css. 599 * @since JavaFX 8.0 | 558 if (skinBase != null) { 559 return skinBase.computeBaselineOffset(snappedTopInset(), snappedRightInset(), snappedBottomInset(), snappedLeftInset()); 560 } else { 561 final Node skinNode = getSkinNode(); 562 return skinNode == null ? 0 : skinNode.getBaselineOffset(); 563 } 564 } 565 566 /*************************************************************************** 567 * Implementation of layout bounds for the Control. We want to preserve * 568 * the lazy semantics of layout bounds. So whenever the width/height * 569 * changes on the node, we end up invalidating layout bounds. We then * 570 * recompute it on demand. * 571 **************************************************************************/ 572 573 /** {@inheritDoc} */ 574 @Override protected void layoutChildren() { 575 if (skinBase != null) { 576 final double x = snappedLeftInset(); 577 final double y = snappedTopInset(); 578 final double w = snapSizeX(getWidth()) - x - snappedRightInset(); 579 final double h = snapSizeY(getHeight()) - y - snappedBottomInset(); 580 skinBase.layoutChildren(x, y, w, h); 581 } else { 582 Node n = getSkinNode(); 583 if (n != null) { 584 n.resizeRelocate(0, 0, getWidth(), getHeight()); 585 } 586 } 587 } 588 589 /*************************************************************************** 590 * Forward the following to the skin * 591 **************************************************************************/ 592 593 /** 594 * Create a new instance of the default skin for this control. This is called to create a skin for the control if 595 * no skin is provided via CSS {@code -fx-skin} or set explicitly in a sub-class with {@code setSkin(...)}. 596 * 597 * @return new instance of default skin for this control. If null then the control will have no skin unless one 598 * is provided by css. 599 * @since JavaFX 8.0 |