src/js/LayoutManager.js
function( config, parent ) {
		var typeErrorMsg, contentItem;

		if( typeof config.type !== 'string' ) {
			throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
		}

		if( config.type === 'react-component' ) {
			config.type = 'component';
			config.componentName = 'lm-react-component';
		}

		if( !this._typeToItem[ config.type ] ) {
			typeErrorMsg = 'Unknown type \'' + config.type + '\'. ' +
				'Valid types are ' + lm.utils.objectKeys( this._typeToItem ).join( ',' );

			throw new lm.errors.ConfigurationError( typeErrorMsg );
		}


		/**
		 * We add an additional stack around every component that's not within a stack anyways.
		 */
		if(
			// If this is a component
		config.type === 'component' &&

		// and it's not already within a stack
		!( parent instanceof lm.items.Stack ) &&

		// and we have a parent
		!!parent &&

		// and it's not the topmost item in a new window
		!( this.isSubWindow === true && parent instanceof lm.items.Root )
		) {
			config = {
				type: 'stack',
				width: config.width,
				height: config.height,
				content: [ config ]
			};
		}

		contentItem = new this._typeToItem[ config.type ]( this, config, parent );
		return contentItem;
	}
function( config, parent ) {
		var typeErrorMsg, contentItem;

		if( typeof config.type !== 'string' ) {
			throw new lm.errors.ConfigurationError( 'Missing parameter \'type\'', config );
		}

		if( config.type === 'react-component' ) {
			config.type = 'component';
			config.componentName = 'lm-react-component';
		}

		if( !this._typeToItem[ config.type ] ) {
			typeErrorMsg = 'Unknown type \'' + config.type + '\'. ' +
				'Valid types are ' + lm.utils.objectKeys( this._typeToItem ).join( ',' );

			throw new lm.errors.ConfigurationError( typeErrorMsg );
		}


		/**
		 * We add an additional stack around every component that's not within a stack anyways.
		 */
		if(
			// If this is a component
		config.type === 'component' &&

		// and it's not already within a stack
		!( parent instanceof lm.items.Stack ) &&

		// and we have a parent
		!!parent &&

		// and it's not the topmost item in a new window
		!( this.isSubWindow === true && parent instanceof lm.items.Root )
		) {
			config = {
				type: 'stack',
				width: config.width,
				height: config.height,
				content: [ config ]
			};
		}

		contentItem = new this._typeToItem[ config.type ]( this, config, parent );
		return contentItem;
	}
function ( config , parent ) { var typeErrorMsg , contentItem ; if ( typeof config . type !== 'string' ) { throw new lm . errors . ConfigurationError ( 'Missing parameter \'type\'' , config ) ; } if ( config . type === 'react-component' ) { config . type = 'component' ; config . componentName = 'lm-react-component' ; } if ( ! this . _typeToItem [ config . type ] ) { typeErrorMsg = 'Unknown type \'' + config . type + '\'. ' + 'Valid types are ' + lm . utils . objectKeys ( this . _typeToItem ) . join ( ',' ) ; throw new lm . errors . ConfigurationError ( typeErrorMsg ) ; } /**
		 * We add an additional stack around every component that's not within a stack anyways.
		 */ if ( // If this is a component config . type === 'component' && // and it's not already within a stack ! ( parent instanceof lm . items . Stack ) && // and we have a parent ! ! parent && // and it's not the topmost item in a new window ! ( this . isSubWindow === true && parent instanceof lm . items . Root ) ) { config = { type : 'stack' , width : config . width , height : config . height , content : [ config ] } ; } contentItem = new this . _typeToItem [ config . type ] ( this , config , parent ) ; return contentItem ; }
Recursively creates new item tree structures based on a provided
ItemConfiguration object

@public
@param   {Object} config ItemConfig
@param   {[ContentItem]} parent The item the newly created item should be a child of

@returns {lm.items.ContentItem}
Recursively creates new item tree structures based on a provided ItemConfiguration object