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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
public class DetailMvtPage extends WebPage {
@SpringBean(name = "stockService")
private IStockService stockService;
private List<LigneMouvementStock> alllignesMvtStock;
public List<LigneMouvementStock> getAlllignesMvtStock() {
return alllignesMvtStock;
}
public void setAlllignesMvtStock(List<LigneMouvementStock> alllignesMvtStock) {
this.alllignesMvtStock = alllignesMvtStock;
}
public DetailMvtPage(MouvementStock mouvementStock) {
super();
setOutputMarkupId(true);
//déclarer une form qui englobe le tout
Form form = new Form("form",new Model(mouvementStock)){
/**
*
*/
private static final long serialVersionUID = 1L;
/**
*
*/
List<String> typesMvts = Arrays.asList("Entrée", "Sortie");
form.add(new DropDownChoice("typeMouvement",
new PropertyModel(form.getModelObject(),"typeMouvement"),
typesMvts));
form.add(new TextField("dateMouvement",new PropertyModel(form.getModelObject(),"dateMouvement")));
List<String> typesPieces = Arrays.asList(" ", "BL","BS");
form.add(new DropDownChoice("typePieceJointe",
new PropertyModel(form.getModelObject(),"typePieceJointe"),
typesPieces));
form.add(new TextField("numPieceJointe",new PropertyModel(form.getModelObject(),"numPieceJointe")));
System.out.println("avant création panel");
System.out.println(mouvementStock.getTypeMouvement());
alllignesMvtStock = stockService.getAlllignesMvtStock(mouvementStock);
//la liste des lignes mouvement sera un composant du form
form.add(new ListView("LignesMouvement", alllignesMvtStock) {
/**
*
*/
private static final long serialVersionUID = 1L;
// This method is called for each 'entry' in the list.
@Override protected void populateItem(ListItem item) {
LigneMouvementStock ligneMouvementStock = (LigneMouvementStock)item.getModelObject();
List<Long> gammeArticle = Arrays.asList(new Long(4));
item.add(new DropDownChoice("gammeArticle",
new PropertyModel(ligneMouvementStock,"gammeArticle"),
gammeArticle));
item.add(new AjaxEditableLabel("taille", new PropertyModel(ligneMouvementStock,"taille")));
item.add(new AjaxEditableLabel("quantite", new PropertyModel(ligneMouvementStock,"quantite")));
item.add(new AjaxEditableLabel("notes", new PropertyModel(ligneMouvementStock,"notes")));
}
});
form.add(new AjaxLink("createLigneMvt") {
@Override
public void onClick(AjaxRequestTarget target) {
alllignesMvtStock.add(new LigneMouvementStock());
alllignesMvtStock.get(alllignesMvtStock.size()-1).setId(new Long(1));
if (target != null) {
target.addComponent(DetailMvtPage.this);
}
}
});
add(form);
}
public void setStockService(IStockService stockService) {
this.stockService = stockService;
}
public IStockService getStockService() {
return stockService;
}
private static final long serialVersionUID = 1L;
} |