void pack(boolean reflect){
  int newWidth=computeHeaderWidth();
  if (CommonUtils.isEmpty(children)) {
    int topIndex=grid.getTopIndex();
    int bottomIndex=grid.getBottomIndex();
    if (topIndex >= 0 && bottomIndex >= topIndex) {
      int itemCount=grid.getItemCount();
      for (int i=topIndex; i <= bottomIndex && i < itemCount; i++) {
        newWidth=Math.max(newWidth,computeCellWidth(element,grid.getRowElement(i)));
      }
    }
  }
 else {
    int childrenWidth=0;
    for (    GridColumn child : children) {
      child.pack(reflect);
      childrenWidth+=child.getWidth();
    }
    if (newWidth > childrenWidth) {
      GridColumn lastChild=children.get(children.size() - 1);
      lastChild.setWidth(lastChild.getWidth() + newWidth - childrenWidth);
    }
 else {
      newWidth=childrenWidth;
    }
  }
  if (reflect) {
    setWidth(newWidth,false);
  }
 else {
    this.width=newWidth;
  }
}

void pack ( boolean reflect ) { int newWidth = computeHeaderWidth ( ) ; if ( CommonUtils . isEmpty ( children ) ) { int topIndex = grid . getTopIndex ( ) ; int bottomIndex = grid . getBottomIndex ( ) ; if ( topIndex >= 0 && bottomIndex >= topIndex ) { int itemCount = grid . getItemCount ( ) ; for ( int i = topIndex ; i <= bottomIndex && i < itemCount ; i ++ ) { newWidth = Math . max ( newWidth , computeCellWidth ( element , grid . getRowElement ( i ) ) ) ; } } } else { int childrenWidth = 0 ; for ( GridColumn child : children ) { child . pack ( reflect ) ; childrenWidth += child . getWidth ( ) ; } if ( newWidth > childrenWidth ) { GridColumn lastChild = children . get ( children . size ( ) - 1 ) ; lastChild . setWidth ( lastChild . getWidth ( ) + newWidth - childrenWidth ) ; } else { newWidth = childrenWidth ; } } if ( reflect ) { setWidth ( newWidth , false ) ; } else { this . width = newWidth ; } }
causes the receiver to be resized to its preferred size .
