*/
private static void setLayoutBody ( TemplateLayout layout, Document templateDrawedBody, Boolean isPreview ) {
//***************************************************************
//Verify if we have a sidebar
Elements splitSideBar = templateDrawedBody.select( DIV_TAG + "[" + ID_ATTRIBUTE + "=" + SIDEBAR_ID );
if ( splitSideBar != null && !splitSideBar.isEmpty() ) {//We found our sidebar
Element sidebar = splitSideBar.get( 0 );
//Getting the containers for this html fragment
List<String> containers = getColumnContainers( sidebar );
//Adding the sidebar to the layout
layout.setSidebar( containers, isPreview );
}
//***************************************************************
//Split the drawed body in rows
List<TemplateLayoutRow> splitBodiesList = new ArrayList<TemplateLayoutRow>();
Elements splitBodies = templateDrawedBody.select( DIV_TAG + "[" + ID_ATTRIBUTE + "~=" + getRegexForSelectBody() );
for ( int i = 0; i < splitBodies.size(); i++ ) {
Element splitBody = splitBodies.get( i );
// gets the identifier of the body div
String idHtml = splitBody.attr( ID_ATTRIBUTE );
String id = idHtml.substring( idHtml.indexOf( SPLIT_BODY_ID_PREFIX ) + SPLIT_BODY_ID_PREFIX.length() );
String layoutType = splitBody.child( 0 ).attr( ID_ATTRIBUTE );
//Create a template row
TemplateLayoutRow rowLayout = new TemplateLayoutRow();
rowLayout.setIdentifier( Integer.parseInt( id ) );
rowLayout.setId( "select_splitBody" );
rowLayout.setValue( layoutType );
//We may have multiple columns in here
Elements columns = splitBody.select( DIV_TAG + "." + COLUMN_CONTAINER_CLASS );
if ( columns != null && !columns.isEmpty() ) {
//We found multiple columns...
for ( Element columnElement : columns ) {
//Find the containers for this column
List<String> containers = getColumnContainers( columnElement );