protected void closeLayout(ContainerContext currentContext, int index, boolean finished)
     throws BirtException {
   if (currentContext.root == null) {
     return;
   }
   if (!finished && currentContext.root.getChildrenCount() == 0) {
     return;
   }
   IStyle areaStyle = currentContext.root.getStyle();
   int height =
       currentContext.currentBP
           + getOffsetY()
           + getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_PADDING_BOTTOM))
           + getDimensionValue(areaStyle.getProperty(StyleConstants.STYLE_BORDER_BOTTOM_WIDTH));
   calculateSpecifiedHeight();
   if (specifiedHeight > height) {
     CSSValue verticalAlign = areaStyle.getProperty(IStyle.STYLE_VERTICAL_ALIGN);
     if (IStyle.BOTTOM_VALUE.equals(verticalAlign) || IStyle.MIDDLE_VALUE.equals(verticalAlign)) {
       int offset = specifiedHeight - height;
       if (IStyle.BOTTOM_VALUE.equals(verticalAlign)) {
         Iterator iter = currentContext.root.getChildren();
         while (iter.hasNext()) {
           AbstractArea child = (AbstractArea) iter.next();
           child.setAllocatedPosition(child.getAllocatedX(), child.getAllocatedY() + offset);
         }
       } else if (IStyle.MIDDLE_VALUE.equals(verticalAlign)) {
         Iterator iter = currentContext.root.getChildren();
         while (iter.hasNext()) {
           AbstractArea child = (AbstractArea) iter.next();
           child.setAllocatedPosition(child.getAllocatedX(), child.getAllocatedY() + offset / 2);
         }
       }
     }
     height = specifiedHeight;
   }
   currentContext.root.setHeight(height);
   if (parent != null) {
     parent.addToRoot(currentContext.root, index);
   } else {
     content.setExtension(IContent.LAYOUT_EXTENSION, currentContext.root);
   }
 }