Line 7... |
Line 7... |
7 |
import org.tela_botanica.client.configuration.Configuration;
|
7 |
import org.tela_botanica.client.configuration.Configuration;
|
8 |
import org.tela_botanica.client.images.Images;
|
8 |
import org.tela_botanica.client.images.Images;
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
9 |
import org.tela_botanica.client.interfaces.Rafraichissable;
|
10 |
import org.tela_botanica.client.modeles.Valeur;
|
10 |
import org.tela_botanica.client.modeles.Valeur;
|
11 |
import org.tela_botanica.client.modeles.ValeurListe;
|
11 |
import org.tela_botanica.client.modeles.ValeurListe;
|
- |
|
12 |
import org.tela_botanica.client.modeles.aDonnee;
|
12 |
import org.tela_botanica.client.modeles.aDonneeListe;
|
13 |
import org.tela_botanica.client.modeles.aDonneeListe;
|
13 |
import org.tela_botanica.client.vues.Formulaire;
|
14 |
import org.tela_botanica.client.vues.Formulaire;
|
Line 14... |
Line 15... |
14 |
|
15 |
|
15 |
import com.extjs.gxt.ui.client.Registry;
|
16 |
import com.extjs.gxt.ui.client.Registry;
|
Line 73... |
Line 74... |
73 |
}
|
74 |
}
|
Line 74... |
Line 75... |
74 |
|
75 |
|
75 |
public void ajouterValeur(final String texte, final String type, final String id) {
|
76 |
public void ajouterValeur(final String texte, final String type, final String id) {
|
76 |
LayoutContainer colonneConteneur = new LayoutContainer();
|
77 |
LayoutContainer colonneConteneur = new LayoutContainer();
|
77 |
colonneConteneur.setLayout(new ColumnLayout());
|
78 |
colonneConteneur.setLayout(new ColumnLayout());
|
Line 78... |
Line 79... |
78 |
valeurs.put(id + "##" + texte, colonneConteneur);
|
79 |
valeurs.put(id + aDonnee.SEPARATEUR_TYPE_VALEUR + texte, colonneConteneur);
|
79 |
|
80 |
|
80 |
Text champType = new Text();
|
81 |
Text champType = new Text();
|
81 |
champType.setText(type + " : ");
|
82 |
champType.setText(type + " : ");
|
Line 88... |
Line 89... |
88 |
colonneConteneur.add(champValeur, new ColumnData(largeurChamp));
|
89 |
colonneConteneur.add(champValeur, new ColumnData(largeurChamp));
|
Line 89... |
Line 90... |
89 |
|
90 |
|
90 |
Button supprimerBouton = new Button();
|
91 |
Button supprimerBouton = new Button();
|
91 |
supprimerBouton.setIcon(Images.ICONES.supprimer());
|
92 |
supprimerBouton.setIcon(Images.ICONES.supprimer());
|
92 |
supprimerBouton.setText(boutonSupprimerLabel);
|
93 |
supprimerBouton.setText(boutonSupprimerLabel);
|
93 |
supprimerBouton.setData("valeur", id + "##" + texte);
|
94 |
supprimerBouton.setData("valeur", id + aDonnee.SEPARATEUR_TYPE_VALEUR + texte);
|
94 |
supprimerBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
95 |
supprimerBouton.addSelectionListener(new SelectionListener<ButtonEvent>() {
|
95 |
public void componentSelected(ButtonEvent ce) {
|
96 |
public void componentSelected(ButtonEvent ce) {
|
96 |
String valeur = ce.getComponent().getData("valeur");
|
97 |
String valeur = ce.getComponent().getData("valeur");
|
97 |
LayoutContainer valeurLayout = valeurs.get(valeur);
|
98 |
LayoutContainer valeurLayout = valeurs.get(valeur);
|
Line 108... |
Line 109... |
108 |
|
109 |
|
109 |
// Ajout du layout de la valeur au layout principal
|
110 |
// Ajout du layout de la valeur au layout principal
|
Line 110... |
Line 111... |
110 |
principalLayout.add(colonneConteneur);
|
111 |
principalLayout.add(colonneConteneur);
|
111 |
|
112 |
|
112 |
// Ajout de la valeur au champ récapitulatif des valeurs ajoutées
|
113 |
// Ajout de la valeur au champ récapitulatif des valeurs ajoutées
|
113 |
if (estComboBox) {
|
114 |
if (estComboBox && champValeurCombo.getValue() != null) {
|
114 |
ajouterValeurAuRecapitulatif(champValeurCombo.getValue().getId(), id);
|
115 |
ajouterValeurAuRecapitulatif(champValeurCombo.getValue().getId(), id);
|
115 |
} else {
|
116 |
} else {
|
116 |
ajouterValeurAuRecapitulatif(texte, id);
|
117 |
ajouterValeurAuRecapitulatif(texte, id);
|
Line 122... |
Line 123... |
122 |
public void ajouterValeurAuRecapitulatif(String texte, String id) {
|
123 |
public void ajouterValeurAuRecapitulatif(String texte, String id) {
|
123 |
String texteRecapitulatif = "";
|
124 |
String texteRecapitulatif = "";
|
124 |
if (champRecapitulatif.getValue() != null) {
|
125 |
if (champRecapitulatif.getValue() != null) {
|
125 |
texteRecapitulatif = champRecapitulatif.getValue();
|
126 |
texteRecapitulatif = champRecapitulatif.getValue();
|
126 |
}
|
127 |
}
|
127 |
texteRecapitulatif += id + "##" + texte + ";;";
|
128 |
texteRecapitulatif += id + aDonnee.SEPARATEUR_TYPE_VALEUR + texte + aDonnee.SEPARATEUR_VALEURS;
|
128 |
champRecapitulatif.setValue(texteRecapitulatif);
|
129 |
champRecapitulatif.setValue(texteRecapitulatif);
|
129 |
}
|
130 |
}
|
Line 130... |
Line 131... |
130 |
|
131 |
|
131 |
public void peupler(String chaineExistante) {
|
132 |
public void peupler(String chaineExistante) {
|
132 |
if (valeurs.size()>0) {
|
133 |
if (valeurs.size() > 0) {
|
133 |
reinitialiser();
|
134 |
reinitialiser();
|
134 |
}
|
135 |
}
|
135 |
if (chaineExistante != null && !chaineExistante.trim().equals("")) {
|
136 |
if (chaineExistante != null && !chaineExistante.trim().equals("")) {
|
136 |
String[] valeurs = chaineExistante.split(";;");
|
137 |
String[] valeurs = chaineExistante.split(aDonnee.SEPARATEUR_VALEURS);
|
137 |
for (int i = 0; i < valeurs.length; i++) {
|
138 |
for (int i = 0; i < valeurs.length; i++) {
|
138 |
String[] idEtValeur = valeurs[i].split("##");
|
139 |
String[] idEtValeur = valeurs[i].split(aDonnee.SEPARATEUR_TYPE_VALEUR);
|
139 |
String id = idEtValeur[0];
|
140 |
String idType = idEtValeur[0];
|
Line 140... |
Line 141... |
140 |
String valeur = idEtValeur[1];
|
141 |
String idValeur = idEtValeur[1];
|
141 |
|
142 |
|
142 |
ListStore<Valeur> store = types.getStore();
|
143 |
ListStore<Valeur> typeStore = types.getStore();
|
143 |
Valeur objetValeur = store.findModel("id_valeur",id);
|
144 |
Valeur objetType = typeStore.findModel("id_valeur", idType);
|
144 |
String texte = "";
|
145 |
String texteType = "";
|
145 |
if (objetValeur!=null) {
|
146 |
if (objetType != null) {
|
146 |
texte = objetValeur.getNom();
|
147 |
texteType = objetType.getNom();
|
147 |
} else {
|
148 |
} else {
|
- |
|
149 |
texteType = idType;
|
- |
|
150 |
}
|
- |
|
151 |
|
- |
|
152 |
ListStore<Valeur> valeurStore = champValeurCombo.getStore();
|
- |
|
153 |
Valeur objetValeur = valeurStore.findModel("id_valeur", idValeur);
|
- |
|
154 |
String texteValeur = "";
|
- |
|
155 |
if (objetValeur != null) {
|
- |
|
156 |
texteValeur = objetValeur.getNom();
|
- |
|
157 |
} else {
|
148 |
texte = id;
|
158 |
texteValeur = idValeur;
|
149 |
}
|
159 |
}
|
150 |
ajouterValeur(valeur, texte, id);
|
160 |
ajouterValeur(texteValeur, texteType, idType);
|
151 |
}
|
161 |
}
|
152 |
}
|
162 |
}
|