private Table buildTable ( CmsSqlConsoleResults results ) { IndexedContainer container = new IndexedContainer ( ) ; int numCols = results . getColumns ( ) . size ( ) ; for ( int c = 0 ; c < numCols ; c ++ ) { container . addContainerProperty ( Integer . valueOf ( c ) , results . getColumnType ( c ) , null ) ; } int r = 0 ; for ( List < Object > row : results . getData ( ) ) { Item item = container . addItem ( Integer . valueOf ( r ) ) ; for ( int c = 0 ; c < numCols ; c ++ ) { item . getItemProperty ( Integer . valueOf ( c ) ) . setValue ( row . get ( c ) ) ; } r += 1 ; } Table table = new Table ( ) ; table . setContainerDataSource ( container ) ; for ( int c = 0 ; c < numCols ; c ++ ) { String col = ( results . getColumns ( ) . get ( c ) ) ; table . setColumnHeader ( Integer . valueOf ( c ) , col ) ; } table . setWidth ( "100%" ) ; table . setHeight ( "100%" ) ; table . setColumnCollapsingAllowed ( true ) ; return table ; }
Builds the table for the database results .