function getRecordAsEditTableCells( IdStack $idPath, Editor $editor, Structure $visibleStructure, Record $record, &$startColumn = 0 ) {
	$result = '';
	$childEditorMap = $editor->getAttributeEditorMap();
	
	foreach ( $visibleStructure->getAttributes() as $visibleAttribute ) {
		$childEditor = $childEditorMap->getEditorForAttribute( $visibleAttribute );
		
		if ( $childEditor != null ) {
			$attribute = $childEditor->getAttribute();
			$type = $attribute->type;
			$value = $record->getAttributeValue( $attribute );
			$idPath->pushAttribute( $attribute );
				
			if ( $childEditor instanceof RecordTableCellEditor ) {
				$result .= getRecordAsEditTableCells( $idPath, $childEditor, $visibleAttribute->type, $value, $startColumn );
			} else {
				if ( $childEditor->showEditField( $idPath ) ) {
					$displayValue = $childEditor->edit( $idPath, $value );
				} else {
					$displayValue = "";
				}
				$result .= '<td class="' . getHTMLClassForType( $type, $attribute ) . ' column-' . parityClass( $startColumn ) . '">' . $displayValue . '</td>';
					
				$startColumn++;
			}
			
			$idPath->popAttribute();
		}
		else {
			$result .= "<td/>";
		}
	}
	return $result;
}
	protected function getSubStructureForAttribute( Structure $structure, Attribute $attribute ) {
		$attributes = $structure->getAttributes();
		$result = null;
		$i = 0;
		
		while ( $result == null && $i < count( $attributes ) )
			if ( $attribute->id == $attributes[$i]->id )
				$result = $attributes[$i]->type;
			else
				$i++;
		
		return $result;
	}
function getRecordFromRow( $row, $columnIndex, Structure $structure ) {
	$result = new ArrayRecord( $structure );
	
	foreach ( $structure->getAttributes() as $attribute ) {
		$result->setAttributeValue( $attribute, $row[$columnIndex] );
		$columnIndex++;
	}
	
	return $result;
}
function equalRecords( Structure $structure, Record $lhs, Record $rhs ) {
	$result = true;
	$attributes = $structure->getAttributes();
	$i = 0;
	
	while ( $result && $i < count( $attributes ) ) {
		$attribute = $attributes[$i];
		$type = $attribute->type;
		$lhsValue = $lhs->getAttributeValue( $attribute );
		$rhsValue = $rhs->getAttributeValue( $attribute );
		
		if ( $type instanceof Structure )
			$result = $lhsValue instanceof Record && $rhsValue instanceof Record && equalRecords( $type, $lhsValue, $rhsValue );
		else
			$result = $lhsValue == $rhsValue;
			
		$i++;
	}
	
	return $result;
}