protected void encodeData ( final FacesContext context , final Sheet sheet , final WidgetBuilder wb ) throws IOException { final JavascriptVarBuilder jsData = new JavascriptVarBuilder ( null , false ) ; final JavascriptVarBuilder jsRowKeys = new JavascriptVarBuilder ( null , false ) ; final JavascriptVarBuilder jsStyle = new JavascriptVarBuilder ( null , true ) ; final JavascriptVarBuilder jsRowStyle = new JavascriptVarBuilder ( null , false ) ; final JavascriptVarBuilder jsReadOnly = new JavascriptVarBuilder ( null , true ) ; final JavascriptVarBuilder jsRowHeaders = new JavascriptVarBuilder ( null , false ) ; final boolean isCustomHeader = sheet . getRowHeaderValueExpression ( ) != null ; final List < Object > values = sheet . getSortedValues ( ) ; int row = 0 ; for ( final Object value : values ) { context . getExternalContext ( ) . getRequestMap ( ) . put ( sheet . getVar ( ) , value ) ; final String rowKey = sheet . getRowKeyValueAsString ( context ) ; jsRowKeys . appendArrayValue ( rowKey , true ) ; encodeRow ( context , rowKey , jsData , jsRowStyle , jsStyle , jsReadOnly , sheet , row ) ; // In case of custom row header evaluate the value expression for every row to // set the header if ( sheet . isShowRowHeaders ( ) && isCustomHeader ) { final String rowHeader = sheet . getRowHeaderValueAsString ( context ) ; jsRowHeaders . appendArrayValue ( rowHeader , true ) ; } row ++ ; } sheet . setRowVar ( context , null ) ; wb . nativeAttr ( "data" , jsData . closeVar ( ) . toString ( ) ) ; wb . nativeAttr ( "styles" , jsStyle . closeVar ( ) . toString ( ) ) ; wb . nativeAttr ( "rowStyles" , jsRowStyle . closeVar ( ) . toString ( ) ) ; wb . nativeAttr ( "readOnlyCells" , jsReadOnly . closeVar ( ) . toString ( ) ) ; wb . nativeAttr ( "rowKeys" , jsRowKeys . closeVar ( ) . toString ( ) ) ; // add the row header as a native attribute if ( ! isCustomHeader ) { wb . nativeAttr ( "rowHeaders" , sheet . isShowRowHeaders ( ) . toString ( ) ) ; } else { wb . nativeAttr ( "rowHeaders" , jsRowHeaders . closeVar ( ) . toString ( ) ) ; } }
Encode the row data . Builds row data style data and read only object .