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 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
package open.indicateur.ihm;
import com.open.mondrian.schema.SchemaMondrianBean;
import com.open.survey.oracle.EticLibellesReponses;
import com.open.survey.oracle.EticQuestions;
import com.open.survey.oracle.EticThemes;
import com.open.survey.oracle.service.EticQuestionsFacadeLocal;
import com.open.survey.oracle.service.EticThemesFacadeLocal;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.context.FacesContext;
/**
*
* @author olivier
*/
@ManagedBean(name = "IndicateurController")
@ViewScoped
public class IndicateurController implements Serializable{
/**
* Creates a new instance of IndicateurController
*/
String nameIndicateur = null;
String DescIndicateur = null;
@EJB
SchemaMondrianBean ListeIndicateurs;
@EJB
private EticThemesFacadeLocal themesfacade;
@EJB
private EticQuestionsFacadeLocal questions;
private Map<String, BigDecimal> uiThemesSelect;
private String choixtheme;
private Map<String, BigDecimal> uiQuestionsSelect;
private String question;
private EticLibellesReponses reponses;
public String getChoixtheme() {
return choixtheme;
}
public void setChoixtheme(String choixtheme) {
this.choixtheme = choixtheme;
}
/**
* Modification d'un valeur dans la boîte de sélection d'un thème
*/
public void changeAjaxTheme() {
System.out.println("Choix du thème :" + this.choixtheme);
Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
String string = entry.getKey();
String string1 = entry.getValue();
System.out.println("key : "+ string + " valeur : "+string1);
}
if (choixtheme==null | choixtheme.equals("")) {
System.out.println("Chargement Question null");
uiQuestionsSelect = null;
} else {
System.out.println("Chargement Question not null");
uiQuestionsSelect = new LinkedHashMap<String, BigDecimal>();
for (Iterator<EticQuestions> it = themesfacade.getAllQuestionsByTheme(new BigDecimal(choixtheme)).iterator(); it.hasNext();) {
EticQuestions eticquestion = it.next();
uiQuestionsSelect.put(eticquestion.getLibelleQuestion(), eticquestion.getIdQuestion());
}
}
}
/**
* Modification d'un valeur dans la boîte de sélection d'une question
*/
public void displayValues() {
Map<String, String> paramMap = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
for (Map.Entry<String, String> entry : paramMap.entrySet()) {
String string = entry.getKey();
String string1 = entry.getValue();
System.out.println("key : "+ string + " valeur : "+string1);
}
/*for (String key : paramMap.keySet()) {
if (key.contains("")) {
choixtheme = paramMap.get(key);
}
} */
System.out.println("validation");
/*if (new Integer(question) == 0) {
FacesMessage msg = new FacesMessage("Vous avez choisi :", "Thème : " + choixtheme + " Mais aucune question");
FacesContext.getCurrentInstance().addMessage(null, msg);
} else {
FacesMessage msg = new FacesMessage("Vous avez choisi :", "Thème : " + choixtheme + ", Question :" + this.question);
FacesContext.getCurrentInstance().addMessage(null, msg);
}*/
}
public Map<String, BigDecimal> getUiThemesSelect() {
if(uiThemesSelect==null){
uiThemesSelect = new LinkedHashMap<String, BigDecimal>();
}
return uiThemesSelect;
}
public void setUiThemesSelect(Map<String, BigDecimal> uiThemesSelect) {
this.uiThemesSelect = uiThemesSelect;
}
public Map<String, BigDecimal> getUiQuestionsSelect() {
return uiQuestionsSelect;
}
public void setQuestion(String question) {
this.question = question;
}
public String getQuestion() {
return this.question;
}
public String getNameIndicateur() {
return nameIndicateur;
}
public void setNameIndicateur(String nameIndicateur) {
this.nameIndicateur = nameIndicateur;
ListeIndicateurs.put(nameIndicateur, nameIndicateur);
}
public String getDescIndicateur() {
return DescIndicateur;
}
public void setDescIndicateur(String DescIndicateur) {
this.DescIndicateur = DescIndicateur;
}
public IndicateurController() {
// ListeIndicateurs.setSchemaMondrianBean("enfin.xml");
}
@PostConstruct
public void initialiser(){
uiThemesSelect = new LinkedHashMap<String, BigDecimal>();
for (Iterator<EticThemes> it = themesfacade.findAllByDegre("deg1").iterator(); it.hasNext();) {
EticThemes eticThemes = it.next();
/*System.out.println(EticThemes.getLibelleTheme());*/
System.out.println("Indice : " + eticThemes.getIdTheme());
uiThemesSelect.put(eticThemes.getLibelleTheme(), eticThemes.getIdTheme());
System.out.println("taille : " + uiThemesSelect.size());
}
}
public EticLibellesReponses getReponses() {
return reponses;
}
public void setReponses(EticLibellesReponses reponses) {
this.reponses = reponses;
}
} |
Partager