{"size": 1357, "ext": "js", "max_stars_repo_path": "js/layout/item.js", "max_stars_repo_name": "tony-jacobs/widget.js", "max_stars_repo_stars_event_min_datetime": "2016-06-18T09:18:59.000Z", "max_stars_repo_stars_event_max_datetime": "2016-06-18T09:18:59.000Z", "max_issues_repo_path": "js/layout/item.js", "max_issues_repo_name": "tony-jacobs/widget.js", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "js/layout/item.js", "max_forks_repo_name": "tony-jacobs/widget.js", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 23.8070175439, "max_line_length": 137, "alphanum_fraction": 0.543109801}
(function layoutClosure(){

  widget.layout.register( 'item', createItemWidget, {
    description: "Creates an item widget (with a label and value).  This is a convenience widget to create a list with a label and value"
  },{
    styleClass: 'item'
  } );

  function addEntry( content, layout, options, key )
  {
    if( layout[key] )
    {
      if( 'string' == $.type( layout[key] ) )
      {
        content.push( {
          type: 'label',
          name: layout[key],
          options:{
            styleClass: key + ' ' + (options[ key+'Class' ]||"") ,
            unselectable: false
          }
        });
      }
      else // the layout is a widget, so just push it
      {
        content.push( layout[key] );
      }
    }
  }

  var itemId=0;
  function createItemWidget( def )
  {
    var layout = {
      type: "list",
      options: {
        styleClass: 'itemHolder ' + (def.options.layoutClass||"")
      },
      content: []
    };

    addEntry( layout.content, def.layout, def.options||{}, 'label' );
    addEntry( layout.content, def.layout, def.options||{}, 'value' );

    var id = "widget-item-" + (++itemId);
    var holder = $( '<div/>' ).attr( { id: id });  // layout adds styleclass automatically

    widget.layout( holder, layout, undefined, def.stack );

    holder.appendTo( def.parent );

    return holder;
  }


})();
