. util. Set;
import javax. swing. JButton;
import javax. swing. JCheckBox;
import javax. swing. JPanel;
import javax. swing. JScrollPane;
import javax. swing. JTable;
import javax. swing. event. TableModelListener;
import javax. swing. table. TableColumn;
import javax. swing. table. TableModel;
import core. Item;
import core. Packer;
import core. Store;
class ParetoLayersViewer {
class ParetoLayersTableModel implements TableModel {
private List lt; List lt; Item gt; gt; paretoLayers;
private Set lt; TableModelListener gt; listeners= new HashSet lt; TableModelListener gt; ();
public ParetoLayersTableModel (List lt; List lt; Item gt; gt; paretoLayers) {
super ();
this . paretoLayers=paretoLayers;
}
@ Override
public void addTableModelListener (TableModelListener l) {. add (l);
}
@ Override
public Class lt ;? gt; getColumnClass ( int columnIndex) {
return String. class ;
}
@ Override
public int getColumnCount () {
int maxLayerSize=0;
for (List lt; Item gt; l: paretoLayers) {
int currentLayerSize=l. size ();
if (maxLayerSize lt; currentLayerSize) {= currentLayerSize;
}
}
return maxLayerSize;
}
@ Override
public String getColumnName ( int columnIndex) {
return (columnIndex + 1) + raquo ;;
}
@ Override
public int getRowCount () {
return paretoLayers. size ();
}
@ Override
public Object getValueAt ( int rowIndex, int columnIndex) { lt; Item gt; paretoLayer=paretoLayers. get (rowIndex);
if (paretoLayer. size () gt; columnIndex) {
return paretoLayer. get (columnIndex). getId ();
}
return null ;
}
@ Override
public boolean isCellEditable ( int rowIndex, int columnIndex) {
return false ;
}
@ Override
public void removeTableModelListener (TableModelListener l) {. remove (l);
}
@ Override
public void setValueAt (Object aValue, int rowIndex, int columnIndex) {
}
}
private JPanel viewer;
private JTable paretoLayersTable;
private JCheckBox byUtilityBox;
private JCheckBox byVolumeBox;
private JCheckBox byWeightBox;
private JCheckBox processPairsBox;
private JButton recountButton;