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
| private void initTableau() {
list_colonnes.add(0, new ArrayList<String>());
list_colonnes.get(0).add(0, "Produit");
list_colonnes.add(1, new ArrayList<String>());
list_colonnes.get(1).add(0, "Dernier inventaire");
list_colonnes.add(2, new ArrayList<String>());
list_colonnes.get(2).add(0, "Nb doses sur 1 Litre");
list_colonnes.add(3, new ArrayList<String>());
list_colonnes.get(3).add(0, "Quantités restantes");
list_colonnes.add(4, new ArrayList<String>());
list_colonnes.get(4).add(0, "Quantités comptés");
addrow();
}
public void addrow() {
// TODO Auto-generated method stub
list_lignes.clear();// On efface les lignes
//On met a jour les lignes:
articles=articlesDao.select("inventaire", "1", 0);
for(int i = 0; i < articles.size(); i++){
// On affiche la date sous le bon format
try {
date= inventairesDao.date_max("id_articles", String.valueOf(articles.get(i).getId()));
//new Datetime(articles.get(i).getDate_creation());
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
// On met les infos dans le tableau
list_lignes.add(i, new ArrayList<ArrayList<Object>>());
list_lignes.get(i).add(0, new ArrayList<Object>());
list_lignes.get(i).get(0).add(0, articles.get(i).getNom());
list_lignes.get(i).get(0).add(1, articles.get(i));
list_lignes.get(i).add(1, new ArrayList<Object>());
list_lignes.get(i).get(1).add(0, date);;
list_lignes.get(i).add(2, new ArrayList<Object>());
list_lignes.get(i).get(2).add(0, articles.get(i).getNb_dose());
list_lignes.get(i).add(3, new ArrayList<Object>());
list_lignes.get(i).get(3).add(0, articles.get(i).getQuantites_restantes());
list_lignes.get(i).add(4, new ArrayList<Object>());
list_lignes.get(i).get(4).add(0, null);
}
this.fireTableDataChanged();
} |
Partager