1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
| private String[] columnNames = {"Identification"};
private ArrayList <Collabo> myList;
public TableModelCollabos (ArrayList myList)
{
this.myList = myList;
}
public int getColumnCount() {
return columnNames.length;
}
public int getRowCount() {
//System.out.println("row count : " + myList.size());
return myList.size();
}
@Override
public String getColumnName(int col) {
return columnNames[col];
}
@Override
public Object getValueAt(int row, int col) {
Collabo myApp = myList.get(row);
switch (col)
{
case 0 : return myApp.getAppAlb().getCodeA();
}
return null;
}
@Override
public Class getColumnClass(int c) {
//return getValueAt(0, c).getClass(); ! provoque une erreur quand la table est vide et qu'il y a un sorter !
switch (c)
{
case 0 : return String.class;
}
return null;
}
public void setMyList (ArrayList myList)
{
this.myList = myList;
this.fireTableDataChanged();
}
public ArrayList <Collabo> getMyList ()
{
return myList;
}
public Collabo getMyList (int index)
{
return myList.get(index);
} |
Partager