View Javadoc
1   package fr.ifremer.dali.ui.swing.content.observation;
2   
3   import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
4   import fr.ifremer.dali.ui.swing.DaliHelpBroker;
5   import fr.ifremer.dali.ui.swing.DaliUIContext;
6   import fr.ifremer.dali.ui.swing.content.observation.operation.measurement.OperationMeasurementsTabUI;
7   import fr.ifremer.dali.ui.swing.content.observation.photo.PhotosTabUI;
8   import fr.ifremer.dali.ui.swing.content.observation.survey.SurveyDetailsTabUI;
9   import fr.ifremer.dali.ui.swing.util.DaliUI;
10  import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
11  import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
12  import fr.ifremer.quadrige3.ui.swing.plaf.ComponentBlockingLayerUI;
13  import java.awt.BorderLayout;
14  import java.awt.Color;
15  import java.awt.Component;
16  import java.awt.Container;
17  import java.awt.Font;
18  import java.awt.GridLayout;
19  import java.awt.LayoutManager;
20  import java.util.ArrayList;
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  import java.util.TreeMap;
25  import javax.swing.Box;
26  import javax.swing.BoxLayout;
27  import javax.swing.JButton;
28  import javax.swing.JLabel;
29  import javax.swing.JPanel;
30  import javax.swing.JTabbedPane;
31  import javax.swing.SwingConstants;
32  import javax.swing.border.EmptyBorder;
33  import jaxx.runtime.JAXXBinding;
34  import jaxx.runtime.JAXXContext;
35  import jaxx.runtime.JAXXObject;
36  import jaxx.runtime.JAXXObjectDescriptor;
37  import jaxx.runtime.JAXXUtil;
38  import jaxx.runtime.SwingUtil;
39  import jaxx.runtime.binding.DefaultJAXXBinding;
40  import jaxx.runtime.context.DefaultJAXXContext;
41  import jaxx.runtime.swing.TabInfo;
42  import jaxx.runtime.swing.TabInfoPropertyChangeListener;
43  import jaxx.runtime.swing.help.JAXXHelpUI;
44  import org.apache.commons.logging.Log;
45  import org.apache.commons.logging.LogFactory;
46  import static org.nuiton.i18n.I18n.t;
47  
48  public class ObservationUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, DaliUI<ObservationUIModel, ObservationUIHandler>, JAXXObject {
49  
50      /*-----------------------------------------------------------------------*/
51      /*------------------ Constants for all public bindings ------------------*/
52      /*-----------------------------------------------------------------------*/
53  
54      public static final String BINDING_CLOSE_BUTTON_ENABLED = "closeButton.enabled";
55      public static final String BINDING_NEXT_BUTTON_ENABLED = "nextButton.enabled";
56      public static final String BINDING_OBSERVATION_DESCRIPTION_LABEL_TEXT = "observationDescriptionLabel.text";
57      public static final String BINDING_SAVE_BUTTON_ENABLED = "saveButton.enabled";
58      public static final String BINDING_SURVEY_BLOCK_LAYER_BLOCK = "surveyBlockLayer.block";
59  
60      /*-----------------------------------------------------------------------*/
61      /*------------------------- Other static fields -------------------------*/
62      /*-----------------------------------------------------------------------*/
63  
64      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAK1Wz28bRRSeuLHTJBTShKRNmkpuWpUEwoY0ogeC2iROrCQ4ScFpFREhGO+O42nHO9vZcWJjFfEncIALJ7gjISRucEEcOHPggvgXEOLAFfFm1uvd9e/U+LDyznvve9/7Zva9+eZPFHcFuvEYl8uGKNmSFomxu350dJB7TEy5SVxTUEdygbzfQAzFjtGoVV93Jbp5nFHhS7XwpRQvOtwmdih6NYNGXFlhxC0QIiW6Ho0wXXcpWzevlp2S8FHrpFqhfvX3X7HPrE+/jiFUdoDdBJSS7BYVVDKYQTFqSTQOmU7xEsP2CdAQ1D4BvpfUWoph193HRfIUfYKGMijhYAFgEs31XrLG0PFlR6KLt3YfYJuwNyR6Ky8MmhekSIRhYUaNEjXcM8humNyWAGbwnEvEKZaU28ZB8P/hjuNoxIRE8SK3CJPo/vOD7SmEADGRE/wJERK90hZyE962IWZDewahY25JnJLKBuPmkwyuKJDVEMjTErYEPSErAZLDcD7YJB0Iyzo2XOUIwznCtHCwXWpnyjUAT03lNhzQCJWaUYGNMXpROU/WY66FYvxN9MOVy0zUfTLkfohzOWIpHhJdieQJLFGC455Om0RiylzwergjUfpcO+ghGNkmIJXiej3TDHeI0BF7BEMMoNvSz/jBuTLWkYxiAGUctMWPEhl1ClxyP/O9c2XWocaDACAK7X9Sy+r9SlRp33anblsIKJmMu2SjJCXkRBORnfNWleNrwSF08SkJDEsNVpuUZVvr8C0gvmPnOXz3M5EO5SWsWZ3mAF3V3RaGO75BoGsRROimRtBNg3Y3cIziogTLEl09bm7A74HJa71XG1qvAtTWf6cmfvvhj+/Tfr8dh9yTLV1D4wL6oCPU4ZFUpX7Ja7YlSdnSHnZWj9GwSxjMGj1LZlsQy9bMQA7yXVbhhgo3trFbAIj40O8//Tz10a8XUCwNnYJjK42V/w4algUBKnBmlZ37a5rRC2cX4TmmuEk0KGHPJJrSRzB84nS7KYMUsy2kqPPJDf/yz0T2uzVfjgGgN93WPZAk/j5KUJtRm+gBVJstLQfOqOOSksWDGdJqqqAWLc+pnZg1/dxsqv4CnPgCF/RjOPuYrTN6Yhf1ZJusZtWJTHHblRi+ZSOzlT58VtfqelUPHOOEyIOGlPMLyi3PFcrrVZucJdPwf36u0W9uURuMjYPM5mJy+e7Cs3JJkdzWEqp/u6hzQ+5WXBxa7IfYcRg1dfy6qZ5QcTWlPnnv1TCVhEB5BOv3HdV6UMLEtqkmxmQzwDukItGb1ba9Sx9KNRvBEe4RMBtdI7W+n9rKBPpd1iEmLxY1A2Aj0RCxcY4RuIm8XL3hyUvdDJxjAJ1vrU64d3VTI9FGjfFqFhpaJzEGVcdrL8XK+aTIrj/aCoQYCwvh5RmVnLND6hxqh1nt4NHRDuEvNCzau1Vfsy2LSrU4v5C8fTvpr8L9huYr0bVHgG15Sz0qHur+zyv4tCe4be1DgR11t7UC/5Pu+1tHh2109/JEdb/ZqHuNcDv5ez6zoQnZTcEYXGxz6jKovtlmdIku5WpXxRRnXKh+U8C2xUAPaEzQu/IU/Lz/YI/cK9uwa7q7duMI8yPBcIVDQejFty0scTJHbcXwXhP+gHqO9IKY48IiQtm/aI0y1RVFLX/eN8KXHRCm++bwat8Iiz2oOYL9uXbUAcnoicu3HRCW+0ZY6aGaQWp6d8u+6vix7zo6Iag6/gPJ1lFQVBAAAA==";
65      private static final Log log = LogFactory.getLog(ObservationUI.class);
66      private static final long serialVersionUID = 1L;
67  
68      /*-----------------------------------------------------------------------*/
69      /*--------------------------- Internal states ---------------------------*/
70      /*-----------------------------------------------------------------------*/
71  
72      protected List<Object> $activeBindings = new ArrayList<Object>();
73      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
74      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
75      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
76      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
77      private boolean allComponentsCreated;
78      protected final JAXXContext delegateContext = new DefaultJAXXContext();
79  
80      /*-----------------------------------------------------------------------*/
81      /*------------------------ Protected components  ------------------------*/
82      /*-----------------------------------------------------------------------*/
83  
84      protected DaliHelpBroker broker;
85      protected JButton closeButton;
86      protected final ObservationUIHandler handler = createHandler();
87      protected JPanel labelPanel;
88      protected ObservationUIModel model;
89      protected JButton nextButton;
90      protected JLabel observationDescriptionLabel;
91      protected JLabel observationLabel;
92      protected JTabbedPane observationTabbedPane;
93      protected OperationMeasurementsTabUI operationMeasurementsTabUI;
94      protected PhotosTabUI photosTabUI;
95      protected JButton saveButton;
96      protected ComponentBlockingLayerUI surveyBlockLayer;
97      protected SurveyDetailsTabUI surveyDetailsTabUI;
98  
99      /*-----------------------------------------------------------------------*/
100     /*------------------------- Private components  -------------------------*/
101     /*-----------------------------------------------------------------------*/
102 
103     private ObservationUI $JPanel0 = this;
104     private JPanel $JPanel1;
105     private JPanel $JPanel2;
106     private TabInfo $TabInfo0;
107     private TabInfo $TabInfo1;
108     private TabInfo $TabInfo2;
109 
110     /*-----------------------------------------------------------------------*/
111     /*---------------------- Raw body code from script ----------------------*/
112     /*-----------------------------------------------------------------------*/
113 
114     private int tabIndex;
115     
116     
117     		public int getTabIndex() {
118     		  return this.tabIndex;
119     		}
120     
121         public void setTabIndex(Integer tabIndex) {
122             this.tabIndex = tabIndex;
123         }
124 
125     /*-----------------------------------------------------------------------*/
126     /*---------------------------- Constructors  ----------------------------*/
127     /*-----------------------------------------------------------------------*/
128 
129     public ObservationUI(ApplicationUI parentUI, int tabIndex) {
130         ApplicationUIUtil.setParentUI(this, parentUI);
131         		    setTabIndex(tabIndex);
132             $initialize();
133     }
134 
135     public ObservationUI() {
136         $initialize();
137     }
138 
139     public ObservationUI(JAXXContext parentContext) {
140         JAXXUtil.initContext(this, parentContext);
141         $initialize();
142     }
143 
144     public ObservationUI(boolean param0) {
145         super(param0);
146         $initialize();
147     }
148 
149     public ObservationUI(JAXXContext parentContext, boolean param1) {
150         super(param1);
151         JAXXUtil.initContext(this, parentContext);
152         $initialize();
153     }
154 
155     public ObservationUI(LayoutManager param0) {
156         super(param0);
157         $initialize();
158     }
159 
160     public ObservationUI(JAXXContext parentContext, LayoutManager param1) {
161         super(param1);
162         JAXXUtil.initContext(this, parentContext);
163         $initialize();
164     }
165 
166     public ObservationUI(LayoutManager param0, boolean param1) {
167         super(param0 ,param1);
168         $initialize();
169     }
170 
171     public ObservationUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
172         super(param1 ,param2);
173         JAXXUtil.initContext(this, parentContext);
174         $initialize();
175     }
176 
177     /*-----------------------------------------------------------------------*/
178     /*--------------------------- Statics methods ---------------------------*/
179     /*-----------------------------------------------------------------------*/
180 
181     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
182         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
183     }
184 
185     /*-----------------------------------------------------------------------*/
186     /*---------------------- JAXXObject implementation ----------------------*/
187     /*-----------------------------------------------------------------------*/
188 
189     @Override
190     public void applyDataBinding(String $binding) {
191         if (allComponentsCreated && $bindings.containsKey($binding)) {
192             getDataBinding($binding).applyDataBinding();
193         }
194         processDataBinding($binding);
195     }
196 
197     @Override
198     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
199         super.firePropertyChange(propertyName, oldValue, newValue);
200     }
201 
202     @Override
203     public Map<String, Object> get$objectMap() {
204         return $objectMap;
205     }
206 
207     @Override
208     public JAXXBinding getDataBinding(String bindingId) {
209         return $bindings.get(bindingId);
210     }
211 
212     @Override
213     public JAXXBinding[] getDataBindings() {
214         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
215     }
216 
217     @Override
218     public Object getObjectById(String id) {
219         return $objectMap.get(id);
220     }
221 
222     @Override
223     public void processDataBinding(String $binding, boolean $force) {
224         if (!$force && $activeBindings.contains($binding)) { 
225             return;
226         }
227         $activeBindings.add($binding);
228         try {
229             if (allComponentsCreated && $bindings.containsKey($binding)) {
230                 getDataBinding($binding).processDataBinding();
231             }
232         } finally {
233             $activeBindings.remove($binding);
234         }
235     }
236 
237     @Override
238     public void processDataBinding(String $binding) {
239         processDataBinding($binding, false);
240     }
241 
242     @Override
243     public void registerDataBinding(JAXXBinding binding) {
244         $bindings.put(binding.getId(), binding);
245     }
246 
247     @Override
248     public void removeDataBinding(String $binding) {
249         if (allComponentsCreated && $bindings.containsKey($binding)) {
250             getDataBinding($binding).removeDataBinding();
251         }
252     }
253 
254     /*-----------------------------------------------------------------------*/
255     /*--------------------- JAXXContext implementation  ---------------------*/
256     /*-----------------------------------------------------------------------*/
257 
258     @Override
259     public <T> T getContextValue(Class<T> clazz) {
260         return delegateContext.getContextValue(clazz, null);
261     }
262 
263     @Override
264     public <T> T getContextValue(Class<T> clazz, String name) {
265         return delegateContext.getContextValue(clazz, name);
266     }
267 
268     @Override
269     public JAXXContext getDelegateContext() {
270         return delegateContext;
271     }
272 
273     @Override
274     public <O extends Container> O getParentContainer(Class<O> clazz) {
275         return SwingUtil.getParentContainer(this, clazz);
276     }
277 
278     @Override
279     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
280         return SwingUtil.getParentContainer(source, clazz);
281     }
282 
283     @Override
284     public <T> void removeContextValue(Class<T> clazz) {
285         delegateContext.removeContextValue(clazz, null);
286     }
287 
288     @Override
289     public <T> void removeContextValue(Class<T> clazz, String name) {
290         delegateContext.removeContextValue(clazz, name);
291     }
292 
293     @Override
294     public <T> void setContextValue(T o) {
295         delegateContext.setContextValue(o, null);
296     }
297 
298     @Override
299     public <T> void setContextValue(T o, String name) {
300         delegateContext.setContextValue(o, name);
301     }
302 
303     /*-----------------------------------------------------------------------*/
304     /*----------------------- Public acessor methods  -----------------------*/
305     /*-----------------------------------------------------------------------*/
306 
307     public DaliHelpBroker getBroker() {
308         return broker;
309     }
310 
311     public JButton getCloseButton() {
312         return closeButton;
313     }
314 
315     public ObservationUIHandler getHandler() {
316         return handler;
317     }
318 
319     public JPanel getLabelPanel() {
320         return labelPanel;
321     }
322 
323     public ObservationUIModel getModel() {
324         return model;
325     }
326 
327     public JButton getNextButton() {
328         return nextButton;
329     }
330 
331     public JLabel getObservationDescriptionLabel() {
332         return observationDescriptionLabel;
333     }
334 
335     public JLabel getObservationLabel() {
336         return observationLabel;
337     }
338 
339     public JTabbedPane getObservationTabbedPane() {
340         return observationTabbedPane;
341     }
342 
343     public OperationMeasurementsTabUI getOperationMeasurementsTabUI() {
344         return operationMeasurementsTabUI;
345     }
346 
347     public PhotosTabUI getPhotosTabUI() {
348         return photosTabUI;
349     }
350 
351     public JButton getSaveButton() {
352         return saveButton;
353     }
354 
355     public ComponentBlockingLayerUI getSurveyBlockLayer() {
356         return surveyBlockLayer;
357     }
358 
359     public SurveyDetailsTabUI getSurveyDetailsTabUI() {
360         return surveyDetailsTabUI;
361     }
362 
363     /*-----------------------------------------------------------------------*/
364     /*---------------------------- Other methods ----------------------------*/
365     /*-----------------------------------------------------------------------*/
366 
367     @Override
368     public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
369         broker.installUI(component, helpId);
370     }
371 
372     @Override
373     public void showHelp(String helpId) {
374         getBroker().showHelp(this, helpId);
375     }
376 
377     /*-----------------------------------------------------------------------*/
378     /*--------------------- Protected acessors methods  ---------------------*/
379     /*-----------------------------------------------------------------------*/
380 
381     protected JPanel get$JPanel1() {
382         return $JPanel1;
383     }
384 
385     protected JPanel get$JPanel2() {
386         return $JPanel2;
387     }
388 
389     protected TabInfo get$TabInfo0() {
390         return $TabInfo0;
391     }
392 
393     protected TabInfo get$TabInfo1() {
394         return $TabInfo1;
395     }
396 
397     protected TabInfo get$TabInfo2() {
398         return $TabInfo2;
399     }
400 
401     /*-----------------------------------------------------------------------*/
402     /*--------------------- Components creation methods ---------------------*/
403     /*-----------------------------------------------------------------------*/
404 
405     protected void addChildrenToLabelPanel() {
406         if (!allComponentsCreated) {
407             return;
408         }
409         labelPanel.add(observationLabel);
410         labelPanel.add(observationDescriptionLabel);
411     }
412 
413     protected void addChildrenToObservationTabbedPane() {
414         if (!allComponentsCreated) {
415             return;
416         }
417         observationTabbedPane.add(surveyDetailsTabUI);
418         observationTabbedPane.add(operationMeasurementsTabUI);
419         observationTabbedPane.add(photosTabUI);
420         $TabInfo0.addPropertyChangeListener(new TabInfoPropertyChangeListener(observationTabbedPane, 0));
421         $TabInfo1.addPropertyChangeListener(new TabInfoPropertyChangeListener(observationTabbedPane, 1));
422         $TabInfo2.addPropertyChangeListener(new TabInfoPropertyChangeListener(observationTabbedPane, 2));
423     }
424 
425     protected void createBroker() {
426         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
427     }
428 
429     protected void createCloseButton() {
430         $objectMap.put("closeButton", closeButton = new JButton());
431         
432         closeButton.setName("closeButton");
433         closeButton.setText(t("dali.common.close"));
434         closeButton.putClientProperty("applicationActionKey", fr.ifremer.dali.ui.swing.util.DaliKeyStrokes.CANCEL);
435         closeButton.putClientProperty("applicationAction", CloseAction.class);
436     }
437 
438     protected ObservationUIHandler createHandler() {
439         return new ObservationUIHandler();
440     }
441 
442     protected void createLabelPanel() {
443         $objectMap.put("labelPanel", labelPanel = new JPanel());
444         
445         labelPanel.setName("labelPanel");
446         labelPanel.setLayout(new BoxLayout(labelPanel, BoxLayout.LINE_AXIS));
447     }
448 
449     protected void createModel() {
450         $objectMap.put("model", model = getContextValue(ObservationUIModel.class));
451     }
452 
453     protected void createNextButton() {
454         $objectMap.put("nextButton", nextButton = new JButton());
455         
456         nextButton.setName("nextButton");
457         nextButton.setText(t("dali.common.next"));
458         nextButton.setToolTipText(t("dali.action.saveAndNext.observation"));
459         nextButton.putClientProperty("applicationActionKey", fr.ifremer.dali.ui.swing.util.DaliKeyStrokes.NEXT);
460         nextButton.putClientProperty("applicationAction", SaveAndNextAction.class);
461     }
462 
463     protected void createObservationDescriptionLabel() {
464         $objectMap.put("observationDescriptionLabel", observationDescriptionLabel = new JLabel());
465         
466         observationDescriptionLabel.setName("observationDescriptionLabel");
467     }
468 
469     protected void createObservationLabel() {
470         $objectMap.put("observationLabel", observationLabel = new JLabel());
471         
472         observationLabel.setName("observationLabel");
473         observationLabel.setText(t("dali.observation.label"));
474     }
475 
476     protected void createObservationTabbedPane() {
477         $objectMap.put("observationTabbedPane", observationTabbedPane = new JTabbedPane());
478         
479         observationTabbedPane.setName("observationTabbedPane");
480     }
481 
482     protected void createOperationMeasurementsTabUI() {
483         $objectMap.put("operationMeasurementsTabUI", operationMeasurementsTabUI = new OperationMeasurementsTabUI(this));
484         
485         operationMeasurementsTabUI.setName("operationMeasurementsTabUI");
486     }
487 
488     protected void createPhotosTabUI() {
489         $objectMap.put("photosTabUI", photosTabUI = new PhotosTabUI(this));
490         
491         photosTabUI.setName("photosTabUI");
492     }
493 
494     protected void createSaveButton() {
495         $objectMap.put("saveButton", saveButton = new JButton());
496         
497         saveButton.setName("saveButton");
498         saveButton.setText(t("dali.common.save"));
499         saveButton.setToolTipText(t("dali.action.save.observation"));
500         saveButton.putClientProperty("applicationActionKey", fr.ifremer.dali.ui.swing.util.DaliKeyStrokes.SAVE);
501         saveButton.putClientProperty("applicationAction", SaveAction.class);
502     }
503 
504     protected void createSurveyBlockLayer() {
505         $objectMap.put("surveyBlockLayer", surveyBlockLayer = new ComponentBlockingLayerUI());
506     }
507 
508     protected void createSurveyDetailsTabUI() {
509         $objectMap.put("surveyDetailsTabUI", surveyDetailsTabUI = new SurveyDetailsTabUI(this));
510         
511         surveyDetailsTabUI.setName("surveyDetailsTabUI");
512     }
513 
514     /*-----------------------------------------------------------------------*/
515     /*------------------------ Internal jaxx methods ------------------------*/
516     /*-----------------------------------------------------------------------*/
517 
518     private void $completeSetup() {
519         allComponentsCreated = true;
520         if (log.isDebugEnabled()) {
521             log.debug(this);
522         }
523         // inline complete setup of $JPanel0
524         add(labelPanel, BorderLayout.PAGE_START);
525         add(SwingUtil.boxComponentWithJxLayer(observationTabbedPane), BorderLayout.CENTER);
526         add($JPanel1, BorderLayout.PAGE_END);
527         addChildrenToLabelPanel();
528         addChildrenToObservationTabbedPane();
529         // inline complete setup of $JPanel1
530         $JPanel1.add($JPanel2, BorderLayout.CENTER);
531         // inline complete setup of $JPanel2
532         $JPanel2.add(closeButton);
533         $JPanel2.add(saveButton);
534         $JPanel2.add(nextButton);
535         
536         // apply 5 data bindings
537         JAXXUtil.applyDataBinding(this, $bindings.keySet());
538         
539         // apply 15 property setters
540         labelPanel.setBorder(new EmptyBorder(10,0,10,0));
541         observationLabel.setBorder(new EmptyBorder(0,5,0,5));
542         closeButton.setAlignmentX(Component.CENTER_ALIGNMENT);
543         saveButton.setAlignmentX(Component.CENTER_ALIGNMENT);
544         nextButton.setAlignmentX(Component.CENTER_ALIGNMENT);
545         surveyBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
546         observationDescriptionLabel.setHorizontalAlignment(SwingConstants.LEFT);
547         observationDescriptionLabel.setFont(new Font("ObservationLabel", Font.BOLD, 16));
548         closeButton.setIcon(SwingUtil.createActionIcon("cancel"));
549         saveButton.setIcon(SwingUtil.createActionIcon("save"));
550         nextButton.setIcon(SwingUtil.createActionIcon("next"));
551     }
552 
553     private void $initialize() {
554         if (allComponentsCreated) {
555             return;
556         }
557         if (log.isDebugEnabled()) {
558             log.debug(this);
559         }
560         handler.beforeInit(this);
561         $objectMap.put("$JPanel0", $JPanel0);
562         createModel();
563         createBroker();
564         createSurveyBlockLayer();
565         createLabelPanel();
566         createObservationLabel();
567         createObservationDescriptionLabel();
568         createObservationTabbedPane();
569         createSurveyDetailsTabUI();
570         createOperationMeasurementsTabUI();
571         createPhotosTabUI();
572         // inline creation of $JPanel1
573         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
574         
575         $JPanel1.setName("$JPanel1");
576         $JPanel1.setLayout(new BorderLayout());
577         // inline creation of $JPanel2
578         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
579         
580         $JPanel2.setName("$JPanel2");
581         $JPanel2.setLayout(new GridLayout(1,0));
582         createCloseButton();
583         createSaveButton();
584         createNextButton();
585         // inline creation of $TabInfo0
586         $objectMap.put("$TabInfo0", $TabInfo0 = new TabInfo());
587         // inline creation of $TabInfo1
588         $objectMap.put("$TabInfo1", $TabInfo1 = new TabInfo());
589         // inline creation of $TabInfo2
590         $objectMap.put("$TabInfo2", $TabInfo2 = new TabInfo());
591         // inline creation of $JPanel0
592         setName("$JPanel0");
593         setLayout(new BorderLayout());
594         
595         // registers 5 data bindings
596         $registerDefaultBindings();
597         $completeSetup();
598         handler.afterInit(this);
599     }
600 
601     private void $registerDefaultBindings() {
602         // register 5 data bindings
603         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SURVEY_BLOCK_LAYER_BLOCK, true) {
604         
605             @Override
606             public void applyDataBinding() {
607                 if (model != null) {
608                     model.addPropertyChangeListener("loading", this);
609                 }
610             }
611         
612             @Override
613             public void processDataBinding() {
614                 if (model != null) {
615                     surveyBlockLayer.setBlock(model.isLoading());
616                 }
617             }
618         
619             @Override
620             public void removeDataBinding() {
621                 if (model != null) {
622                     model.removePropertyChangeListener("loading", this);
623                 }
624             }
625         });
626         registerDataBinding(new DefaultJAXXBinding(this, BINDING_OBSERVATION_DESCRIPTION_LABEL_TEXT, true) {
627         
628             @Override
629             public void applyDataBinding() {
630                 if (model != null) {
631                     model.addPropertyChangeListener("observationLabel", this);
632                 }
633             }
634         
635             @Override
636             public void processDataBinding() {
637                 if (model != null) {
638                     observationDescriptionLabel.setText(t(model.getObservationLabel()));
639                 }
640             }
641         
642             @Override
643             public void removeDataBinding() {
644                 if (model != null) {
645                     model.removePropertyChangeListener("observationLabel", this);
646                 }
647             }
648         });
649         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CLOSE_BUTTON_ENABLED, true) {
650         
651             @Override
652             public void applyDataBinding() {
653                 if (model != null) {
654                     model.addPropertyChangeListener("loading", this);
655                 }
656             }
657         
658             @Override
659             public void processDataBinding() {
660                 if (model != null) {
661                     closeButton.setEnabled(!model.isLoading());
662                 }
663             }
664         
665             @Override
666             public void removeDataBinding() {
667                 if (model != null) {
668                     model.removePropertyChangeListener("loading", this);
669                 }
670             }
671         });
672         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_BUTTON_ENABLED, true, true) {
673         
674             @Override
675             public void applyDataBinding() {
676                 if (model != null) {
677                     model.addPropertyChangeListener("editable", this);
678                 }
679                 if (model != null) {
680                     model.addPropertyChangeListener("modify", this);
681                 }
682                 if (model != null) {
683                     model.addPropertyChangeListener("valid", this);
684                 }
685                 if (model != null) {
686                     model.addPropertyChangeListener("loading", this);
687                 }
688             }
689         
690             @Override
691             public void processDataBinding() {
692                 if (model != null) {
693                     saveButton.setEnabled(model.isEditable() && model.isModify() && model.isValid() && !model.isLoading());
694                 }
695             }
696         
697             @Override
698             public void removeDataBinding() {
699                 if (model != null) {
700                     model.removePropertyChangeListener("editable", this);
701                 }
702                 if (model != null) {
703                     model.removePropertyChangeListener("modify", this);
704                 }
705                 if (model != null) {
706                     model.removePropertyChangeListener("valid", this);
707                 }
708                 if (model != null) {
709                     model.removePropertyChangeListener("loading", this);
710                 }
711             }
712         });
713         registerDataBinding(new DefaultJAXXBinding(this, BINDING_NEXT_BUTTON_ENABLED, true) {
714         
715             @Override
716             public void applyDataBinding() {
717                 if (model != null) {
718                     model.addPropertyChangeListener("loading", this);
719                 }
720             }
721         
722             @Override
723             public void processDataBinding() {
724                 if (model != null) {
725                     nextButton.setEnabled(!model.isLoading());
726                 }
727             }
728         
729             @Override
730             public void removeDataBinding() {
731                 if (model != null) {
732                     model.removePropertyChangeListener("loading", this);
733                 }
734             }
735         });
736     }
737 
738 }