| Line 85... |
Line 85... |
| 85 |
private void creerChamps() {
|
85 |
private void creerChamps() {
|
| 86 |
projetsCombo = new ComboBox<Projet>();
|
86 |
projetsCombo = new ComboBox<Projet>();
|
| 87 |
projetsCombo.setTabIndex(tabIndex++);
|
87 |
projetsCombo.setTabIndex(tabIndex++);
|
| 88 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
88 |
projetsCombo.setFieldLabel(i18nC.projetChamp());
|
| 89 |
projetsCombo.setDisplayField("nom");
|
89 |
projetsCombo.setDisplayField("nom");
|
| - |
|
90 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
| - |
|
91 |
projetsCombo.setStore(new ListStore<Projet>());
|
| 90 |
projetsCombo.setForceSelection(true);
|
92 |
projetsCombo.setForceSelection(true);
|
| - |
|
93 |
projetsCombo.setAllowBlank(false);
|
| 91 |
projetsCombo.setValidator(new Validator() {
|
94 |
projetsCombo.setValidator(new Validator() {
|
| 92 |
@Override
|
95 |
@Override
|
| 93 |
public String validate(Field<?> field, String value) {
|
96 |
public String validate(Field<?> champ, String valeurAValider) {
|
| 94 |
String retour = null;
|
97 |
String retour = null;
|
| 95 |
if (field.getRawValue().equals("")) {
|
98 |
if (UtilString.isEmpty(valeurAValider)
|
| 96 |
field.setValue(null);
|
- |
|
| 97 |
} else if (projetsCombo.getStore().findModel("nom", field.getRawValue()) == null) {
|
99 |
|| projetsCombo.getStore().findModel("nom", valeurAValider) == null) {
|
| 98 |
String contenuBrut = field.getRawValue();
|
- |
|
| 99 |
field.setValue(null);
|
100 |
champ.setValue(null);
|
| 100 |
field.setRawValue(contenuBrut);
|
101 |
retour = i18nC.selectionnerValeur();
|
| 101 |
retour = "Veuillez sélectionner une valeur ou laisser le champ vide";
|
- |
|
| 102 |
}
|
102 |
}
|
| 103 |
return retour;
|
103 |
return retour;
|
| 104 |
}
|
104 |
}
|
| 105 |
});
|
105 |
});
|
| 106 |
projetsCombo.setTriggerAction(TriggerAction.ALL);
|
- |
|
| 107 |
projetsCombo.setStore(new ListStore<Projet>());
|
- |
|
| 108 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
106 |
projetsCombo.addStyleName(ComposantClass.OBLIGATOIRE);
|
| 109 |
projetsCombo.addListener(Events.Valid, Formulaire.creerEcouteurChampObligatoire());
|
107 |
projetsCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
| - |
|
108 |
projetsCombo.addListener(Events.Invalid, creerEcouteurChampObligatoire());
|
| 110 |
panneauFormulaire.add(projetsCombo, new FormData(450, 0));
|
109 |
panneauFormulaire.add(projetsCombo, new FormData(450, 0));
|
| 111 |
mediateur.selectionnerProjet(this, null);
|
110 |
mediateur.selectionnerProjet(this, null);
|
| Line 112... |
Line 111... |
| 112 |
|
111 |
|
| 113 |
titreChp = new TextField<String>();
|
112 |
titreChp = new TextField<String>();
|
| - |
|
113 |
titreChp.setFieldLabel(i18nC.commentaireTitre());
|
| 114 |
titreChp.setFieldLabel(i18nC.commentaireTitre());
|
114 |
titreChp.setAllowBlank(false);
|
| 115 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
115 |
titreChp.addStyleName(ComposantClass.OBLIGATOIRE);
|
| - |
|
116 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
| 116 |
titreChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
|
117 |
titreChp.addListener(Events.Invalid, creerEcouteurChampObligatoire());
|
| Line 117... |
Line 118... |
| 117 |
panneauFormulaire.add(titreChp, new FormData(450, 0));
|
118 |
panneauFormulaire.add(titreChp, new FormData(450, 0));
|
| 118 |
|
119 |
|
| 119 |
texteChp = new TextArea();
|
120 |
texteChp = new TextArea();
|
| Line 154... |
Line 155... |
| 154 |
peuplerFormulaire();
|
155 |
peuplerFormulaire();
|
| 155 |
}
|
156 |
}
|
| Line 156... |
Line 157... |
| 156 |
|
157 |
|
| 157 |
private String getValeurComboProjets() {
|
158 |
private String getValeurComboProjets() {
|
| 158 |
String valeur = "";
|
159 |
String valeur = "";
|
| 159 |
if (projetsCombo.getValue() != null) {
|
160 |
if (projetsCombo.getValue() != null && projetsCombo.isValid()) {
|
| 160 |
valeur = projetsCombo.getValue().getId();
|
161 |
valeur = projetsCombo.getValue().getId();
|
| 161 |
}
|
162 |
}
|
| 162 |
return valeur;
|
163 |
return valeur;
|
| 163 |
}
|
164 |
}
|
| Line 233... |
Line 234... |
| 233 |
String titre = titreChp.getValue();
|
234 |
String titre = titreChp.getValue();
|
| 234 |
if (titre == null || titre.equals("")) {
|
235 |
if (titre == null || titre.equals("")) {
|
| 235 |
messages.add(i18nC.commentaireMessageTitre());
|
236 |
messages.add(i18nC.commentaireMessageTitre());
|
| 236 |
}
|
237 |
}
|
| Line -... |
Line 238... |
| - |
|
238 |
|
| - |
|
239 |
if (UtilString.isEmpty(getValeurComboProjets())) {
|
| - |
|
240 |
String selectionDe = i18nC.articleUn()+" "+i18nC.projetSingulier();
|
| - |
|
241 |
String pour = i18nC.articleLa()+" "+i18nC.commentaireSingulier();
|
| - |
|
242 |
messages.add(i18nM.selectionObligatoire(selectionDe, pour));
|
| - |
|
243 |
Debug.log("Projet combo vide");
|
| - |
|
244 |
}
|
| - |
|
245 |
Debug.log("Projet combo non vide : "+getValeurComboProjets());
|
| 237 |
|
246 |
|
| 238 |
if (messages.size() != 0) {
|
247 |
if (messages.size() != 0) {
|
| 239 |
String[] tableauDeMessages = {};
|
248 |
String[] tableauDeMessages = {};
|
| 240 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
249 |
tableauDeMessages = messages.toArray(tableauDeMessages);
|
| 241 |
MessageBox.alert(i18nC.erreurSaisieTitre(), UtilArray.implode(tableauDeMessages, "<br />"), null);
|
250 |
MessageBox.alert(i18nC.erreurSaisieTitre(), UtilArray.implode(tableauDeMessages, "<br />"), null);
|