Package javafx.geometry

Examples of javafx.geometry.Bounds


      }
      maxWidth = childWidth;
    }
    double clientX = 0, clientY = 0;
    if (move) {
      Bounds rect = getLayoutBounds();
      clientX = rect.getMinX();
      clientY = rect.getMinY();
    }
    double[] wraps = null;
    boolean wrapped = false;
    Bounds[] bounds = null;
    if (move && (justify.get() || fill.get() || center.get())) {
View Full Code Here


  @Override
  protected void layoutChildren() {
    super.layoutChildren();
   
    Bounds rect = getLayoutBounds();
    Node [] children = getChildren ().toArray(new Node[0]);
    int count = children.length;
    if (count == 0) return;
    double width = rect.getWidth() - marginWidth.get() * 2;
    double height = rect.getHeight() - marginHeight.get() * 2;
    if (horizontal.get()) {
      width -= (count - 1) * spacing.get();
      double x = rect.getMinX() + marginWidth.get(), extra = width % count;
      double y = rect.getMinY() + marginHeight.get(), cellWidth = width / count;
      for (int i=0; i<count; i++) {
        Node child = children [i];
        double childWidth = cellWidth;
        if (i == 0) {
          childWidth += extra / 2;
        } else {
          if (i == count - 1) childWidth += (extra + 1) / 2;
        }
        child.resizeRelocate(x, y, childWidth, height);
        x += childWidth + spacing.get();
      }
    } else {
      height -= (count - 1) * spacing.get();
      double x = rect.getMinX() + marginWidth.get(), cellHeight = height / count;
      double y = rect.getMinY() + marginHeight.get(), extra = height % count;
      for (int i=0; i<count; i++) {
        Node child = children [i];
        double childHeight = cellHeight;
        if (i == 0) {
          childHeight += extra / 2;
View Full Code Here

  protected void adjustWeights(List<SashRect> sashes, double curX, double curY) {
    for (SashRect sr : sashes) {
      double totalWeight = getWeight(sr.left) + getWeight(sr.right);
      double minSashValue = (((totalWeight / 100.0) * minSashPercent.get()) + 0.5);
     
      Bounds leftRect = getRectangle(sr.left);
      Bounds rightRect = getRectangle(sr.right);
      if (leftRect == null || rightRect == null)
        continue;

      double leftWeight;
      double rightWeight;

      if (sr.container.horizontal) {
        double left = leftRect.getMinX();
        double right = rightRect.getMinX() + rightRect.getWidth();
        double pct = (curX - left) / (right - left);
        leftWeight = ((totalWeight * pct) + 0.5);
        if (leftWeight < minSashValue)
          leftWeight = minSashValue;
        if (leftWeight > (totalWeight - minSashValue))
          leftWeight = totalWeight - minSashValue;
        rightWeight = totalWeight - leftWeight;
      } else {
        double top = leftRect.getMinY();
        double bottom = rightRect.getMinY() + rightRect.getHeight();
        double pct = (curY - top) / (bottom - top);
        leftWeight = (int)((totalWeight * pct) + 0.5);
       
        if (leftWeight < minSashValue)
          leftWeight = minSashValue;
View Full Code Here

  @Override
  protected void layoutChildren() {
    if (root == null)
      return;

    Bounds bounds = getLayoutBounds();
    bounds = new BoundingBox(bounds.getMinX() + marginLeft.get(),
        bounds.getMinY() + marginTop.get(),
        bounds.getWidth() - (marginLeft.get() + marginRight.get()),
        bounds.getHeight() - (marginTop.get() + marginBottom.get()));

    sashes.clear();
    tileSubNodes(bounds, root);
  }
View Full Code Here

  private void setRectangle(MUIElement node, Bounds bounds) {
    if (node.widget instanceof Node) {
      Node ctrl = (Node) node.widget;
      ctrl.resizeRelocate(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(), bounds.getHeight());
    } else if (node instanceof MGenericTile) {
      Bounds newRect = new BoundingBox(bounds.getMinX(), bounds.getMinY(), bounds.getWidth(),
          bounds.getHeight());
      node.widget = newRect;
    }
  }
View Full Code Here

    MUIElement prev = null;
    for (MUIElement subNode : visibleChildren) {
      // Add a 'sash' between this node and the 'prev'
      if (prev != null) {
        Bounds sashRect = sashContainer.horizontal ? new BoundingBox(
            tilePos, bounds.getMinY(), sashWidth.get(), bounds.getHeight())
            : new BoundingBox(bounds.getMinX(), tilePos, bounds.getWidth(),
                sashWidth.get());
        sashes.add(new SashRect(sashRect, sashContainer, prev, subNode));
        tilePos += sashWidth.get();
      }

      // Calc the new size as a %'age of the total
      double ratio = getWeight(subNode) / totalWeight;
      double newSize = availableWidth * ratio;
     
      Bounds subBounds = sashContainer.horizontal ? new BoundingBox(
          tilePos, bounds.getMinY(), newSize, bounds.getHeight()) : new BoundingBox(
          bounds.getMinX(), tilePos, bounds.getWidth(), newSize);
         
         
      tilePos += newSize;
View Full Code Here

TOP

Related Classes of javafx.geometry.Bounds

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.