Subversion Repositories eFlore/Applications.coel

Rev

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

Rev 1041 Rev 1084
Line 55... Line 55...
55
		collection.setId(collectionId);
55
		collection.setId(collectionId);
Line 56... Line 56...
56
		
56
		
57
		String modeDeCreation = (UtilString.isEmpty(collection.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
57
		String modeDeCreation = (UtilString.isEmpty(collection.getId()) ? Formulaire.MODE_AJOUTER : Formulaire.MODE_MODIFIER);
Line -... Line 58...
-
 
58
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COLLECTION);
-
 
59
		
-
 
60
		String titre = genererTitreFormulaire();
-
 
61
		panneauFormulaire.setHeading(titre);
58
		initialiserFormulaire(mediateurCourrant, modeDeCreation, MenuApplicationId.COLLECTION);
62
		
Line 59... Line 63...
59
		
63
		creerOnglets();
60
		creerFieldsetPrincipal();
64
		creerFieldsetPrincipal();
61
		
65
		
62
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
66
		if (modeDeCreation.equals(Formulaire.MODE_MODIFIER)) {
63
			mediateurCourrant.selectionnerCollection(this, collectionId, null);
67
			mediateurCourrant.selectionnerCollection(this, collectionId, null);
64
			mediateurCourrant.selectionnerCollectionAPersonne(this, collectionId, null);
68
			mediateurCourrant.selectionnerCollectionAPersonne(this, collectionId, null);
65
			mediateurCourrant.selectionnerCollectionAPublication(this, collectionId);
69
			mediateurCourrant.selectionnerCollectionAPublication(this, collectionId);
Line -... Line 70...
-
 
70
			mediateurCourrant.selectionnerCollectionACommentaire(this, collectionId);
-
 
71
		}
-
 
72
	}
-
 
73
	
-
 
74
	private String genererTitreFormulaire() {
-
 
75
		String titre = i18nC.collectionTitreFormAjout();
-
 
76
		if (mode.equals(Formulaire.MODE_MODIFIER)) {
-
 
77
			 titre = i18nC.collectionTitreFormModif()+" - "+i18nC.id()+": "+collection.getId();
66
			mediateurCourrant.selectionnerCollectionACommentaire(this, collectionId);
78
		}
67
		}
79
		return titre;
68
	}
80
	}
69
	
81
	
70
	private void creerFieldsetPrincipal() {
82
	private void creerFieldsetPrincipal() {
Line 80... Line 92...
80
		nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
92
		nomChp.addStyleName(ComposantClass.OBLIGATOIRE);
81
		nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
93
		nomChp.addListener(Events.Valid, creerEcouteurChampObligatoire());
82
		nomChp.getMessages().setBlankText(i18nC.champObligatoire());
94
		nomChp.getMessages().setBlankText(i18nC.champObligatoire());
83
		principalFieldSet.add(nomChp, new FormData(450, 0));
95
		principalFieldSet.add(nomChp, new FormData(450, 0));
Line 84... Line -...
84
		
-
 
85
		typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++);
-
 
86
		typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER);
-
 
87
		typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE);
96
		
88
		typesCollectionCombo.addListener(Events.Select, new Listener<BaseEvent>() {
97
		Listener<BaseEvent> ecouteurTypeCollection = new Listener<BaseEvent>() {
89
			@Override
98
			@Override
90
			public void handleEvent(BaseEvent be) {
99
			public void handleEvent(BaseEvent be) {
Line 91... Line 100...
91
				Valeur valeur = typesCollectionCombo.getValue();
100
				Valeur valeur = typesCollectionCombo.getValue();
92
				
-
 
93
				// Gestion des onglets en fonction du type de collection
101
				
94
				panneauFormulaire.remove(onglets);
102
				// Gestion des onglets en fonction du type de collection
95
				mediateur.activerChargement("");
103
				mediateur.activerChargement("");
96
				if (valeur != null && valeur.getId().equals(Valeur.COLLECTION_NCD_HERBIER)) {
-
 
97
					onglets = creerOngletsHerbier();
104
				if (valeur != null && valeur.getId().equals(Valeur.COLLECTION_NCD_HERBIER)) {
98
					panneauFormulaire.add(onglets);
105
					activerOngletsHerbier();
99
				} else {
-
 
100
					onglets = creerOngletsDefaut();
106
				} else {
101
					panneauFormulaire.add(onglets);
107
					activerOngletsDefaut();
102
				}
-
 
103
				mediateur.desactiverChargement();
108
				}
104
				panneauFormulaire.layout();
109
				mediateur.desactiverChargement();
-
 
110
			}
-
 
111
		};
-
 
112
		
-
 
113
		typesCollectionCombo = new ChampComboBoxListeValeurs(i18nC.typeCollectionNcd(), "typeCollectionNcd", tabIndex++);
-
 
114
		typesCollectionCombo.peupler(Valeur.COLLECTION_NCD_HERBIER);
-
 
115
		typesCollectionCombo.addStyleName(ComposantClass.OBLIGATOIRE);
105
			}
116
		typesCollectionCombo.addListener(Events.Change, ecouteurTypeCollection);
106
		});
117
		typesCollectionCombo.addListener(Events.Select, ecouteurTypeCollection);
107
		typesCollectionCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
118
		typesCollectionCombo.addListener(Events.Valid, creerEcouteurChampObligatoire());
Line 108... Line 119...
108
		principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
119
		principalFieldSet.add(typesCollectionCombo, new FormData(150, 0));
109
		typesCollectionCombo.fireEvent(Events.Select);
120
		typesCollectionCombo.fireEvent(Events.Select);
Line 110... Line 121...
110
		
121
		
111
		panneauFormulaire.setTopComponent(principalFieldSet);
122
		panneauFormulaire.setTopComponent(principalFieldSet);
-
 
123
	}
112
	}
124
	
-
 
125
	private void activerOngletsDefaut() {
113
	
126
		if (onglets.findItem(CollectionFormGeneral.ID, false) == null) {
-
 
127
			onglets.add(generalOnglet);
-
 
128
		}
114
	protected TabPanel creerOngletsDefaut() {
129
		if (onglets.findItem(CollectionFormPersonne.ID, false) == null) {
-
 
130
			onglets.add(personneOnglet);
-
 
131
		}
-
 
132
		if (onglets.findItem(CollectionFormPublication.ID, false) != null) {
-
 
133
			onglets.remove(publicationOnglet);
-
 
134
		}
-
 
135
		if (onglets.findItem(CollectionFormDescription.ID, false) != null) {
115
		TabPanel ongletsCollectionDefaut = new TabPanel();
136
			onglets.remove(descriptionOnglet);
-
 
137
		}
116
		
138
		if (onglets.findItem(CollectionFormContenu.ID, false) != null) {
-
 
139
			onglets.remove(contenuOnglet);
-
 
140
		}
117
		// Onlget formulaire GENERAL
141
		if (onglets.findItem(CollectionFormInventaire.ID, false) != null) {
-
 
142
			onglets.remove(inventaireOnglet);
-
 
143
		}
-
 
144
		if (onglets.findItem(CollectionFormCommentaire.ID, false) != null) {
Line -... Line 145...
-
 
145
			onglets.remove(commentaireOnglet);
-
 
146
		}
-
 
147
		panneauFormulaire.layout();
-
 
148
	}
-
 
149
 
-
 
150
	private void activerOngletsHerbier() {
-
 
151
		if (onglets.findItem(CollectionFormGeneral.ID, false) == null) {
-
 
152
			onglets.add(generalOnglet);
118
		ongletsCollectionDefaut.add(creerOngletGeneral());
153
		}
-
 
154
		if (onglets.findItem(CollectionFormPersonne.ID, false) == null) {
-
 
155
			onglets.add(personneOnglet);
-
 
156
		}
-
 
157
		if (onglets.findItem(CollectionFormPublication.ID, false) == null) {
-
 
158
			onglets.add(publicationOnglet);
-
 
159
		}
-
 
160
		if (onglets.findItem(CollectionFormDescription.ID, false) == null) {
-
 
161
			onglets.add(descriptionOnglet);
-
 
162
		}
-
 
163
		if (onglets.findItem(CollectionFormContenu.ID, false) == null) {
-
 
164
			onglets.add(contenuOnglet);
-
 
165
		}
-
 
166
		if (onglets.findItem(CollectionFormInventaire.ID, false) == null) {
-
 
167
			onglets.add(inventaireOnglet);
119
		
168
		}
Line 120... Line 169...
120
		// Onlget formulaire AUTEUR
169
		if (onglets.findItem(CollectionFormCommentaire.ID, false) == null) {
121
		ongletsCollectionDefaut.add(creerOngletPersonne());
170
			onglets.add(commentaireOnglet);
122
 
171
		}
123
		return ongletsCollectionDefaut;
172
		panneauFormulaire.layout();
Line 124... Line 173...
124
	}
173
	}
125
	
174
	
Line 126... Line 175...
126
	protected TabPanel creerOngletsHerbier() {
175
	private void creerOnglets() {
127
		TabPanel ongletsCollectionHerbier = new TabPanel();
176
		onglets = new TabPanel();
Line 128... Line 177...
128
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
177
		// NOTE : pour faire apparaître les scrollBar il faut définir la hauteur du panneau d'onglets à 100% (autoHeight ne semble pas fonctionner) 
129
		ongletsCollectionHerbier.setHeight("100%");
178
		onglets.setHeight("100%");
Line 130... Line 179...
130
		
179
		
131
		// Onlget formulaire GENERAL
180
		// Onlget formulaire GENERAL
Line 132... Line 181...
132
		ongletsCollectionHerbier.add(creerOngletGeneral());
181
		onglets.add(creerOngletGeneral());
133
		
182
		
Line 134... Line 183...
134
		// Onlget formulaire AUTEUR
183
		// Onlget formulaire AUTEUR
135
		ongletsCollectionHerbier.add(creerOngletPersonne());
184
		onglets.add(creerOngletPersonne());
Line 136... Line 185...
136
		
185
		
137
		// Onlget formulaire PUBLICATION
186
		// Onlget formulaire PUBLICATION
Line 138... Line 187...
138
		ongletsCollectionHerbier.add(creerOngletPublication());
187
		onglets.add(creerOngletPublication());
139
		
188
		
Line 140... Line 189...
140
		// Onlget formulaire DESCRIPTION
189
		// Onlget formulaire DESCRIPTION
141
		ongletsCollectionHerbier.add(creerOngletDescription());
190
		onglets.add(creerOngletDescription());
Line 142... Line 191...
142
		
191
		
143
		// Onlget formulaire CONTENU
192
		// Onlget formulaire CONTENU
144
		ongletsCollectionHerbier.add(creerOngletContenu());
193
		onglets.add(creerOngletContenu());