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
|
public void ajouterGroupe(){
//Panel qui contiendra l'ensemble des composants à ajouter pour creer un nouveau groupe de rotation
HtmlPanelGrid panel = new HtmlPanelGrid();
//Parametrage du panel
panel.setId("panelSemaineTypeGroupe"+panelGroupesSemaineType.getChildCount());
panel.setStyle("width:100%;");
//Nouvelle table contenant les horaires types
HtmlDataTable table = new HtmlDataTable();
table.setId("tableSemaineTypeGroupe"+panelGroupesSemaineType.getChildCount()); //identification de la nouvelle table
table.setBorder(1); //style de la nouvelle table
SemaineTypeManagedBean mb = new SemaineTypeManagedBean(panelGroupesSemaineType.getChildCount());
mb.setBackingSemaineType(this); //Lien
mb.setSemainesTypesDAO(semainesTypesDAO);
semaineTypeManagedBeans.add(mb);
table.setValue(semaineTypeManagedBeans.get(panelGroupesSemaineType.getChildCount()).getModel().getWrappedData());
table.setVar("ligne");
table.setColumnClasses("td");
table.setHeaderClass("th");
table.setRowClasses("list-row-even td, list-row-odd td");
table.setStyleClass("tableau");
table.setStyle("left:20%;width:60%;");
listeTable.add(table);
//Colonne des totaux
UIColumn totaux = new UIColumn();
totaux.setId("totauxGroupe"+panelGroupesSemaineType.getChildCount());
HtmlOutputText headerTotaux = new HtmlOutputText();
headerTotaux.setId("totalGroupeHeader"+panelGroupesSemaineType.getChildCount());
headerTotaux.setValue("Total");
totaux.setHeader(headerTotaux);
//Texte de la colonne des Totaux
HtmlOutputText total = new HtmlOutputText();
total.setId("totalGroupe"+panelGroupesSemaineType.getChildCount());
//total.setValueExpression("",ExpressionFactory.newInstance().createValueExpression(FacesContext.getCurrentInstance().getELContext(),"#{ligne.total}",Integer.class));
total.setValue("bbb");
//Ajout du texte dans la colonne
totaux.getChildren().add(total);
//Ajout des colonnes à la table
table.getChildren().add(totaux);
//Bouton d'ajout de ligne
Button ajoutLigne = new Button();
ajoutLigne.setId("ajoutTech"+panelGroupesSemaineType.getChildCount());
ajoutLigne.setImageURL("/resources/img/ajouter.jpg");
ajoutLigne.setToolTip("Ajouter un technicien");
Class[] parametreAction = new Class[] {ActionEvent.class};
ajoutLigne.setActionListenerExpression(ExpressionFactory.newInstance().createMethodExpression(FacesContext.getCurrentInstance().getELContext(),"#{SemaineType.ajouterCode}",null,parametreAction));
//Panel de sepraration pour eviter que les tables représentant les groupes ne soient collées les unes aux autres
HtmlPanelGrid panelSeparation = new HtmlPanelGrid();
panelSeparation.setId("panelSeparationSemaineTypeGroupe"+panelGroupesSemaineType.getChildCount());
panelSeparation.setStyle("width:15px;");
// Ajout de la datatable au panel principal
panel.getChildren().add(table);
// Ajout du bouton d'ajout de ligne
panel.getChildren().add(ajoutLigne);
// Ajout du panel de séparation au panel principal
panel.getChildren().add(panelSeparation);
// Ajout du panel créer dans la page
panelGroupesSemaineType.getChildren().add(panel);
} |
Partager