@Override public boolean visitTree(VisitContext visitContext,VisitCallback callback){
  if (!isVisitable(visitContext)) {
    return false;
  }
  FacesContext facesContext=visitContext.getFacesContext();
  boolean visitRows=requiresRowIteration(visitContext);
  Integer oldRowKey=null;
  if (visitRows) {
    oldRowKey=getRowKey();
    setRowKey(facesContext,null);
  }
  pushComponentToEL(facesContext,null);
  try {
    VisitResult result=visitContext.invokeVisitCallback(this,callback);
    if (result == VisitResult.COMPLETE) {
      return true;
    }
    if ((result == VisitResult.ACCEPT)) {
      if (visitDataChildren(visitContext,callback,visitRows)) {
        return true;
      }
    }
  }
 catch (  IOException e) {
    LOG.log(Level.SEVERE,e.getMessage(),e);
  }
 finally {
    popComponentFromEL(facesContext);
    if (visitRows) {
      try {
        setRowKey(facesContext,oldRowKey);
        restoreOrigValue(facesContext);
      }
 catch (      Exception e) {
        LOG.log(Level.SEVERE,e.getMessage(),e);
      }
    }
  }
  return false;
}

@ Override public boolean visitTree ( VisitContext visitContext , VisitCallback callback ) { if ( ! isVisitable ( visitContext ) ) { return false ; } FacesContext facesContext = visitContext . getFacesContext ( ) ; boolean visitRows = requiresRowIteration ( visitContext ) ; Integer oldRowKey = null ; if ( visitRows ) { oldRowKey = getRowKey ( ) ; setRowKey ( facesContext , null ) ; } pushComponentToEL ( facesContext , null ) ; try { VisitResult result = visitContext . invokeVisitCallback ( this , callback ) ; if ( result == VisitResult . COMPLETE ) { return true ; } if ( ( result == VisitResult . ACCEPT ) ) { if ( visitDataChildren ( visitContext , callback , visitRows ) ) { return true ; } } } catch ( IOException e ) { LOG . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } finally { popComponentFromEL ( facesContext ) ; if ( visitRows ) { try { setRowKey ( facesContext , oldRowKey ) ; restoreOrigValue ( facesContext ) ; } catch ( Exception e ) { LOG . log ( Level . SEVERE , e . getMessage ( ) , e ) ; } } } return false ; }
copied from richfaces uidataadapter # visittree .
