@Override
 protected double computePrefWidth(double height) {
   final double left = snappedLeftInset();
   final double right = snappedRightInset();
   final double aw = snapSize(arrow.prefWidth(-1));
   return left + aw + right;
 }
 @Override
 protected void layoutChildren() {
   final double top = snappedTopInset();
   final double left = snappedLeftInset();
   final double bottom = snappedBottomInset();
   final double right = snappedRightInset();
   final double aw = snapSize(arrow.prefWidth(-1));
   final double ah = snapSize(arrow.prefHeight(-1));
   final double yPos = snapPosition((getHeight() - (top + bottom + ah)) / 2.0);
   final double xPos = snapPosition((getWidth() - (left + right + aw)) / 2.0);
   arrow.resizeRelocate(xPos + left, yPos + top, aw, ah);
 }
 @Override
 protected double computePrefWidth(double height) {
   double w = 0;
   for (Node child : getChildren()) {
     if (child instanceof Region) {
       Region region = (Region) child;
       if (region.getShape() != null) {
         w = Math.max(w, region.getShape().getLayoutBounds().getMaxX());
       } else {
         w = Math.max(w, region.prefWidth(height));
       }
     }
   }
   return w;
 }
Ejemplo n.º 4
0
 public void update(
     double closeOffset, double highOffset, double lowOffset, double candleWidth) {
   openAboveClose = closeOffset > 0;
   updateStyleClasses();
   highLowLine.setStartY(highOffset);
   highLowLine.setEndY(lowOffset);
   if (candleWidth == -1) {
     candleWidth = bar.prefWidth(-1);
   }
   if (openAboveClose) {
     bar.resizeRelocate(-candleWidth / 2, 0, candleWidth, closeOffset);
   } else {
     bar.resizeRelocate(-candleWidth / 2, closeOffset, candleWidth, closeOffset * -1);
   }
 }