private void layout(NodeItem p,Rectangle2D r){
  Iterator childIter=p.children();
  while (childIter.hasNext())   m_kids.add(childIter.next());
  Collections.sort(m_kids,s_cmp);
  double w=Math.min(r.getWidth(),r.getHeight());
  squarify(m_kids,m_row,w,r);
  m_kids.clear();
  childIter=p.children();
  while (childIter.hasNext()) {
    NodeItem c=(NodeItem)childIter.next();
    if (c.getChildCount() > 0 && c.getDouble(AREA) > 0) {
      updateArea(c,r);
      layout(c,r);
    }
  }
}

private void layout ( NodeItem p , Rectangle2D r ) { Iterator childIter = p . children ( ) ; while ( childIter . hasNext ( ) ) m_kids . add ( childIter . next ( ) ) ; Collections . sort ( m_kids , s_cmp ) ; double w = Math . min ( r . getWidth ( ) , r . getHeight ( ) ) ; squarify ( m_kids , m_row , w , r ) ; m_kids . clear ( ) ; childIter = p . children ( ) ; while ( childIter . hasNext ( ) ) { NodeItem c = ( NodeItem ) childIter . next ( ) ; if ( c . getChildCount ( ) > 0 && c . getDouble ( AREA ) > 0 ) { updateArea ( c , r ) ; layout ( c , r ) ; } } }
compute the tree map layout .
