/*!
 * SAP UI development toolkit for HTML5 (SAPUI5/OpenUI5)
 * (c) Copyright 2009-2015 SAP SE or an SAP affiliate company.
 * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
 */
sap.ui.define(['jquery.sap.global','sap/ui/core/Renderer','./ListBaseRenderer'],function(q,R,L){"use strict";var T=R.extend(L);T.renderColumns=function(r,t,a){var i=0,h=0,b=false,c=false,m=t.getMode(),M=L.ModeOrder[m],d="sapMListTbl",e=t.getId("tbl"),f=(a=="Head")?"th":"td",g=(a=="Head")?"columnheader":"gridcell",j="t"+a.toLowerCase(),C=t.getColumns(),k=(a=="Head")&&C.every(function(o){return!o.getHeader()||!o.getVisible()||o.isPopin()||o.isNeverVisible()||o.isHidden();}),l=(a=="Head")&&C.filter(function(o){return o.getVisible()&&!o.isPopin()&&!o.isNeverVisible()&&!o.isHidden();}).length==1,n=function(o,p,A){r.write("<");r.write(f);r.writeAttribute("role",g);A&&r.writeAttribute("aria-hidden","true");p&&r.writeAttribute("id",e+p);r.addClass(d+o);r.writeClasses();r.write("></");r.write(f);r.write(">");i++;};r.write("<"+j+">");r.write("<tr");r.writeAttribute("tabindex",-1);r.writeAttribute("role","rowheader");r.writeAttribute("id",t.addNavSection(e+a+"er"));if(k){r.addClass("sapMListTblHeaderNone");}else{r.addClass("sapMListTblRow sapMListTbl"+a+"er");}r.writeClasses();r.write(">");if(M==-1){if(m=="MultiSelect"&&a=="Head"&&!k){r.write("<th role='columnheader' class='"+d+"SelCol'>");r.write("<div class='sapMLIBSelectM'>");r.renderControl(t._getSelectAllCheckbox());r.write("</div></th>");i++;}else{n("SelCol");}}C.forEach(function(o,p){o.setIndex(-1);o.setInitialOrder(p);});t.getColumns(true).forEach(function(o,p){if(!o.getVisible()){return;}if(o.isPopin()){b=true;return;}if(o.isNeverVisible()){return;}if(o.isHidden()){h++;}var s=o["get"+a+"er"](),w=l?"":o.getWidth(),u=o.getStyleClass(true),v=o.getCssAlign();r.write("<"+f);u&&r.addClass(u);r.addClass(d+"Cell");r.addClass(d+a+"erCell");r.writeAttribute("id",e+a+i);r.writeAttribute("data-sap-width",o.getWidth());r.writeAttribute("role",g);w&&r.addStyle("width",w);if(v){r.addStyle("text-align",v);}r.writeClasses();r.writeStyles();r.write(">");if(s){o.applyAlignTo(s);r.renderControl(s);}if(a=="Head"&&!c){c=!!o.getFooter();}r.write("</"+f+">");o.setIndex(i++);});n("NavCol",a+"Nav",!t._iItemNeedsColumn);if(M==1){n("SelCol");}r.write("</tr></"+j+">");if(a=="Head"){t._hasPopin=b;t._colCount=i-h;t._hasFooter=c;t._headerHidden=k;}};T.renderContainerAttributes=function(r,c){r.addClass("sapMListTblCnt");};T.renderListStartAttributes=function(r,c){r.write("<table");r.addClass("sapMListTbl");if(c.getFixedLayout()===false){r.addStyle("table-layout","auto");}if(c._iItemNeedsColumn){r.addClass("sapMListTblHasNav");}};T.getAriaRole=function(c){return"grid";};T.renderListHeadAttributes=function(r,c){this.renderColumns(r,c,"Head");r.write("<tbody");r.writeAttribute("id",c.addNavSection(c.getId("tblBody")));r.write(">");};T.renderListEndAttributes=function(r,c){r.write("</tbody>");c._hasFooter&&this.renderColumns(r,c,"Foot");r.write("</table>");};T.renderNoData=function(r,c){r.write("<tr");r.writeAttribute("role","row");r.writeAttribute("tabindex","-1");r.writeAttribute("id",c.getId("nodata"));r.addClass("sapMLIB sapMListTblRow sapMLIBTypeInactive");if(!c._headerHidden||(!c.getHeaderText()&&!c.getHeaderToolbar())){r.addClass("sapMLIBShowSeparator");}r.writeClasses();r.write(">");r.write("<td");r.writeAttribute("role","gridcell");r.writeAttribute("id",c.getId("nodata-text"));r.writeAttribute("colspan",c.getColCount());r.addClass("sapMListTblCell sapMListTblCellNoData");r.writeClasses();r.write(">");r.writeEscaped(c.getNoDataText());r.write("</td>");r.write("</tr>");};return T;},true);
