Index) {i=items. get (rowIndex);
switch (columnIndex) {
case 1 :. setVolume ((Integer) aValue);
break ;
case 2 :. setWeight ((Integer) aValue);
break ;
case 3 :. setRate1 ((Integer) aValue);
break ;
case 4 :. setRate2 ((Integer) aValue);
break ;
case 5 :. setRate3 ((Integer) aValue);
break ;
case 6 :. setRate4 ((Integer) aValue);
break ;
case 7 :. setRate5 ((Integer) aValue);
break ;
}
}
public void recountUtilities () {
for ( int i=0; i lt; items. size (); i ++) {(ItemsViewer. < b align="justify"> this . boss. getUtility (items. get (i)), i,
);
}
} getElement ( int index) {
return items. get (index);
} lt; Item gt; getElements () {
return items;
}
}
private JPanel viewer;
private JTable itemTable;
private JTable containersTable;
private JButton createPairButton;
private JButton breakPairButton;
private JLabel pairsNum;
private JLabel pairsCount;
private Packer packer;
private Boss boss;
public ItemsViewer (List lt; Container gt; containers, List lt; Item gt; items, Packer packer, Boss boss) {
this . boss=boss;
this . packer=packer;= new JPanel ( new GridBagLayout ()); itm= new ItemTableModel (items) ;. addTableModelListener ( new TableModelListener () {
@ Override
public void tableChanged (TableModelEvent e) {
((ItemTableModel) e. getSource ()). recountUtilities ();
}
});= new JTable (itm); lt; ItemTableModel gt; sorter= new TableRowSorter lt; ItemTableModel gt; ((ItemTableModel) itemTable. GetModel ()) ;. setSortable (9, false ) ;. setRowSorter (sorter) ;. addMouseListener ( new MouseAdapter () {
@ Override
public void mouseReleased (MouseEvent arg0) {
int [] selectedRowIndices=((JTable) arg0. getComponent ()). getSelectedRows ();
if (selectedRowIndices. length == 2) {. setEnabled ( false );
boolean single= true ;
for ( int index: selectedRowIndices) {= ((JTable) arg0. getComponent ()). getModel (). getValueAt (index,
) == null ;
if (! single) {. setEnabled ( false );
break ;
}
}
if (single) {. setEnabled ( true );
}
} else if (selectedRowIndices. length == 1) {. setEnabled ( false );
if (((ItemTableModel) itemTable. getModel ()). getElement (selectedRowIndices [0]). hasPair ()) {. setEnabled ( true );
} else {. setEnabled ( false );
}
} else {. setEnabled ...