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 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
| package mdp.dpe.stea.managedbeans;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.model.SelectItem;
import mdp.dpe.stea.supervision.ejb.ChoixRcService;
import mdp.dpe.stea.supervision.entity.CtrlArrondissement;
import mdp.dpe.stea.supervision.entity.CtrlCion;
import mdp.dpe.stea.supervision.entity.Rctigre;
/*
<!--
<h:selectOneMenu id="cionClt" value="choixRcBean.cionSelected" converter="ctrlCionConverter">
<f:selectItems id="choixCion" value="#{choixRcBean.listeCion}"
var="circ" itemLabel="#{circ.libCion}" itemValue="#{circ.idCion}"/>
</h:selectOneMenu>
-->
*/
/**
*
* @author franckotseu
*/
@ManagedBean(name = "choixRcBean")
@RequestScoped
public class ChoixRcMBean {
@EJB
private ChoixRcService choixRcService;
private List<SelectItem> listeCion;
//les valeurs choisies
private String cionSelected;
private List<Rctigre> listeRcAffichee;
// =========================================================================
// = Constructeur =
// =========================================================================
public ChoixRcMBean() {
}
@PostConstruct
public void init(){
listeCion = getListeCion();
}
// =========================================================================
// = getters setters =
// =========================================================================
public List<SelectItem> getListeCion() {
List<SelectItem> retour = new ArrayList<SelectItem>();
List<CtrlCion> listeToutesLesCions = choixRcService.getAllCion();
for(CtrlCion c : listeToutesLesCions){
retour.add(new SelectItem(c.getIdCion().intValue(), c.getLibCion()));
}
return retour;
}
public void setListeCion(List<SelectItem> listeCion) {
this.listeCion = listeCion;
}
public String getCionSelected() {
return cionSelected;
}
public void setCionSelected(String selectedCion) {
this.cionSelected = selectedCion;
}
public List<Rctigre> getListeRcAffichee() {
return listeRcAffichee;
}
public void setListeRcAffichee(List<Rctigre> listeRcAffichee) {
this.listeRcAffichee = listeRcAffichee;
}
// =========================================================================
// = Fonctions utiles pour la liste =
// =========================================================================
public String getListe(){
Logger.getLogger(ChoixRcMBean.class.getName()).log(Level.INFO, "choix de la cion = {0}", cionSelected);
if (cionSelected!=null) Logger.getLogger(ChoixRcMBean.class.getName()).log(Level.INFO, "choix de la cion après conversion = {0}", cionSelected);
listeRcAffichee = choixRcService.getRc(null, null, "", null);
return "ChoixRcList";
}
public CtrlCion findCionById(Short idCion){
return (idCion!=null?choixRcService.getCion(idCion):null);
}
public CtrlArrondissement findArrondissementById(Short idArrondissement){
return (idArrondissement!=null?choixRcService.getArrondissement(idArrondissement):null);
}
} |
Partager