Subversion Repositories eFlore/Applications.coel

Rev

Rev 968 | Rev 980 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 968 Rev 975
Line 1... Line 1...
1
package org.tela_botanica.client.vues.collection;
1
package org.tela_botanica.client.vues.collection;
Line 2... Line 2...
2
 
2
 
Line -... Line 3...
-
 
3
import java.util.ArrayList;
3
import java.util.ArrayList;
4
 
4
 
5
import org.tela_botanica.client.ComposantClass;
5
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.Mediateur;
6
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
7
import org.tela_botanica.client.composants.ChampComboBoxListeValeurs;
7
import org.tela_botanica.client.interfaces.Rafraichissable;
8
import org.tela_botanica.client.interfaces.Rafraichissable;
Line 14... Line 15...
14
import org.tela_botanica.client.util.UtilString;
15
import org.tela_botanica.client.util.UtilString;
15
import org.tela_botanica.client.vues.Formulaire;
16
import org.tela_botanica.client.vues.Formulaire;
16
import org.tela_botanica.client.vues.structure.StructureForm;
17
import org.tela_botanica.client.vues.structure.StructureForm;
Line 17... Line 18...
17
 
18
 
-
 
19
import com.extjs.gxt.ui.client.event.BaseEvent;
18
import com.extjs.gxt.ui.client.event.BaseEvent;
20
import com.extjs.gxt.ui.client.event.EventType;
19
import com.extjs.gxt.ui.client.event.Events;
21
import com.extjs.gxt.ui.client.event.Events;
20
import com.extjs.gxt.ui.client.event.Listener;
22
import com.extjs.gxt.ui.client.event.Listener;
21
import com.extjs.gxt.ui.client.widget.Info;
23
import com.extjs.gxt.ui.client.widget.Info;
22
import com.extjs.gxt.ui.client.widget.MessageBox;
24
import com.extjs.gxt.ui.client.widget.MessageBox;
Line 72... Line 74...
72
		
74
		
73
		nomChp  = new TextField<String>();
75
		nomChp  = new TextField<String>();
74
		nomChp.setTabIndex(tabIndex++);
76
		nomChp.setTabIndex(tabIndex++);
75
		nomChp.setFieldLabel(i18nC.nomCollection());
77
		nomChp.setFieldLabel(i18nC.nomCollection());
76
		nomChp.setAllowBlank(false);
78
		nomChp.setAllowBlank(false);
77
		nomChp.addStyleName("obligatoire");
79
		nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
78
		nomChp.addListener(Events.Change, new Listener<BaseEvent>() {
80
		nomChp.addListener(Events.Valid, new Listener<BaseEvent>() {
79
			@Override
81
			@Override
80
			public void handleEvent(BaseEvent be) {
82
			public void handleEvent(BaseEvent be) {
81
				nomChp.removeStyleName("obligatoire");
83
				nomChp.removeStyleName(ComposantClass.OBLIGATOIRE);
82
				nomChp.removeStyleName("obligatoire-ok");
84
				nomChp.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
83
				if (nomChp.getRawValue().length() != 0) {
85
				if (nomChp.getRawValue().length() != 0) {
84
					nomChp.addStyleName("obligatoire-ok");
86
					nomChp.addStyleName(ComposantClass.OBLIGATOIRE_OK);
85
				} else if (nomChp.getRawValue().length() == 0) {
87
				} else if (nomChp.getRawValue().length() == 0) {
86
					nomChp.addStyleName("obligatoire");
88
					nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
87
				}
89
				}
88
			}
90
			}
89
		});
91
		});
90
		nomChp.getMessages().setBlankText(i18nC.champObligatoire());
92
		nomChp.getMessages().setBlankText(i18nC.champObligatoire());
Line 91... Line 93...
91
		principalFieldSet.add(nomChp, new FormData(450, 0));
93
		principalFieldSet.add(nomChp, new FormData(450, 0));
92
		
94
		
93
		typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++);
95
		typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++);
94
		typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER);
96
		typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER);
95
		typesCollectionCombo.addStyleName("obligatoire");
97
		typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE);
96
		typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() {
98
		typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() {
97
			@Override
99
			@Override
Line 108... Line 110...
108
					onglets = creerOngletsDefaut();
110
					onglets = creerOngletsDefaut();
109
					panneauFormulaire.add(onglets);
111
					panneauFormulaire.add(onglets);
110
				}
112
				}
111
				mediateur.desactiverChargement();
113
				mediateur.desactiverChargement();
112
				panneauFormulaire.layout();
114
				panneauFormulaire.layout();
113
				
115
			}
-
 
116
		});
-
 
117
		typesCollectionCombo.addListener(Events.Valid, new Listener<BaseEvent>() {
-
 
118
			@Override
-
 
119
			public void handleEvent(BaseEvent be) {
-
 
120
				Valeur valeur = typesCollectionCombo.getValue();
114
				// Gestion du style obligatoire
121
				// Gestion du style obligatoire
115
				typesCollectionCombo.removeStyleName("obligatoire");
122
				typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE);
116
				typesCollectionCombo.removeStyleName("obligatoire-ok");
123
				typesCollectionCombo.removeStyleName(ComposantClass.OBLIGATOIRE_OK);
117
				if (valeur != null) {
124
				if (valeur != null) {
118
					typesCollectionCombo.addStyleName("obligatoire-ok");
125
					typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE_OK);
119
				} else {
126
				} else {
120
					typesCollectionCombo.addStyleName("obligatoire");
127
					typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE);
121
				}
128
				}
122
			}
129
			}
123
		});
130
		});
124
		principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
131
		principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
125
		typesCollectionCombo.fireEvent(Events.Select);
132
		typesCollectionCombo.fireEvent(Events.Select);