예제 #1
0
 @Override
 public int getPreferredHeight() {
   int totalheight = verticalPadding;
   for (int i = 0; i < getNumChildren(); ++i) {
     Widget widget = getChild(i);
     int height = childDefaultHeight;
     if (!overrideHeight) {
       height = widget.getPreferredHeight();
     }
     if (heightOverrideExceptions.containsKey(widget)) {
       Integer heightSet = heightOverrideExceptions.get(widget);
       if (heightSet < 1) {
         height = widget.getPreferredHeight();
         heightSet = -heightSet;
         if ((heightSet != 0) && (heightSet > height)) {
           height = heightSet;
         }
       } else {
         height = heightSet;
       }
     }
     totalheight += height + defaultPadding;
   }
   return totalheight;
 }
예제 #2
0
  @Override
  public void layout() {
    int totalheight = verticalPadding;
    for (int i = 0; i < getNumChildren(); ++i) {
      Widget w = getChild(i);
      int height = childDefaultHeight;
      int width = childDefaultWidth;
      if (!overrideHeight) {
        height = w.getPreferredHeight();
      }
      if (heightOverrideExceptions.containsKey(w)) {
        Integer heightSet = heightOverrideExceptions.get(w);
        if (heightSet < 1) {
          height = w.getPreferredHeight();
          heightSet = -heightSet;
          if ((heightSet != 0) && (heightSet > height)) {
            height = heightSet;
          }
        } else {
          height = heightSet;
        }
      }
      if (widthOverrideExceptions.containsKey(w)) {
        Integer widthSet = widthOverrideExceptions.get(w);

        if (widthSet < 1) {
          width = w.getPreferredWidth();
          widthSet = -widthSet;
          if ((widthSet != 0) && (widthSet > width)) {
            width = widthSet;
          }
        } else {
          width = widthSet;
        }
      }
      w.setSize(width, height);
      w.setPosition((getX() + (getWidth() / 2)) - (width / 2), getY() + totalheight);
      totalheight += height + defaultPadding;
    }
  }