if ( !vertical ) T.add(L,col++,row); else { T.mergeCells(col,row,col+1,row); T.add(L,col,row++); if ( _showAllSubPages ) { if (  n.getNodeID() != rootNode ) row = addSubLinks(iwc,T,col,row,L,n);
if (!vertical) T.add(L, col++, row); else { T.mergeCells(col, row, col + 1, row); T.add(L, col, row++); if (_showAllSubPages) { if (n.getNodeID() != rootNode) row = addSubLinks(iwc, T, col, row, L, n); } else { if (_showSubPages && (n.getNodeID() == currentPageId || n.getNodeID() == parentPageId) && n.getNodeID() != rootNode) { row = addSubLinks(iwc, T, col, row, L, n); } } }  if (_spacer != null && iterator.hasNext()) { if (!vertical) T.add(_spacer, col++, row); else T.add(_spacer, col, row++); }  if (_spaceBetween > 0 && vertical) { T.add(spaceBetween, col, row++); } }  add(T);
  public void main(IWContext iwc){    setStyles();    if ( rootNode == -1 ) {      rootNode = BuilderLogic.getStartPageId(iwc);    }    String sCurrentPageId = iwc.getParameter(com.idega.builder.business.BuilderLogic.IB_PAGE_PARAMETER);    currentPageId = sCurrentPageId !=null ? Integer.parseInt(sCurrentPageId):rootNode;    try {      parentPageId = Integer.parseInt(iwc.getParameter("parent_id"));    }    catch (NumberFormatException e) {      parentPageId = -1;    }    if ( parentPageId == -1 && _addParentID )      parentPageId = rootNode;    PageTreeNode node = new PageTreeNode(rootNode, iwc);    boolean bottom = !HomeVerticalAlignment.equals(VerticalAlignmentHandler.TOP);    boolean left = !HomeHorizontalAlignment.equals(HorizontalAlignmentHandler.RIGHT);    boolean vertical = viewType == VERTICAL;    Vector nodeVector = new Vector();    if ( withRootAsHome && ((!bottom && vertical) || (!vertical && left)) ) {      nodeVector.add(node);      withRootAsHome = false;    }    Iterator iter = node.getChildren();    while (iter.hasNext())      nodeVector.add((PageTreeNode) iter.next());    if ( withRootAsHome && (bottom || !left) )      nodeVector.add(node);    int row = 1,col = 1;    Table T = new Table();    T.setCellpadding(cellPadding);    T.setCellspacing(cellSpacing);    if(tableBackGroundColor !=null)      T.setColor(tableBackGroundColor);    if(width != null)      T.setWidth(width);    if(height != null)      T.setHeight(height);    Link L = null;    Text text = null;    spacer = Table.getTransparentCell(iwc);      spacer.setWidth(_widthFromIcon);    subNodeImage = (Image) spacer.clone();      subNodeImage.setWidth(_subWidthFromParent);      subNodeImage.setHeight(2);    Image spaceBetween = (Image) spacer.clone();      spaceBetween.setHeight(_spaceBetween);    Iterator iterator = nodeVector.iterator();    while (iterator.hasNext()) {      PageTreeNode n = (PageTreeNode) iterator.next();      L = getLink(n.getNodeName(),n.getNodeID(),rootNode,_addParentID,false);      if ( _iconImage != null ) {	Image image = new Image(_iconImage.getMediaURL(iwc));	if ( _iconOverImage != null )	  L.setOnMouseOverImage(image,_iconOverImage);	T.add(image,col,row);	T.add(spacer,col,row);	if(!vertical)	  col++;      }      if ( !vertical )	T.add(L,col++,row);      else {	T.mergeCells(col,row,col+1,row);	T.add(L,col,row++);	if ( _showAllSubPages ) {	  if (  n.getNodeID() != rootNode )	    row = addSubLinks(iwc,T,col,row,L,n);	}	else {	  if ( _showSubPages && (n.getNodeID() == currentPageId || n.getNodeID() == parentPageId) && n.getNodeID() != rootNode ) {	    row = addSubLinks(iwc,T,col,row,L,n);	  }	}      }      if ( _spacer != null && iterator.hasNext() ) {	if ( !vertical )	  T.add(_spacer,col++,row);	else	  T.add(_spacer,col,row++);      }      if ( _spaceBetween > 0 && vertical ) {	T.add(spaceBetween,col,row++);      }    }    add(T);  }