Example #1
0
 @Override
 protected double computeMinWidth(double height) {
   if (getContentBias() == HORIZONTAL) {
     double maxPref = 0;
     final List<Node> children = getChildren();
     for (int i = 0, size = children.size(); i < size; i++) {
       Node child = children.get(i);
       if (child.isManaged()) {
         maxPref = Math.max(maxPref, child.prefWidth(-1));
       }
     }
     final Insets insets = getInsets();
     return insets.getLeft() + snapSize(maxPref) + insets.getRight();
   }
   return computePrefWidth(height);
 }
 /**
  * use all kinds of properties to calculate a hash for the layout
  *
  * @param node
  * @return
  */
 private Integer calculateHashcode(Node node) {
   StringBuffer lStringBuffer = new StringBuffer();
   lStringBuffer.append(node.minWidth(-1));
   lStringBuffer.append("x");
   lStringBuffer.append(node.minHeight(-1));
   lStringBuffer.append("/");
   lStringBuffer.append(node.prefWidth(-1));
   lStringBuffer.append("x");
   lStringBuffer.append(node.prefHeight(-1));
   lStringBuffer.append("/");
   lStringBuffer.append(node.maxWidth(-1));
   lStringBuffer.append("x");
   lStringBuffer.append(node.maxHeight(-1));
   lStringBuffer.append("/");
   lStringBuffer.append(node.getLayoutBounds().getWidth());
   lStringBuffer.append("x");
   lStringBuffer.append(node.getLayoutBounds().getHeight());
   lStringBuffer.append("/");
   lStringBuffer.append(node.isVisible());
   return lStringBuffer.toString().hashCode();
 }
 @Override
 protected double computePrefWidth(double height) {
   final Insets insets = getInsets();
   return insets.getLeft() + content.prefWidth(height) + insets.getRight();
 }