Example #1
0
 @Override
 protected double computeMinHeight(double width) {
   if (getContentBias() == VERTICAL) {
     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.prefHeight(-1));
       }
     }
     final Insets insets = getInsets();
     return insets.getTop() + snapSize(maxPref) + insets.getBottom();
   }
   return computePrefHeight(width);
 }
 /**
  * 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 computePrefHeight(double width) {
   final Insets insets = getInsets();
   return insets.getTop() + content.prefHeight(width) + insets.getBottom();
 }