/*     */ protected void layoutChildren() {
   /*  50 */ super.layoutChildren();
   /*     */
   /*  52 */ if (((ProgressBar) getSkinnable()).isIndeterminate()) {
     /*  53 */ return;
     /*     */ }
   /*     */
   /*  56 */ StackPane track = (StackPane) getChildren().get(0);
   /*  57 */ StackPane bar = (StackPane) getChildren().get(1);
   /*     */
   /*  59 */ if (!bar.getChildren().contains(this.topGradient)) {
     /*  60 */ bar.getChildren().add(this.topGradient);
     /*     */ }
   /*     */
   /*  63 */ if (!bar.getChildren().contains(this.bottomGradient)) {
     /*  64 */ bar.getChildren().add(this.bottomGradient);
     /*     */ }
   /*     */
   /*  67 */ if (!getChildren().contains(this.verticalLines)) {
     /*  68 */ getChildren().add(this.verticalLines);
     /*     */ }
   /*     */
   /*  71 */ Insets insets = getInsets();
   /*  72 */ double x = insets.getLeft();
   /*  73 */ double y = insets.getTop();
   /*  74 */ double w = getWidth() - (insets.getLeft() + insets.getRight());
   /*  75 */ double h = getHeight() - (insets.getTop() + insets.getBottom());
   /*     */
   /*  78 */ double scale = Math.floor(w / 14.0D) * 14.0D / w;
   /*     */
   /*  80 */ double barWidth = bar.getWidth() * scale;
   /*  81 */ double barHeight = bar.getHeight();
   /*     */
   /*  83 */ track.resize(track.getWidth() * scale, track.getHeight());
   /*  84 */ bar.resize(barWidth, barHeight);
   /*     */
   /*  86 */ this.topGradient.setX(x + this.gradientMargin);
   /*  87 */ this.topGradient.setY(y + 0.5D);
   /*  88 */ this.topGradient.setWidth(barWidth - 2.0D * this.gradientMargin);
   /*  89 */ this.topGradient.setHeight(
       barHeight * 0.3D / this.gradientRadius * this.gradientTweak);
   /*     */
   /*  91 */ this.bottomGradient.setX(x + this.gradientMargin);
   /*  92 */ this.bottomGradient.setWidth(barWidth - 2.0D * this.gradientMargin);
   /*  93 */ double gh = barHeight * 0.21D / this.gradientRadius * this.gradientTweak;
   /*  94 */ this.bottomGradient.setY(barHeight - gh - 0.5D);
   /*  95 */ this.bottomGradient.setHeight(gh);
   /*     */
   /*  97 */ this.verticalLines.setX(x);
   /*  98 */ this.verticalLines.setY(y);
   /*  99 */ this.verticalLines.setWidth(w * scale);
   /* 100 */ this.verticalLines.setHeight(h);
   /*     */ }
    @Override
    protected void layoutChildren() {
      // Position and size the circular background
      // double doneTextHeight = doneText.getLayoutBounds().getHeight();
      final Insets controlInsets = control.getInsets();
      final double left = snapSize(controlInsets.getLeft());
      final double right = snapSize(controlInsets.getRight());
      final double top = snapSize(controlInsets.getTop());
      final double bottom = snapSize(controlInsets.getBottom());

      /*
       ** use the min of width, or height, keep it a circle
       */
      final double areaW = control.getWidth() - left - right;
      final double areaH = control.getHeight() - top - bottom /*- textGap - doneTextHeight*/;
      final double radiusW = areaW / 2;
      final double radiusH = areaH / 2;
      final double radius = Math.round(Math.min(radiusW, radiusH)); // use round instead of floor
      final double centerX = snapPosition(left + radiusW);
      final double centerY = snapPosition(top + radius);

      // find radius that fits inside radius - insetsPadding
      final Insets indicatorInsets = indicator.getInsets();
      final double iLeft = snapSize(indicatorInsets.getLeft());
      final double iRight = snapSize(indicatorInsets.getRight());
      final double iTop = snapSize(indicatorInsets.getTop());
      final double iBottom = snapSize(indicatorInsets.getBottom());
      final double progressRadius =
          snapSize(
              Math.min(
                  Math.min(radius - iLeft, radius - iRight),
                  Math.min(radius - iTop, radius - iBottom)));

      indicatorCircle.setRadius(radius);
      indicator.setLayoutX(centerX);
      indicator.setLayoutY(centerY);

      arcShape.setRadiusX(progressRadius);
      arcShape.setRadiusY(progressRadius);
      progress.setLayoutX(centerX);
      progress.setLayoutY(centerY);

      // find radius that fits inside progressRadius - progressInsets
      final Insets progressInsets = progress.getInsets();
      final double pLeft = snapSize(progressInsets.getLeft());
      final double pRight = snapSize(progressInsets.getRight());
      final double pTop = snapSize(progressInsets.getTop());
      final double pBottom = snapSize(progressInsets.getBottom());
      final double indicatorRadius =
          snapSize(
              Math.min(
                  Math.min(progressRadius - pLeft, progressRadius - pRight),
                  Math.min(progressRadius - pTop, progressRadius - pBottom)));

      // find size of spare box that fits inside indicator radius
      double squareBoxHalfWidth = Math.ceil(Math.sqrt((indicatorRadius * indicatorRadius) / 2));
      // double squareBoxHalfWidth2 = indicatorRadius * (Math.sqrt(2) / 2);

      tick.setLayoutX(centerX - squareBoxHalfWidth);
      tick.setLayoutY(centerY - squareBoxHalfWidth);
      tick.resize(squareBoxHalfWidth + squareBoxHalfWidth, squareBoxHalfWidth + squareBoxHalfWidth);
      tick.setVisible(control.getProgress() >= 1);
    }
  @Override
  protected void layoutChildren(final double x, final double y, final double w, final double h) {

    final ScrollBar s = getSkinnable();

    /**
     * Compute the percentage length of thumb as (visibleAmount/range) if max isn't greater than min
     * then there is nothing to do here
     */
    double visiblePortion;
    if (s.getMax() > s.getMin()) {
      visiblePortion = s.getVisibleAmount() / (s.getMax() - s.getMin());
    } else {
      visiblePortion = 1.0;
    }

    if (s.getOrientation() == Orientation.VERTICAL) {
      if (!IS_TOUCH_SUPPORTED) {
        double decHeight = snapSize(decButton.prefHeight(-1));
        double incHeight = snapSize(incButton.prefHeight(-1));

        decButton.resize(w, decHeight);
        incButton.resize(w, incHeight);

        trackLength = snapSize(h - (decHeight + incHeight));
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        trackBackground.resizeRelocate(
            snapPosition(x), snapPosition(y), w, trackLength + decHeight + incHeight);
        decButton.relocate(snapPosition(x), snapPosition(y));
        incButton.relocate(snapPosition(x), snapPosition(y + h - incHeight));
        track.resizeRelocate(snapPosition(x), snapPosition(y + decHeight), w, trackLength);
        thumb.resize(
            snapSize(x >= 0 ? w : w + x),
            thumbLength); // Account for negative padding (see also RT-10719)
        positionThumb();
      } else {
        trackLength = snapSize(h);
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        track.resizeRelocate(snapPosition(x), snapPosition(y), w, trackLength);
        thumb.resize(
            snapSize(x >= 0 ? w : w + x),
            thumbLength); // Account for negative padding (see also RT-10719)
        positionThumb();
      }
    } else {
      if (!IS_TOUCH_SUPPORTED) {
        double decWidth = snapSize(decButton.prefWidth(-1));
        double incWidth = snapSize(incButton.prefWidth(-1));

        decButton.resize(decWidth, h);
        incButton.resize(incWidth, h);

        trackLength = snapSize(w - (decWidth + incWidth));
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        trackBackground.resizeRelocate(
            snapPosition(x), snapPosition(y), trackLength + decWidth + incWidth, h);
        decButton.relocate(snapPosition(x), snapPosition(y));
        incButton.relocate(snapPosition(x + w - incWidth), snapPosition(y));
        track.resizeRelocate(snapPosition(x + decWidth), snapPosition(y), trackLength, h);
        thumb.resize(
            thumbLength,
            snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
        positionThumb();
      } else {
        trackLength = snapSize(w);
        thumbLength =
            snapSize(Utils.clamp(minThumbLength(), (trackLength * visiblePortion), trackLength));

        track.resizeRelocate(snapPosition(x), snapPosition(y), trackLength, h);
        thumb.resize(
            thumbLength,
            snapSize(y >= 0 ? h : h + y)); // Account for negative padding (see also RT-10719)
        positionThumb();
      }

      s.resize(snapSize(s.getWidth()), snapSize(s.getHeight()));
    }

    // things should be invisible only when well below minimum length
    if (s.getOrientation() == Orientation.VERTICAL
            && h
                >= (computeMinHeight(
                        -1, (int) y, snappedRightInset(), snappedBottomInset(), (int) x)
                    - (y + snappedBottomInset()))
        || s.getOrientation() == Orientation.HORIZONTAL
            && w
                >= (computeMinWidth(-1, (int) y, snappedRightInset(), snappedBottomInset(), (int) x)
                    - (x + snappedRightInset()))) {
      trackBackground.setVisible(true);
      track.setVisible(true);
      thumb.setVisible(true);
      if (!IS_TOUCH_SUPPORTED) {
        incButton.setVisible(true);
        decButton.setVisible(true);
      }
    } else {
      trackBackground.setVisible(false);
      track.setVisible(false);
      thumb.setVisible(false);

      if (!IS_TOUCH_SUPPORTED) {
        /*
         ** once the space is big enough for one button we
         ** can look at drawing
         */
        if (h >= decButton.computeMinWidth(-1)) {
          decButton.setVisible(true);
        } else {
          decButton.setVisible(false);
        }
        if (h >= incButton.computeMinWidth(-1)) {
          incButton.setVisible(true);
        } else {
          incButton.setVisible(false);
        }
      }
    }
  }