public void addGridDetailItem ( TableModel model , int iRowIndex , GridBagLayout gridbag , GridBagConstraints c ) { JComponent rgcompoments [ ] = new JComponent [ model . getColumnCount ( ) ] ; for ( int iColumnIndex = 0 ; iColumnIndex < rgcompoments . length ; iColumnIndex ++ ) { Object obj = model . getValueAt ( iRowIndex , iColumnIndex ) ; if ( ( obj == null ) || ( model . getRowCount ( ) <= iRowIndex ) ) return ; // EOF if ( iColumnIndex == rgcompoments . length - 1 ) { // Last column - take remainder c . weightx = 1.0 ; c . gridwidth = GridBagConstraints . REMAINDER ; //end row c . anchor = GridBagConstraints . WEST ; // Edit boxes left justified c . insets . right = 5 ; } Component component = this . addDetailComponent ( model , obj , iRowIndex , iColumnIndex , c ) ; if ( component == null ) continue ; // Skip this column gridbag . setConstraints ( component , c ) ; m_panelGrid . add ( component ) ; rgcompoments [ iColumnIndex ] = ( JComponent ) component ; } // Set up a table to lookup the item<->textfield link m_vComponentCache . addElement ( new ComponentCache ( iRowIndex , rgcompoments ) ) ; }
Add this item to the grid detail at this row .