source: ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/FacteurResultatBean.java @ 70

Last change on this file since 70 was 70, checked in by cbipsl, 14 years ago

maj eccad V3.2

  • Property svn:executable set to *
File size: 6.6 KB
Line 
1package org.medias.eccad.presentation.bean.emission;
2
3import java.util.List;
4
5import javax.faces.component.UIOutput;
6import javax.faces.component.UISelectOne;
7import javax.faces.context.FacesContext;
8import javax.faces.event.ActionEvent;
9import javax.faces.event.ValueChangeEvent;
10import javax.faces.model.SelectItem;
11import javax.servlet.http.HttpSession;
12
13
14import org.medias.eccad.metier.ServiceMetier;
15import org.medias.eccad.metier.emission.ServiceEmission;
16import org.medias.eccad.modele.RequeteFacteurEmission;
17import org.medias.eccad.modele.Zone;
18import org.medias.eccad.presentation.bean.AbstractVueBean;
19
20public class FacteurResultatBean extends AbstractVueBean {
21        private String url;
22        private Zone zone_demandee;
23        private Zone zone_visible;
24        private int clicX;
25        private int clicY;
26        private String url_legend;
27       
28        private UIOutput northbc;
29        private UIOutput southbc;
30        private UIOutput eastbc;
31        private UIOutput westbc;
32       
33        private List<SelectItem> liste_colormap;
34        private Long colormap_id;
35        private UISelectOne colormapUI;
36       
37        private List<SelectItem> liste_classdis;
38        private Long classdis_id;
39        private UISelectOne classdisUI;
40       
41        private List<SelectItem> liste_grille;
42        private Long grille_id;
43        private UISelectOne grilleUI;
44       
45        private EmissionBean emission;
46        private ServiceEmission service;
47        private RequeteFacteurEmission requete;
48       
49        private ServiceMetier serviceMetier;
50       
51        public FacteurResultatBean(EmissionBean emi, RequeteFacteurEmission requete) {
52                controleSession();
53                this.emission = emi;
54                this.service = emission.getService();
55                this.requete = requete;
56                clicX = -1;
57                clicY = -1;
58                serviceMetier = new ServiceMetier();
59                initialisation();
60        }
61       
62        public void initialisation() {
63                // FIXME: virer les colormap exponentielles
64                zone_demandee = new Zone();
65                Zone zone_init = emission.getFacteur().getZone();
66                zone_demandee.setNorthbc(zone_init.getNorthbc());
67                zone_demandee.setSouthbc(zone_init.getSouthbc());
68                zone_demandee.setEastbc(zone_init.getEastbc());
69                zone_demandee.setWestbc(zone_init.getWestbc());
70               
71                liste_grille = serviceMetier.getListGrille(emission.getBurnt().getBurnt().getId_item(),
72                                                                   emission.getBurnt().getDate_debut(), 
73                                                                   emission.getBurnt().getDate_fin(), null);
74                grille_id = (Long) liste_grille.get(0).getValue();
75                if (grilleUI != null)
76                        grilleUI.setValue(grille_id);
77
78//              liste_colormap = serviceMetier.getListColorDynamique(true);
79                liste_colormap = serviceMetier.getListMappingColor();
80                colormap_id = (Long) liste_colormap.get(0).getValue();
81                if (colormapUI != null)
82                        colormapUI.setValue(colormap_id);
83               
84                liste_classdis = serviceMetier.getListClassDynamique();
85                classdis_id = (Long) liste_classdis.get(0).getValue();
86                if (classdisUI != null)
87                        classdisUI.setValue(classdis_id);
88               
89                requete.setDatedeb(liste_grille.get(0).getLabel());
90                requete.setDatefin(liste_grille.get(0).getLabel());
91                requete.setColormap(colormap_id);
92                requete.setClassdis(classdis_id);
93               
94                majURLCarte(false,true);
95        }
96       
97        public void resetCarte(ActionEvent event) {
98                initialisation();
99        }
100       
101        public void clicOnCarte(ActionEvent event) {
102                service.zoom(clicX, clicY);
103                zone_visible = service.getzone();
104       
105                majURLCarte(true,false);
106        }
107       
108        private void majURLCarte(boolean zoom, boolean firstAff) {
109                url = service.getCarte(requete, zone_demandee, getIdUnique(), zoom, firstAff);
110                url_legend = service.getLegend(colormap_id, classdis_id, 5040, url);
111                zone_visible = service.getzone();
112                ////system.out.println(url_legend);
113        }
114       
115        public void majGrille(ValueChangeEvent event) {
116                grille_id = (Long) event.getNewValue();
117                if (grilleUI != null)
118                        grilleUI.setValue(grille_id);
119               
120                for (SelectItem item : liste_grille) {
121                        if (item.getValue().equals(grille_id)) {
122                                requete.setDatedeb(item.getLabel());
123                                requete.setDatefin(item.getLabel());
124                                break;
125                        }
126                }
127               
128                majURLCarte(false,false);
129        }
130       
131        public void majColormap(ValueChangeEvent event) {
132                colormap_id = (Long) event.getNewValue();
133                if (colormapUI != null)
134                        colormapUI.setValue(colormap_id);
135                requete.setColormap(colormap_id);
136               
137                majURLCarte(false,false);
138        }
139       
140        public int getClicX() {
141                return clicX;
142        }
143       
144        public void setClicX(int clicX) {
145                this.clicX = clicX;
146        }
147       
148        public int getClicY() {
149                return clicY;
150        }
151       
152        public void setClicY(int clicY) {
153                this.clicY = clicY;
154        }
155       
156        public Long getColormap_id() {
157                return colormap_id;
158        }
159       
160        public void setColormap_id(Long colormap_id) {
161                this.colormap_id = colormap_id;
162        }
163       
164        public UISelectOne getColormapUI() {
165                return colormapUI;
166        }
167       
168        public void setColormapUI(UISelectOne colormapUI) {
169                this.colormapUI = colormapUI;
170        }
171       
172        public UIOutput getEastbc() {
173                return eastbc;
174        }
175       
176        public void setEastbc(UIOutput eastbc) {
177                this.eastbc = eastbc;
178        }
179       
180        public List<SelectItem> getListe_colormap() {
181                return liste_colormap;
182        }
183       
184        public void setListe_colormap(List<SelectItem> liste_colormap) {
185                this.liste_colormap = liste_colormap;
186        }
187       
188        public UIOutput getNorthbc() {
189                return northbc;
190        }
191       
192        public void setNorthbc(UIOutput northbc) {
193                this.northbc = northbc;
194        }
195       
196        public UIOutput getSouthbc() {
197                return southbc;
198        }
199       
200        public void setSouthbc(UIOutput southbc) {
201                this.southbc = southbc;
202        }
203       
204        public String getUrl() {
205                return url;
206        }
207       
208        public void setUrl(String url) {
209                this.url = url;
210        }
211       
212        public String getUrl_legend() {
213                return url_legend;
214        }
215       
216        public void setUrl_legend(String url_legend) {
217                this.url_legend = url_legend;
218        }
219       
220        public UIOutput getWestbc() {
221                return westbc;
222        }
223       
224        public void setWestbc(UIOutput westbc) {
225                this.westbc = westbc;
226        }
227       
228//      private String statistique;
229//      private UISelectOne statistiqueUI;
230       
231//      private int nbrGrille;
232        private String getIdUnique() {
233                HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false);
234                if (session==null)
235                        return "";
236               
237                String imageID;
238               
239               
240                imageID = session.getId() + session.getLastAccessedTime() ;
241               
242                return imageID;
243        }
244
245        public Long getGrille_id() {
246                return grille_id;
247        }
248
249        public void setGrille_id(Long grille_id) {
250                this.grille_id = grille_id;
251        }
252
253        public UISelectOne getGrilleUI() {
254                return grilleUI;
255        }
256
257        public void setGrilleUI(UISelectOne grilleUI) {
258                this.grilleUI = grilleUI;
259        }
260
261        public List<SelectItem> getListe_grille() {
262                return liste_grille;
263        }
264
265        public void setListe_grille(List<SelectItem> liste_grille) {
266                this.liste_grille = liste_grille;
267        }
268
269        public Zone getZone_demandee() {
270                return zone_demandee;
271        }
272
273        public void setZone_demandee(Zone zoneDemandee) {
274                zone_demandee = zoneDemandee;
275        }
276
277        public Zone getZone_visible() {
278                return zone_visible;
279        }
280
281        public void setZone_visible(Zone zoneVisible) {
282                zone_visible = zoneVisible;
283        }
284}
Note: See TracBrowser for help on using the repository browser.