View Javadoc
1   package fr.ifremer.dali.ui.swing.content.home.map;
2   
3   import fr.ifremer.dali.ui.swing.DaliHelpBroker;
4   import fr.ifremer.dali.ui.swing.DaliUIContext;
5   import fr.ifremer.dali.ui.swing.util.DaliUI;
6   import fr.ifremer.dali.ui.swing.util.map.DataMapPane;
7   import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
8   import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
9   import fr.ifremer.quadrige3.ui.swing.plaf.WaitBlockingLayerUI;
10  import java.awt.BorderLayout;
11  import java.awt.Color;
12  import java.awt.Component;
13  import java.awt.Container;
14  import java.awt.LayoutManager;
15  import java.awt.event.ActionEvent;
16  import java.awt.event.ActionListener;
17  import java.util.ArrayList;
18  import java.util.HashMap;
19  import java.util.List;
20  import java.util.Map;
21  import java.util.TreeMap;
22  import javax.swing.BorderFactory;
23  import javax.swing.Box;
24  import javax.swing.BoxLayout;
25  import javax.swing.JButton;
26  import javax.swing.JLabel;
27  import javax.swing.JPanel;
28  import javax.swing.JToggleButton;
29  import javax.swing.SwingConstants;
30  import jaxx.runtime.JAXXBinding;
31  import jaxx.runtime.JAXXContext;
32  import jaxx.runtime.JAXXObject;
33  import jaxx.runtime.JAXXObjectDescriptor;
34  import jaxx.runtime.JAXXUtil;
35  import jaxx.runtime.SwingUtil;
36  import jaxx.runtime.binding.DefaultJAXXBinding;
37  import jaxx.runtime.context.DefaultJAXXContext;
38  import jaxx.runtime.swing.help.JAXXHelpUI;
39  import org.apache.commons.logging.Log;
40  import org.apache.commons.logging.LogFactory;
41  import static org.nuiton.i18n.I18n.t;
42  
43  public class SurveysMapUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, DaliUI<SurveysMapUIModel, SurveysMapUIHandler>, JAXXObject {
44  
45      /*-----------------------------------------------------------------------*/
46      /*------------------ Constants for all public bindings ------------------*/
47      /*-----------------------------------------------------------------------*/
48  
49      public static final String BINDING_MAP_BLOCK_LAYER_BLOCK = "mapBlockLayer.block";
50  
51      /*-----------------------------------------------------------------------*/
52      /*------------------------- Other static fields -------------------------*/
53      /*-----------------------------------------------------------------------*/
54  
55      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAMVWzW8bRRSfuHXSfNG0VUNDQkkTEGlJNmmrckkFbb6Ii/Mh4opCDmXsHTvTjne2s+PUJiriT+BPgDsXJG6cEAfOHAAJceSKEAeuiPdmN17verex6wORslrve+83v/dm5vfe13+SrKfIlUe0XrdUzdG8yqx7dx882Ck+YiW9xryS4q6Wivh/fRmS2SfDdvO7p8nsfh7DF4PwxVVZdaXDnJbo5TwZ8nRDMO+AMa3Jq9GIkuct7jXNy3W3po5Rm6SSUL/8+6/MF/bnX2UIqbvAbhxSmT4pKszkdJ5kuK3JeVjpkC4K6lSAhuJOBfiO4rdVQT1vm1bZE/IZGciTfpcqANNkpvOUDYaJr7uajHg1dcga3hZ17+c0ebusLF5WrMqUZVPBrRq3vKfAwCpJRwOgdSAhjSp1rb2WQNc1iP2aZKvSZkKT5RcD2sLoEK2/qORjpjR5MxVuDX5tQsyK8QxDRwF6RcjS4zxtIEJrZk9q1Fa8wm6GMK6gZetDyrWJgS8mrDWzUSSupPB2qYMZnscNqQfh98xH9BxsBox9KmU15xSkFCs1rSGaXIjE+F/R+2Iz6BwG7dR0GIWGV6JOw4p5TKeaRxFjg6c7DHguLTF1PZ5Enhb9JFqwZLksuMOOM5iIBBRkpSJYUh5nK4pqXqq1WmMsRgSrMMc+ieUN/DkbNY2Va0LslRRjTno4HADcFU0WUg9PTXNhzuAa1XTL949u4hBYzV5QhV9ejloHuVOWzaoZkjfCXXq9eQ2Xgkpb9KkONSDqPiYktYFUzrF5icKNTYAcAzbrziET0mVpy6LPrvS45tJp81FkMqJHoHRWqHShFPXtk6yCzQM5vbTfLo4fgMmXxUsxWURAY/13/MLP3/3+7caxFk7C2hcTXVukHDTKVZCb0hyXPusLIe7SIuzO8j4Z9JiAPmB0fiqB2F5gBnKw3jlTc7PJm9Q7AIjswG/f/zD+yU+nSGaDDGHFNyj658igPoBbdSCFXXffvWMYjTw9A88x+M+gFEllo5DcPloxb35gw4JTSDUrcC2Y7Vvm9NyMOWdNidNonbl69RkcqIcuSkWh4UK9J49Qvu7nrPW1XCG3s/1w9+72ev5h4aPd9Wd1qO5UQnWbKRYHf/znwt43d44r3AcZT6S6h1XOfkz6uYOX2vSboJUk9pdh12M1W4YtI6mJkFgXcQPNXDPPzbZi9rUUcyGxmHkUHL+Uq1JIZa3k766+fxVKgojbJld82yXhNT9pVdjCbBG1HVT4yDQpi3t5/8rN4caMFgPlN0sitQPq2AI0o8L0qnTKHPz8d7BH2sRcMrVoC+qA4BBUAW5tDjsN6fePOuiIBv0pcLfA6vBr2pws39E/W2C1bFamNaHhoLlJTM4F9rCrdM3Gb2ZxNq8lsvF908i09cVuuQwEPbKz0gTOqaVpa7jd0jkDSy1gQ4rzmYjzMW07jUhrU++WAnaphRK0FLxTURKTcRLBcJBGIzo8dEtkGIkEI0OcyZX27cHpYcf3TuUTGUC65TPYHEPibGaT2bx37J/GJz7YdMsoS4uyo6OLbPJmQkqjEhmguj4y4QgVJ3M5TiZ0Tb3T8YGsmyZwLbEJrFdd3Qi6wNL8rfml+aVkmW0beLpZ+60T176+NL+UvvjxKP0/rHnjpDVPvUCNb2ErHDjkHi/incmWqQBVIqe5OTTXjvZwbr6PE5WPkKvSCsMTNTcTzK9WhZdnUnYqPuJ2UjVBG+bCvHTbhiF9usgdhHinDb8Pn0MnIuLnX/DxazLCeM8INzvIytTzORgTHbH44zkIUz0jXO4ZYbpnhDd6RpjrGeFazwgWIPwHtPAxHdoSAAA=";
56      public static final String PROPERTY$COMPONENT0 = "$Component0";
57      private static final Log log = LogFactory.getLog(SurveysMapUI.class);
58      private static final long serialVersionUID = 1L;
59  
60      /*-----------------------------------------------------------------------*/
61      /*--------------------------- Internal states ---------------------------*/
62      /*-----------------------------------------------------------------------*/
63  
64      protected List<Object> $activeBindings = new ArrayList<Object>();
65      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
66      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
67      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
68      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
69      private boolean allComponentsCreated;
70      protected final JAXXContext delegateContext = new DefaultJAXXContext();
71  
72      /*-----------------------------------------------------------------------*/
73      /*------------------------ Protected components  ------------------------*/
74      /*-----------------------------------------------------------------------*/
75  
76      protected DaliHelpBroker broker;
77      protected JPanel controlsPanel;
78      protected JButton fullScreenButton;
79      protected JButton graticuleButton;
80      protected final SurveysMapUIHandler handler = createHandler();
81      protected JLabel infoLabel;
82      protected JButton legendButton;
83      protected JLabel loadingIndicator;
84      protected WaitBlockingLayerUI mapBlockLayer;
85      protected JLabel mapEnvelopeLabel;
86      protected DataMapPane mapPane;
87      protected JLabel mapPositionLabel;
88      protected JPanel mapToolBar;
89      protected SurveysMapUIModel model;
90      protected JToggleButton offlineButton;
91      protected JButton resetButton;
92      protected JLabel spacer1;
93      protected JLabel spacer2;
94      protected SurveysMapUI surveysMapUI = this;
95      protected JButton zoomFitButton;
96      protected JButton zoomInToolButton;
97      protected JButton zoomOutToolButton;
98  
99      /*-----------------------------------------------------------------------*/
100     /*------------------------- Private components  -------------------------*/
101     /*-----------------------------------------------------------------------*/
102 
103     private Component $Component0;
104 
105     /*-----------------------------------------------------------------------*/
106     /*---------------------------- Constructors  ----------------------------*/
107     /*-----------------------------------------------------------------------*/
108 
109     public SurveysMapUI(ApplicationUI parentUI) {
110         ApplicationUIUtil.setParentUI(this, parentUI);
111             $initialize();
112     }
113 
114     public SurveysMapUI() {
115         $initialize();
116     }
117 
118     public SurveysMapUI(JAXXContext parentContext) {
119         JAXXUtil.initContext(this, parentContext);
120         $initialize();
121     }
122 
123     public SurveysMapUI(boolean param0) {
124         super(param0);
125         $initialize();
126     }
127 
128     public SurveysMapUI(JAXXContext parentContext, boolean param1) {
129         super(param1);
130         JAXXUtil.initContext(this, parentContext);
131         $initialize();
132     }
133 
134     public SurveysMapUI(LayoutManager param0) {
135         super(param0);
136         $initialize();
137     }
138 
139     public SurveysMapUI(JAXXContext parentContext, LayoutManager param1) {
140         super(param1);
141         JAXXUtil.initContext(this, parentContext);
142         $initialize();
143     }
144 
145     public SurveysMapUI(LayoutManager param0, boolean param1) {
146         super(param0 ,param1);
147         $initialize();
148     }
149 
150     public SurveysMapUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
151         super(param1 ,param2);
152         JAXXUtil.initContext(this, parentContext);
153         $initialize();
154     }
155 
156     /*-----------------------------------------------------------------------*/
157     /*--------------------------- Statics methods ---------------------------*/
158     /*-----------------------------------------------------------------------*/
159 
160     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
161         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
162     }
163 
164     /*-----------------------------------------------------------------------*/
165     /*---------------------- JAXXObject implementation ----------------------*/
166     /*-----------------------------------------------------------------------*/
167 
168     @Override
169     public void applyDataBinding(String $binding) {
170         if (allComponentsCreated && $bindings.containsKey($binding)) {
171             getDataBinding($binding).applyDataBinding();
172         }
173         processDataBinding($binding);
174     }
175 
176     @Override
177     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
178         super.firePropertyChange(propertyName, oldValue, newValue);
179     }
180 
181     @Override
182     public Map<String, Object> get$objectMap() {
183         return $objectMap;
184     }
185 
186     @Override
187     public JAXXBinding getDataBinding(String bindingId) {
188         return $bindings.get(bindingId);
189     }
190 
191     @Override
192     public JAXXBinding[] getDataBindings() {
193         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
194     }
195 
196     @Override
197     public Object getObjectById(String id) {
198         return $objectMap.get(id);
199     }
200 
201     @Override
202     public void processDataBinding(String $binding, boolean $force) {
203         if (!$force && $activeBindings.contains($binding)) { 
204             return;
205         }
206         $activeBindings.add($binding);
207         try {
208             if (allComponentsCreated && $bindings.containsKey($binding)) {
209                 getDataBinding($binding).processDataBinding();
210             }
211         } finally {
212             $activeBindings.remove($binding);
213         }
214     }
215 
216     @Override
217     public void processDataBinding(String $binding) {
218         processDataBinding($binding, false);
219     }
220 
221     @Override
222     public void registerDataBinding(JAXXBinding binding) {
223         $bindings.put(binding.getId(), binding);
224     }
225 
226     @Override
227     public void removeDataBinding(String $binding) {
228         if (allComponentsCreated && $bindings.containsKey($binding)) {
229             getDataBinding($binding).removeDataBinding();
230         }
231     }
232 
233     /*-----------------------------------------------------------------------*/
234     /*--------------------- JAXXContext implementation  ---------------------*/
235     /*-----------------------------------------------------------------------*/
236 
237     @Override
238     public <T> T getContextValue(Class<T> clazz) {
239         return delegateContext.getContextValue(clazz, null);
240     }
241 
242     @Override
243     public <T> T getContextValue(Class<T> clazz, String name) {
244         return delegateContext.getContextValue(clazz, name);
245     }
246 
247     @Override
248     public JAXXContext getDelegateContext() {
249         return delegateContext;
250     }
251 
252     @Override
253     public <O extends Container> O getParentContainer(Class<O> clazz) {
254         return SwingUtil.getParentContainer(this, clazz);
255     }
256 
257     @Override
258     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
259         return SwingUtil.getParentContainer(source, clazz);
260     }
261 
262     @Override
263     public <T> void removeContextValue(Class<T> clazz) {
264         delegateContext.removeContextValue(clazz, null);
265     }
266 
267     @Override
268     public <T> void removeContextValue(Class<T> clazz, String name) {
269         delegateContext.removeContextValue(clazz, name);
270     }
271 
272     @Override
273     public <T> void setContextValue(T o) {
274         delegateContext.setContextValue(o, null);
275     }
276 
277     @Override
278     public <T> void setContextValue(T o, String name) {
279         delegateContext.setContextValue(o, name);
280     }
281 
282     /*-----------------------------------------------------------------------*/
283     /*---------------------------- Event methods ----------------------------*/
284     /*-----------------------------------------------------------------------*/
285 
286     public void doActionPerformed__on__fullScreenButton(ActionEvent event) {
287         if (log.isDebugEnabled()) {
288             log.debug(event);
289         }
290         handler.fullScreen();
291     }
292 
293     public void doActionPerformed__on__graticuleButton(ActionEvent event) {
294         if (log.isDebugEnabled()) {
295             log.debug(event);
296         }
297         handler.toggleGraticule();
298     }
299 
300     public void doActionPerformed__on__legendButton(ActionEvent event) {
301         if (log.isDebugEnabled()) {
302             log.debug(event);
303         }
304         handler.toggleLegend();
305     }
306 
307     public void doActionPerformed__on__offlineButton(ActionEvent event) {
308         if (log.isDebugEnabled()) {
309             log.debug(event);
310         }
311         handler.toggleOffline();
312     }
313 
314     public void doActionPerformed__on__resetButton(ActionEvent event) {
315         if (log.isDebugEnabled()) {
316             log.debug(event);
317         }
318         mapPane.reset();
319     }
320 
321     public void doActionPerformed__on__zoomFitButton(ActionEvent event) {
322         if (log.isDebugEnabled()) {
323             log.debug(event);
324         }
325         handler.zoomFit();
326     }
327 
328     public void doActionPerformed__on__zoomInToolButton(ActionEvent event) {
329         if (log.isDebugEnabled()) {
330             log.debug(event);
331         }
332         mapPane.zoomIn();
333     }
334 
335     public void doActionPerformed__on__zoomOutToolButton(ActionEvent event) {
336         if (log.isDebugEnabled()) {
337             log.debug(event);
338         }
339         mapPane.zoomOut();
340     }
341 
342     /*-----------------------------------------------------------------------*/
343     /*----------------------- Public acessor methods  -----------------------*/
344     /*-----------------------------------------------------------------------*/
345 
346     public DaliHelpBroker getBroker() {
347         return broker;
348     }
349 
350     public JPanel getControlsPanel() {
351         return controlsPanel;
352     }
353 
354     public JButton getFullScreenButton() {
355         return fullScreenButton;
356     }
357 
358     public JButton getGraticuleButton() {
359         return graticuleButton;
360     }
361 
362     public SurveysMapUIHandler getHandler() {
363         return handler;
364     }
365 
366     public JLabel getInfoLabel() {
367         return infoLabel;
368     }
369 
370     public JButton getLegendButton() {
371         return legendButton;
372     }
373 
374     public JLabel getLoadingIndicator() {
375         return loadingIndicator;
376     }
377 
378     public WaitBlockingLayerUI getMapBlockLayer() {
379         return mapBlockLayer;
380     }
381 
382     public JLabel getMapEnvelopeLabel() {
383         return mapEnvelopeLabel;
384     }
385 
386     public DataMapPane getMapPane() {
387         return mapPane;
388     }
389 
390     public JLabel getMapPositionLabel() {
391         return mapPositionLabel;
392     }
393 
394     public JPanel getMapToolBar() {
395         return mapToolBar;
396     }
397 
398     public SurveysMapUIModel getModel() {
399         return model;
400     }
401 
402     public JToggleButton getOfflineButton() {
403         return offlineButton;
404     }
405 
406     public JButton getResetButton() {
407         return resetButton;
408     }
409 
410     public JLabel getSpacer1() {
411         return spacer1;
412     }
413 
414     public JLabel getSpacer2() {
415         return spacer2;
416     }
417 
418     public JButton getZoomFitButton() {
419         return zoomFitButton;
420     }
421 
422     public JButton getZoomInToolButton() {
423         return zoomInToolButton;
424     }
425 
426     public JButton getZoomOutToolButton() {
427         return zoomOutToolButton;
428     }
429 
430     /*-----------------------------------------------------------------------*/
431     /*----------------------- Public mutator methods  -----------------------*/
432     /*-----------------------------------------------------------------------*/
433 
434     public void set$Component0(Component $Component0) {
435         Component oldValue = this.$Component0;
436         this.$Component0 = $Component0;
437         firePropertyChange(PROPERTY$COMPONENT0, oldValue, $Component0);
438     }
439 
440     /*-----------------------------------------------------------------------*/
441     /*---------------------------- Other methods ----------------------------*/
442     /*-----------------------------------------------------------------------*/
443 
444     @Override
445     public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
446         broker.installUI(component, helpId);
447     }
448 
449     @Override
450     public void showHelp(String helpId) {
451         getBroker().showHelp(this, helpId);
452     }
453 
454     /*-----------------------------------------------------------------------*/
455     /*--------------------- Protected acessors methods  ---------------------*/
456     /*-----------------------------------------------------------------------*/
457 
458     protected Component get$Component0() {
459         return $Component0;
460     }
461 
462     /*-----------------------------------------------------------------------*/
463     /*--------------------- Components creation methods ---------------------*/
464     /*-----------------------------------------------------------------------*/
465 
466     protected void addChildrenToControlsPanel() {
467         if (!allComponentsCreated) {
468             return;
469         }
470         controlsPanel.add(zoomInToolButton);
471         controlsPanel.add(zoomOutToolButton);
472         controlsPanel.add(resetButton);
473         controlsPanel.add(zoomFitButton);
474         controlsPanel.add(spacer1);
475         controlsPanel.add(offlineButton);
476         controlsPanel.add(graticuleButton);
477         controlsPanel.add(legendButton);
478         controlsPanel.add(spacer2);
479         controlsPanel.add(fullScreenButton);
480     }
481 
482     protected void addChildrenToMapToolBar() {
483         if (!allComponentsCreated) {
484             return;
485         }
486         mapToolBar.add(infoLabel);
487         mapToolBar.add($Component0);
488         mapToolBar.add(loadingIndicator);
489         mapToolBar.add(mapEnvelopeLabel);
490         mapToolBar.add(mapPositionLabel);
491     }
492 
493     protected void addChildrenToSurveysMapUI() {
494         if (!allComponentsCreated) {
495             return;
496         }
497         add(controlsPanel, BorderLayout.LINE_START);
498         add(SwingUtil.boxComponentWithJxLayer(mapPane), BorderLayout.CENTER);
499         add(mapToolBar, BorderLayout.PAGE_END);
500     }
501 
502     protected void createBroker() {
503         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.map.help"));
504     }
505 
506     protected void createControlsPanel() {
507         $objectMap.put("controlsPanel", controlsPanel = new JPanel());
508         
509         controlsPanel.setName("controlsPanel");
510         controlsPanel.setLayout(new BoxLayout(controlsPanel, BoxLayout.PAGE_AXIS));
511     }
512 
513     protected void createFullScreenButton() {
514         $objectMap.put("fullScreenButton", fullScreenButton = new JButton());
515         
516         fullScreenButton.setName("fullScreenButton");
517         fullScreenButton.setToolTipText(t("dali.action.map.fullScreen.tip"));
518         fullScreenButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__fullScreenButton"));
519     }
520 
521     protected void createGraticuleButton() {
522         $objectMap.put("graticuleButton", graticuleButton = new JButton());
523         
524         graticuleButton.setName("graticuleButton");
525         graticuleButton.setToolTipText(t("dali.action.map.toggleGraticule.tip"));
526         graticuleButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__graticuleButton"));
527     }
528 
529     protected SurveysMapUIHandler createHandler() {
530         return new SurveysMapUIHandler();
531     }
532 
533     protected void createInfoLabel() {
534         $objectMap.put("infoLabel", infoLabel = new JLabel());
535         
536         infoLabel.setName("infoLabel");
537     }
538 
539     protected void createLegendButton() {
540         $objectMap.put("legendButton", legendButton = new JButton());
541         
542         legendButton.setName("legendButton");
543         legendButton.setToolTipText(t("dali.action.map.toggleLegend.tip"));
544         legendButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__legendButton"));
545     }
546 
547     protected void createLoadingIndicator() {
548         $objectMap.put("loadingIndicator", loadingIndicator = new JLabel());
549         
550         loadingIndicator.setName("loadingIndicator");
551         loadingIndicator.setVisible(false);
552     }
553 
554     protected void createMapBlockLayer() {
555         $objectMap.put("mapBlockLayer", mapBlockLayer = new WaitBlockingLayerUI());
556     }
557 
558     protected void createMapEnvelopeLabel() {
559         $objectMap.put("mapEnvelopeLabel", mapEnvelopeLabel = new JLabel());
560         
561         mapEnvelopeLabel.setName("mapEnvelopeLabel");
562     }
563 
564     protected void createMapPane() {
565         $objectMap.put("mapPane", mapPane = new DataMapPane());
566         
567         mapPane.setName("mapPane");
568     }
569 
570     protected void createMapPositionLabel() {
571         $objectMap.put("mapPositionLabel", mapPositionLabel = new JLabel());
572         
573         mapPositionLabel.setName("mapPositionLabel");
574     }
575 
576     protected void createMapToolBar() {
577         $objectMap.put("mapToolBar", mapToolBar = new JPanel());
578         
579         mapToolBar.setName("mapToolBar");
580         mapToolBar.setLayout(new BoxLayout(mapToolBar, BoxLayout.LINE_AXIS));
581     }
582 
583     protected void createModel() {
584         $objectMap.put("model", model = getContextValue(SurveysMapUIModel.class));
585     }
586 
587     protected void createOfflineButton() {
588         $objectMap.put("offlineButton", offlineButton = new JToggleButton());
589         
590         offlineButton.setName("offlineButton");
591         offlineButton.setToolTipText(t("dali.action.map.toggleOffline.tip"));
592         offlineButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__offlineButton"));
593     }
594 
595     protected void createResetButton() {
596         $objectMap.put("resetButton", resetButton = new JButton());
597         
598         resetButton.setName("resetButton");
599         resetButton.setToolTipText(t("dali.action.map.reset.tip"));
600         resetButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__resetButton"));
601     }
602 
603     protected void createSpacer1() {
604         $objectMap.put("spacer1", spacer1 = new JLabel());
605         
606         spacer1.setName("spacer1");
607     }
608 
609     protected void createSpacer2() {
610         $objectMap.put("spacer2", spacer2 = new JLabel());
611         
612         spacer2.setName("spacer2");
613     }
614 
615     protected void createZoomFitButton() {
616         $objectMap.put("zoomFitButton", zoomFitButton = new JButton());
617         
618         zoomFitButton.setName("zoomFitButton");
619         zoomFitButton.setToolTipText(t("dali.action.map.zoomFit.tip"));
620         zoomFitButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__zoomFitButton"));
621     }
622 
623     protected void createZoomInToolButton() {
624         $objectMap.put("zoomInToolButton", zoomInToolButton = new JButton());
625         
626         zoomInToolButton.setName("zoomInToolButton");
627         zoomInToolButton.setToolTipText(t("dali.action.map.tool.zoomIn.tip"));
628         zoomInToolButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__zoomInToolButton"));
629     }
630 
631     protected void createZoomOutToolButton() {
632         $objectMap.put("zoomOutToolButton", zoomOutToolButton = new JButton());
633         
634         zoomOutToolButton.setName("zoomOutToolButton");
635         zoomOutToolButton.setToolTipText(t("dali.action.map.tool.zoomOut.tip"));
636         zoomOutToolButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__zoomOutToolButton"));
637     }
638 
639     /*-----------------------------------------------------------------------*/
640     /*------------------------ Internal jaxx methods ------------------------*/
641     /*-----------------------------------------------------------------------*/
642 
643     private void $completeSetup() {
644         allComponentsCreated = true;
645         if (log.isDebugEnabled()) {
646             log.debug(this);
647         }
648         addChildrenToSurveysMapUI();
649         addChildrenToControlsPanel();
650         addChildrenToMapToolBar();
651         
652         // apply 1 data bindings
653         JAXXUtil.applyDataBinding(this, $bindings.keySet());
654         
655         // apply 19 property setters
656         setBorder(BorderFactory.createTitledBorder(t("dali.home.map.title")));
657         mapBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
658         zoomInToolButton.setIcon(SwingUtil.createActionIcon("zoomIn"));
659         zoomOutToolButton.setIcon(SwingUtil.createActionIcon("zoomOut"));
660         resetButton.setIcon(SwingUtil.createActionIcon("map-full"));
661         zoomFitButton.setIcon(SwingUtil.createActionIcon("map-center"));
662         spacer1.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
663         offlineButton.setIcon(SwingUtil.createActionIcon("map-offline"));
664         graticuleButton.setIcon(SwingUtil.createActionIcon("graticule"));
665         legendButton.setIcon(SwingUtil.createActionIcon("about"));
666         spacer2.setBorder(BorderFactory.createEmptyBorder(10,0,0,0));
667         fullScreenButton.setIcon(SwingUtil.createActionIcon("fullScreen"));
668         mapPane.setBorder(BorderFactory.createLineBorder(Color.BLACK));
669         loadingIndicator.setBorder(BorderFactory.createEmptyBorder(0,5,0,5));
670         loadingIndicator.setIcon(SwingUtil.createImageIcon("loading.gif"));
671         mapPositionLabel.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
672     }
673 
674     private void $initialize() {
675         if (allComponentsCreated) {
676             return;
677         }
678         if (log.isDebugEnabled()) {
679             log.debug(this);
680         }
681         handler.beforeInit(this);
682         $objectMap.put("surveysMapUI", surveysMapUI);
683         createModel();
684         createBroker();
685         createMapBlockLayer();
686         createControlsPanel();
687         createZoomInToolButton();
688         createZoomOutToolButton();
689         createResetButton();
690         createZoomFitButton();
691         createSpacer1();
692         createOfflineButton();
693         createGraticuleButton();
694         createLegendButton();
695         createSpacer2();
696         createFullScreenButton();
697         createMapPane();
698         createMapToolBar();
699         createInfoLabel();
700         // inline creation of $Component0
701         $objectMap.put("$Component0", $Component0 = Box.createHorizontalGlue());
702         
703         $Component0.setName("$Component0");
704         createLoadingIndicator();
705         createMapEnvelopeLabel();
706         createMapPositionLabel();
707         // inline creation of surveysMapUI
708         setName("surveysMapUI");
709         setLayout(new BorderLayout());
710         surveysMapUI.putClientProperty("panelType", DaliUI.EDITION_PANEL_TYPE);
711         
712         // registers 1 data bindings
713         $registerDefaultBindings();
714         $completeSetup();
715         handler.afterInit(this);
716     }
717 
718     private void $registerDefaultBindings() {
719         // register 1 data bindings
720         registerDataBinding(new DefaultJAXXBinding(this, BINDING_MAP_BLOCK_LAYER_BLOCK, true) {
721         
722             @Override
723             public void applyDataBinding() {
724                 if (model != null) {
725                     model.addPropertyChangeListener("loading", this);
726                 }
727             }
728         
729             @Override
730             public void processDataBinding() {
731                 if (model != null) {
732                     mapBlockLayer.setBlock(model.isLoading());
733                 }
734             }
735         
736             @Override
737             public void removeDataBinding() {
738                 if (model != null) {
739                     model.removePropertyChangeListener("loading", this);
740                 }
741             }
742         });
743     }
744 
745 }