protected JavascriptVarBuilder encodeRow ( final FacesContext context , final String rowKey , final JavascriptVarBuilder jsData , final JavascriptVarBuilder jsRowStyle , final JavascriptVarBuilder jsStyle , final JavascriptVarBuilder jsReadOnly , final Sheet sheet , final int rowIndex ) throws IOException { // encode rowStyle (if any) final String rowStyleClass = sheet . getRowStyleClass ( ) ; if ( rowStyleClass == null ) { jsRowStyle . appendArrayValue ( "null" , false ) ; } else { jsRowStyle . appendArrayValue ( rowStyleClass , true ) ; } // data is array of array of data final JavascriptVarBuilder jsRow = new JavascriptVarBuilder ( null , false ) ; int renderCol = 0 ; for ( int col = 0 ; col < sheet . getColumns ( ) . size ( ) ; col ++ ) { final SheetColumn column = sheet . getColumns ( ) . get ( col ) ; if ( ! column . isRendered ( ) ) { continue ; } // render data value final String value = sheet . getRenderValueForCell ( context , rowKey , col ) ; jsRow . appendArrayValue ( value , true ) ; // custom style final String styleClass = column . getStyleClass ( ) ; if ( styleClass != null ) { jsStyle . appendRowColProperty ( rowIndex , renderCol , styleClass , true ) ; } // read only per cell final boolean readOnly = column . isReadonlyCell ( ) ; if ( readOnly ) { jsReadOnly . appendRowColProperty ( rowIndex , renderCol , "true" , true ) ; } renderCol ++ ; } // close row and append to jsData jsData . appendArrayValue ( jsRow . closeVar ( ) . toString ( ) , false ) ; return jsData ; }
Encode a single row .