@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final double labelOffset = getLabelOffset(); final CheckBox checkBox = getSkinnable(); final double boxWidth = snapSize(box.prefWidth(-1)); final double boxHeight = snapSize(box.prefHeight(-1)); final double computeWidth = Math.min(checkBox.prefWidth(-1), checkBox.minWidth(-1)); final double labelWidth = Math.min(computeWidth - boxWidth, w - snapSize(boxWidth)) + labelOffset; final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); final double maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x; if (invalid) { if(checkBox.isIndeterminate()){ playIndeterminateAnimation(true, false); }else if (checkBox.isSelected()) { playSelectAnimation(true, false); } invalid = false; } layoutLabelInArea(xOffset + boxWidth + labelOffset, yOffset, labelWidth, maxHeight, checkBox.getAlignment()); rippler.resize(boxWidth, boxHeight); positionInArea(rippler, xOffset, yOffset, boxWidth, maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos()); }
final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h); final double maxHeight = Math.max(contHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + contWidth, radioButton.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + x; maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos());
final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x; maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos());
final HPos hpos = alignment.getHpos(); final VPos vpos = alignment.getVpos();
@Override protected void layoutChildren() { List<Node> managed = getManagedChildren(); double width = getWidth(); double height = getHeight(); for (Node child : managed) { Bounds bounds = child.getBoundsInParent(); double left = Math.max(width - bounds.getWidth(), 0); double top = Math.max(height - bounds.getHeight(), 0); Pos childAlignment = Pos.BASELINE_RIGHT; // TODO consider translation of the child layoutInArea(child, left, top, bounds.getWidth(), bounds.getHeight(), child.getBaselineOffset(), getInsets(), childAlignment.getHpos(), childAlignment.getVpos()); } }
@Override protected void layoutChildren() { List<Node> managed = getManagedChildren(); double width = getWidth(); double height = getHeight(); if (originalWidth == null) { originalWidth = width; } if (originalHeight == null) { originalHeight = height; } double scaleX = Math.min(computeScaleX(width), 1); double scaleY = Math.min(computeScaleY(height), 1); double top = getInsets().getTop() + topMargin*scaleY; double right = getInsets().getRight(); double left = getInsets().getLeft() + leftMargin*scaleX; double bottom = getInsets().getBottom(); double baselineOffset = height/2; for (Node child : managed) { Pos childAlignment = StretchRightBottomLayout.getAlignment(child); // TODO consider translation of the child layoutInArea(child, left, top, width - left - right, height - top - bottom, baselineOffset, getMargin(child), childAlignment != null ? childAlignment.getHpos() : getAlignment().getHpos(), childAlignment != null ? childAlignment.getVpos() : getAlignment().getVpos()); } }
@Override protected void layoutChildren(final double x, final double y, final double w, final double h) { final double labelOffset = getLabelOffset(); final CheckBox checkBox = getSkinnable(); final double boxWidth = snapSize(box.prefWidth(-1)); final double boxHeight = snapSize(box.prefHeight(-1)); final double computeWidth = Math.min(checkBox.prefWidth(-1), checkBox.minWidth(-1)); final double labelWidth = Math.min(computeWidth - boxWidth, w - snapSize(boxWidth)) + labelOffset; final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); final double maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x; if (invalid) { if (checkBox.isIndeterminate()) { playIndeterminateAnimation(true, false); } else if (checkBox.isSelected()) { playSelectAnimation(true, false); } invalid = false; } layoutLabelInArea(xOffset + boxWidth + labelOffset, yOffset, labelWidth, maxHeight, checkBox.getAlignment()); rippler.resize(boxWidth, boxHeight); positionInArea(rippler, xOffset, yOffset, boxWidth, maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos()); }
final double labelHeight = Math.min(radioButton.prefHeight(labelWidth), h); final double maxHeight = Math.max(contHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + contWidth, radioButton.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, radioButton.getAlignment().getVpos()) + x; maxHeight, 0, radioButton.getAlignment().getHpos(), radioButton.getAlignment().getVpos());
final double labelHeight = Math.min(checkBox.prefHeight(labelWidth), h); maxHeight = Math.max(boxHeight, labelHeight); final double xOffset = computeXOffset(w, labelWidth + boxWidth, checkBox.getAlignment().getHpos()) + x; final double yOffset = computeYOffset(h, maxHeight, checkBox.getAlignment().getVpos()) + x; maxHeight, 0, checkBox.getAlignment().getHpos(), checkBox.getAlignment().getVpos());
private void updateTextPos() { double textWidth = textNode.getLayoutBounds().getWidth(); final double promptWidth = promptText == null ? 0 : promptText.getLayoutBounds().getWidth(); switch (getSkinnable().getAlignment().getHpos()) { case CENTER: linesWrapper.promptTextScale.setPivotX(promptWidth / 2); double midPoint = textRight.get() / 2; double newX = midPoint - textWidth / 2; if (newX + textWidth <= textRight.get()) { textTranslateX.set(newX); } break; case LEFT: linesWrapper.promptTextScale.setPivotX(0); break; case RIGHT: linesWrapper.promptTextScale.setPivotX(promptWidth); break; } }
private Point2D pointForBounds( Bounds bounds ) switch( nodePosition.getHpos() )
switch (position.getHpos()) { case CENTER: x = bounds.getMinX() + bounds.getWidth()/2;
switch (referencePoint.getHpos()) { case CENTER: x = bounds.getMinX() + bounds.getWidth()/2;
switch (referencePoint.getHpos()) { case CENTER: x = bounds.getMinX() + bounds.getWidth()/2;
final HPos hpos = alignment.getHpos(); final VPos vpos = alignment.getVpos();
switch (pos.getHpos()) { case CENTER: x += targetWidth/2 - decorationNodeWidth / 2.0;