public Cell < C , T > add ( C widget ) { Cell < C , T > cell = toolkit . obtainCell ( this ) ; cell . widget = widget ; if ( cells . size ( ) > 0 ) { // Set cell column and row. Cell < C , T > lastCell = cells . get ( cells . size ( ) - 1 ) ; if ( ! lastCell . endRow ) { cell . column = lastCell . column + lastCell . colspan ; cell . row = lastCell . row ; } else { cell . column = 0 ; cell . row = lastCell . row + 1 ; } // Set the index of the cell above. if ( cell . row > 0 ) { outer : for ( int i = cells . size ( ) - 1 ; i >= 0 ; i -- ) { Cell < C , T > other = cells . get ( i ) ; for ( int column = other . column , nn = column + other . colspan ; column < nn ; column ++ ) { if ( column == cell . column ) { cell . cellAboveIndex = i ; break outer ; } } } } } else { cell . column = 0 ; cell . row = 0 ; } cells . add ( cell ) ; cell . set ( cellDefaults ) ; if ( cell . column < columnDefaults . size ( ) ) { Cell < C , T > columnCell = columnDefaults . get ( cell . column ) ; if ( columnCell != null ) cell . merge ( columnCell ) ; } cell . merge ( rowDefaults ) ; if ( widget != null ) toolkit . addChild ( table , widget ) ; return cell ; }
Adds a new cell to the table with the specified widget .