View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.observation.survey.measurement.grouped;
2   
3   /*-
4    * #%L
5    * Reef DB :: UI
6    * $Id:$
7    * $HeadURL:$
8    * %%
9    * Copyright (C) 2014 - 2022 Ifremer
10   * %%
11   * This program is free software: you can redistribute it and/or modify
12   * it under the terms of the GNU Affero General Public License as published by
13   * the Free Software Foundation, either version 3 of the License, or
14   * (at your option) any later version.
15   * 
16   * This program is distributed in the hope that it will be useful,
17   * but WITHOUT ANY WARRANTY; without even the implied warranty of
18   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19   * GNU General Public License for more details.
20   * 
21   * You should have received a copy of the GNU Affero General Public License
22   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
23   * #L%
24   */
25  
26  
27  import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
28  import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
29  import fr.ifremer.quadrige3.ui.swing.component.ToggleButton;
30  import fr.ifremer.quadrige3.ui.swing.plaf.WaitBlockingLayerUI;
31  import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
32  import fr.ifremer.reefdb.ui.swing.ReefDbHelpBroker;
33  import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
34  import fr.ifremer.reefdb.ui.swing.util.ReefDbUI;
35  import java.awt.BorderLayout;
36  import java.awt.Component;
37  import java.awt.Container;
38  import java.awt.FlowLayout;
39  import java.awt.LayoutManager;
40  import java.awt.event.ActionEvent;
41  import java.awt.event.ActionListener;
42  import java.util.ArrayList;
43  import java.util.HashMap;
44  import java.util.List;
45  import java.util.Map;
46  import java.util.TreeMap;
47  import javax.swing.BorderFactory;
48  import javax.swing.Box;
49  import javax.swing.BoxLayout;
50  import javax.swing.JButton;
51  import javax.swing.JPanel;
52  import javax.swing.JScrollPane;
53  import jaxx.runtime.JAXXBinding;
54  import jaxx.runtime.JAXXContext;
55  import jaxx.runtime.JAXXObject;
56  import jaxx.runtime.JAXXObjectDescriptor;
57  import jaxx.runtime.JAXXUtil;
58  import jaxx.runtime.SwingUtil;
59  import jaxx.runtime.binding.DefaultJAXXBinding;
60  import jaxx.runtime.context.DefaultJAXXContext;
61  import jaxx.runtime.swing.help.JAXXHelpUI;
62  import org.apache.commons.logging.Log;
63  import org.apache.commons.logging.LogFactory;
64  import static org.nuiton.i18n.I18n.t;
65  
66  public class SurveyMeasurementsGroupedTableUI extends JPanel implements JAXXHelpUI<ReefDbHelpBroker>, ReefDbUI<SurveyMeasurementsGroupedTableUIModel, SurveyMeasurementsGroupedTableUIHandler>, JAXXObject {
67  
68      /*-----------------------------------------------------------------------*/
69      /*------------------ Constants for all public bindings ------------------*/
70      /*-----------------------------------------------------------------------*/
71  
72      public static final String BINDING_DELETE_BUTTON_ENABLED = "deleteButton.enabled";
73      public static final String BINDING_DUPLICATE_BUTTON_ENABLED = "duplicateButton.enabled";
74      public static final String BINDING_MULTI_EDIT_BUTTON_ENABLED = "multiEditButton.enabled";
75      public static final String BINDING_NEW_BUTTON_ENABLED = "newButton.enabled";
76      public static final String BINDING_TABLE_BLOCK_LAYER_BLOCK = "tableBlockLayer.block";
77  
78      /*-----------------------------------------------------------------------*/
79      /*------------------------- Other static fields -------------------------*/
80      /*-----------------------------------------------------------------------*/
81  
82      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAMVWz28bRRSeuHHSOC2hTZOmIgEnLcGhZULLDwmFNM1PmspJo8QRgRzC2Dt2Jh3vbHdnExsriL8AcYA7nOGCxA0uiANnDlwQ/wJCHLgi3uysd722YycxgkhZjee9981738x8b77+HcUdG40fkFIJ264pWZHiR/M7O4+zBzQnl6iTs5klhY30X1cMxXZRvxHMOxLd3E2r8Gk/fHpRFC1hUrMmeiaNEo4sc+rsUyolGotG5Bxneiswz5Qs166iBkk1Q/3izz9inxoffxlDqGRBdgNQSrJdVFhJdxrFmCHRVVjpkExzYhYgDZuZBcj3sppb5MRx1kmRPkUfod406rGIDWASTZy+ZA/Diy9ZEg1IkuWUuAvE2SAm5RId5G3M8jYtUhvblOaNLHYZdo4gDZwTpgRULLIOtQ+JZMLEjmsf0jIuUgIjiAJzwRauRQ285ZnWQovzjrZk1KLbq5blJdIjUbwoDLW4+O8WX1Mrhhn0ZG3xhNoS3W6Rwib8Xso+hLgFzzsM1zwucJF7kiZlhfNmDc5Tlxg2K9DXQiiLkzx+lzDpxcCMF1bLycVbj7wteRVOhNr8kh+pZ5VTX+B7LdzGrZwtOFc+El2PxIUWFTUUBI9pFn16ahjzmJIIt67EWxpvqbEXoFBHAvDhugO24EopTM96PVpDtd67ge35wNZn0iMdKdFgpCg9q9yS4WYYrsVZjkgaWm/VuRRdLtmyAfyf5HIJzgdtAVHN916TfIfzLufAN6VmRhQKnFaTf701l7nqxcW1YQr0tgVi8lxETECmcChToY507aK47cK0RCO7jcq2CSataSN1mqYAPevfw4O/fPfbtytVIRuCtYeautboMAiMZQsLzj5TSw9oFXMl49NrxJrZRX0OEJrTIj3aJLEt3wzJwXpXVDhW4fghcfYBIt776w8/Dn/w8wUUW0EJLoixQpT/KuqT+zawILhRsuYeeBldOroI32fhP6Yut7ANdSknKwveSAeWMewQnJIMk5wa2pKamJg6liixZ6m9zZQtYHasoi/+9ipeXlrNrD5e39uYX19O72Xe21g+LgGTo02YDMrJ9v301+DWNw+qbHZBdTdOdA8Zjb+PepjJmUm9xuBrftNG0G851DVEqO3N1B41yr3ly80b3vetBu7gKPdL7yQaq0p/0Z2Kd9G31bZo8uZzSomVNTXhmivBufdorAZnaAm61IsVmZrwNVWrxiGjR7ghKkECTPgRXiUQwiqeEDzDLA071R4WS2Z50N3SCxltdK9dBtKuwU+2clbIJVexN+dtrRrNoxMVoB3h3XXVXyCGEWR9xU8EVKIIzQ80sT7VKd+jRV+EKJWzRL3UVAUB/FzFa7+4QKXumqkpzBwljsohNZWcnEyOBy4bxXzR0R5FS4LvcbP6Q8U+a8k9WneDqq9Fq65ao4XfaV+4DqyvnZ6pdn1JqbEpjiIUnIehSH85K0ndOWGVA4rG/Oq1Bw7aH+Ykq55VUa5eOsm7lrU6mj7512hKneTlsA8V0Oxs8u65+Kzv+memlEI1AaVXo6dO26I8pnyXZocteF78f0Ten03eOx+RdW+jdkRCg41n1SsW3mZ+dcxJQ3uGRpFSons5679xFwUX0IVfqewT0+DwBIKcFoWZZ+Cnx2CPPIhPSrHuud0uxS6QFU7KAupBz7xtEEmSWWaqBO83wHepb6Itopr+TH0+b44wfJqc9LukBcqNjvN4oWOE8VNUkiCcFUx1BXZaIN08VS5ftUCY7Bgh1THCy6fgo5vl9Lu9Iya+75iJVginY6IVQnsm2iFgQPgHNL+d8fURAAA=";
83      private static final Log log = LogFactory.getLog(SurveyMeasurementsGroupedTableUI.class);
84      private static final long serialVersionUID = 1L;
85  
86      /*-----------------------------------------------------------------------*/
87      /*--------------------------- Internal states ---------------------------*/
88      /*-----------------------------------------------------------------------*/
89  
90      protected List<Object> $activeBindings = new ArrayList<Object>();
91      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
92      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
93      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
94      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
95      private boolean allComponentsCreated;
96      protected final JAXXContext delegateContext = new DefaultJAXXContext();
97  
98      /*-----------------------------------------------------------------------*/
99      /*------------------------ Protected components  ------------------------*/
100     /*-----------------------------------------------------------------------*/
101 
102     protected ReefDbHelpBroker broker;
103     protected JButton deleteButton;
104     protected JButton duplicateButton;
105     protected ToggleButton fullScreenToggleButton;
106     protected final SurveyMeasurementsGroupedTableUIHandler handler = createHandler();
107     protected SurveyMeasurementsGroupedTableUIModel model;
108     protected JButton multiEditButton;
109     protected JButton newButton;
110     protected SwingTable surveyGroupedMeasurementTable;
111     protected WaitBlockingLayerUI tableBlockLayer;
112     protected SurveyMeasurementsGroupedTableUI tableauBasPanel = this;
113     protected JPanel tableauBasPanelButtons;
114     protected JScrollPane tableauBasScrollPane;
115 
116     /*-----------------------------------------------------------------------*/
117     /*------------------------- Private components  -------------------------*/
118     /*-----------------------------------------------------------------------*/
119 
120     private JPanel $JPanel0;
121     private JPanel $JPanel1;
122     private JPanel $JPanel2;
123 
124     /*-----------------------------------------------------------------------*/
125     /*---------------------------- Constructors  ----------------------------*/
126     /*-----------------------------------------------------------------------*/
127 
128     public SurveyMeasurementsGroupedTableUI(ApplicationUI parentUI) {
129         ApplicationUIUtil.setParentUI(this, parentUI);
130             $initialize();
131     }
132 
133     public SurveyMeasurementsGroupedTableUI(LayoutManager param0, boolean param1) {
134         super(param0 ,param1);
135         $initialize();
136     }
137 
138     public SurveyMeasurementsGroupedTableUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
139         super(param1 ,param2);
140         JAXXUtil.initContext(this, parentContext);
141         $initialize();
142     }
143 
144     public SurveyMeasurementsGroupedTableUI(boolean param0) {
145         super(param0);
146         $initialize();
147     }
148 
149     public SurveyMeasurementsGroupedTableUI(JAXXContext parentContext, boolean param1) {
150         super(param1);
151         JAXXUtil.initContext(this, parentContext);
152         $initialize();
153     }
154 
155     public SurveyMeasurementsGroupedTableUI() {
156         $initialize();
157     }
158 
159     public SurveyMeasurementsGroupedTableUI(JAXXContext parentContext) {
160         JAXXUtil.initContext(this, parentContext);
161         $initialize();
162     }
163 
164     public SurveyMeasurementsGroupedTableUI(LayoutManager param0) {
165         super(param0);
166         $initialize();
167     }
168 
169     public SurveyMeasurementsGroupedTableUI(JAXXContext parentContext, LayoutManager param1) {
170         super(param1);
171         JAXXUtil.initContext(this, parentContext);
172         $initialize();
173     }
174 
175     /*-----------------------------------------------------------------------*/
176     /*--------------------------- Statics methods ---------------------------*/
177     /*-----------------------------------------------------------------------*/
178 
179     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
180         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
181     }
182 
183     /*-----------------------------------------------------------------------*/
184     /*---------------------- JAXXObject implementation ----------------------*/
185     /*-----------------------------------------------------------------------*/
186 
187     @Override
188     public void applyDataBinding(String $binding) {
189         if (allComponentsCreated && $bindings.containsKey($binding)) {
190             getDataBinding($binding).applyDataBinding();
191         }
192         processDataBinding($binding);
193     }
194 
195     @Override
196     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
197         super.firePropertyChange(propertyName, oldValue, newValue);
198     }
199 
200     @Override
201     public Map<String, Object> get$objectMap() {
202         return $objectMap;
203     }
204 
205     @Override
206     public JAXXBinding getDataBinding(String bindingId) {
207         return $bindings.get(bindingId);
208     }
209 
210     @Override
211     public JAXXBinding[] getDataBindings() {
212         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
213     }
214 
215     @Override
216     public Object getObjectById(String id) {
217         return $objectMap.get(id);
218     }
219 
220     @Override
221     public void processDataBinding(String $binding, boolean $force) {
222         if (!$force && $activeBindings.contains($binding)) { 
223             return;
224         }
225         $activeBindings.add($binding);
226         try {
227             if (allComponentsCreated && $bindings.containsKey($binding)) {
228                 getDataBinding($binding).processDataBinding();
229             }
230         } finally {
231             $activeBindings.remove($binding);
232         }
233     }
234 
235     @Override
236     public void processDataBinding(String $binding) {
237         processDataBinding($binding, false);
238     }
239 
240     @Override
241     public void registerDataBinding(JAXXBinding binding) {
242         $bindings.put(binding.getId(), binding);
243     }
244 
245     @Override
246     public void removeDataBinding(String $binding) {
247         if (allComponentsCreated && $bindings.containsKey($binding)) {
248             getDataBinding($binding).removeDataBinding();
249         }
250     }
251 
252     /*-----------------------------------------------------------------------*/
253     /*--------------------- JAXXContext implementation  ---------------------*/
254     /*-----------------------------------------------------------------------*/
255 
256     @Override
257     public <T> T getContextValue(Class<T> clazz) {
258         return delegateContext.getContextValue(clazz, null);
259     }
260 
261     @Override
262     public <T> T getContextValue(Class<T> clazz, String name) {
263         return delegateContext.getContextValue(clazz, name);
264     }
265 
266     @Override
267     public JAXXContext getDelegateContext() {
268         return delegateContext;
269     }
270 
271     @Override
272     public <O extends Container> O getParentContainer(Class<O> clazz) {
273         return SwingUtil.getParentContainer(this, clazz);
274     }
275 
276     @Override
277     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
278         return SwingUtil.getParentContainer(source, clazz);
279     }
280 
281     @Override
282     public <T> void removeContextValue(Class<T> clazz) {
283         delegateContext.removeContextValue(clazz, null);
284     }
285 
286     @Override
287     public <T> void removeContextValue(Class<T> clazz, String name) {
288         delegateContext.removeContextValue(clazz, name);
289     }
290 
291     @Override
292     public <T> void setContextValue(T o) {
293         delegateContext.setContextValue(o, null);
294     }
295 
296     @Override
297     public <T> void setContextValue(T o, String name) {
298         delegateContext.setContextValue(o, name);
299     }
300 
301     /*-----------------------------------------------------------------------*/
302     /*---------------------------- Event methods ----------------------------*/
303     /*-----------------------------------------------------------------------*/
304 
305     public void doActionPerformed__on__deleteButton(ActionEvent event) {
306         if (log.isDebugEnabled()) {
307             log.debug(event);
308         }
309         handler.removeIndividualMeasurements();
310     }
311 
312     public void doActionPerformed__on__duplicateButton(ActionEvent event) {
313         if (log.isDebugEnabled()) {
314             log.debug(event);
315         }
316         handler.duplicateSelectedRow();
317     }
318 
319     public void doActionPerformed__on__fullScreenToggleButton(ActionEvent event) {
320         if (log.isDebugEnabled()) {
321             log.debug(event);
322         }
323         handler.toggleFullScreen(tableauBasPanel, fullScreenToggleButton);
324     }
325 
326     public void doActionPerformed__on__multiEditButton(ActionEvent event) {
327         if (log.isDebugEnabled()) {
328             log.debug(event);
329         }
330         handler.editSelectedMeasurements();
331     }
332 
333     public void doActionPerformed__on__newButton(ActionEvent event) {
334         if (log.isDebugEnabled()) {
335             log.debug(event);
336         }
337         model.insertNewRowAfterSelected();
338     }
339 
340     /*-----------------------------------------------------------------------*/
341     /*----------------------- Public acessor methods  -----------------------*/
342     /*-----------------------------------------------------------------------*/
343 
344     public ReefDbHelpBroker getBroker() {
345         return broker;
346     }
347 
348     public JButton getDeleteButton() {
349         return deleteButton;
350     }
351 
352     public JButton getDuplicateButton() {
353         return duplicateButton;
354     }
355 
356     public ToggleButton getFullScreenToggleButton() {
357         return fullScreenToggleButton;
358     }
359 
360     public SurveyMeasurementsGroupedTableUIHandler getHandler() {
361         return handler;
362     }
363 
364     public SurveyMeasurementsGroupedTableUIModel getModel() {
365         return model;
366     }
367 
368     public JButton getMultiEditButton() {
369         return multiEditButton;
370     }
371 
372     public JButton getNewButton() {
373         return newButton;
374     }
375 
376     public SwingTable getSurveyGroupedMeasurementTable() {
377         return surveyGroupedMeasurementTable;
378     }
379 
380     public WaitBlockingLayerUI getTableBlockLayer() {
381         return tableBlockLayer;
382     }
383 
384     public JPanel getTableauBasPanelButtons() {
385         return tableauBasPanelButtons;
386     }
387 
388     public JScrollPane getTableauBasScrollPane() {
389         return tableauBasScrollPane;
390     }
391 
392     /*-----------------------------------------------------------------------*/
393     /*---------------------------- Other methods ----------------------------*/
394     /*-----------------------------------------------------------------------*/
395 
396     @Override
397     public void registerHelpId(ReefDbHelpBroker broker, Component component, String helpId) {
398         broker.installUI(component, helpId);
399     }
400 
401     @Override
402     public void showHelp(String helpId) {
403         getBroker().showHelp(this, helpId);
404     }
405 
406     /*-----------------------------------------------------------------------*/
407     /*--------------------- Protected acessors methods  ---------------------*/
408     /*-----------------------------------------------------------------------*/
409 
410     protected JPanel get$JPanel0() {
411         return $JPanel0;
412     }
413 
414     protected JPanel get$JPanel1() {
415         return $JPanel1;
416     }
417 
418     protected JPanel get$JPanel2() {
419         return $JPanel2;
420     }
421 
422     /*-----------------------------------------------------------------------*/
423     /*--------------------- Components creation methods ---------------------*/
424     /*-----------------------------------------------------------------------*/
425 
426     protected void addChildrenToTableauBasPanel() {
427         if (!allComponentsCreated) {
428             return;
429         }
430         add($JPanel0);
431         add(tableauBasPanelButtons, BorderLayout.PAGE_END);
432     }
433 
434     protected void addChildrenToTableauBasPanelButtons() {
435         if (!allComponentsCreated) {
436             return;
437         }
438         tableauBasPanelButtons.add($JPanel1, BorderLayout.LINE_START);
439         tableauBasPanelButtons.add($JPanel2, BorderLayout.LINE_END);
440     }
441 
442     protected void addChildrenToTableauBasScrollPane() {
443         if (!allComponentsCreated) {
444             return;
445         }
446         tableauBasScrollPane.getViewport().add(surveyGroupedMeasurementTable);
447     }
448 
449     protected void createBroker() {
450         $objectMap.put("broker", broker = new ReefDbHelpBroker("reefdb.home.help"));
451     }
452 
453     protected void createDeleteButton() {
454         $objectMap.put("deleteButton", deleteButton = new JButton());
455         
456         deleteButton.setName("deleteButton");
457         deleteButton.setText(t("reefdb.common.delete"));
458         deleteButton.setToolTipText(t("reefdb.survey.measurement.grouped.delete.tip"));
459         deleteButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__deleteButton"));
460     }
461 
462     protected void createDuplicateButton() {
463         $objectMap.put("duplicateButton", duplicateButton = new JButton());
464         
465         duplicateButton.setName("duplicateButton");
466         duplicateButton.setText(t("reefdb.action.duplicate.label"));
467         duplicateButton.setToolTipText(t("reefdb.action.duplicate.measurement.tip"));
468         duplicateButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__duplicateButton"));
469     }
470 
471     protected void createFullScreenToggleButton() {
472         $objectMap.put("fullScreenToggleButton", fullScreenToggleButton = new ToggleButton());
473         
474         fullScreenToggleButton.setName("fullScreenToggleButton");
475         fullScreenToggleButton.setText(t("reefdb.table.view.fullScreen"));
476         fullScreenToggleButton.setToolTipText(t("reefdb.table.view.fullScreen.tip"));
477         fullScreenToggleButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__fullScreenToggleButton"));
478     }
479 
480     protected SurveyMeasurementsGroupedTableUIHandler createHandler() {
481         return new SurveyMeasurementsGroupedTableUIHandler();
482     }
483 
484     protected void createModel() {
485         $objectMap.put("model", model = getContextValue(SurveyMeasurementsGroupedTableUIModel.class));
486     }
487 
488     protected void createMultiEditButton() {
489         $objectMap.put("multiEditButton", multiEditButton = new JButton());
490         
491         multiEditButton.setName("multiEditButton");
492         multiEditButton.setText(t("reefdb.common.edit"));
493         multiEditButton.setToolTipText(t("reefdb.measurement.grouped.multiEdit.tip"));
494         multiEditButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__multiEditButton"));
495     }
496 
497     protected void createNewButton() {
498         $objectMap.put("newButton", newButton = new JButton());
499         
500         newButton.setName("newButton");
501         newButton.setText(t("reefdb.common.new"));
502         newButton.setToolTipText(t("reefdb.survey.measurement.grouped.new.tip"));
503         newButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__newButton"));
504     }
505 
506     protected void createSurveyGroupedMeasurementTable() {
507         $objectMap.put("surveyGroupedMeasurementTable", surveyGroupedMeasurementTable = new SwingTable());
508         
509         surveyGroupedMeasurementTable.setName("surveyGroupedMeasurementTable");
510     }
511 
512     protected void createTableBlockLayer() {
513         $objectMap.put("tableBlockLayer", tableBlockLayer = new WaitBlockingLayerUI());
514     }
515 
516     protected void createTableauBasPanelButtons() {
517         $objectMap.put("tableauBasPanelButtons", tableauBasPanelButtons = new JPanel());
518         
519         tableauBasPanelButtons.setName("tableauBasPanelButtons");
520         tableauBasPanelButtons.setLayout(new BorderLayout());
521     }
522 
523     protected void createTableauBasScrollPane() {
524         $objectMap.put("tableauBasScrollPane", tableauBasScrollPane = new JScrollPane());
525         
526         tableauBasScrollPane.setName("tableauBasScrollPane");
527     }
528 
529     /*-----------------------------------------------------------------------*/
530     /*------------------------ Internal jaxx methods ------------------------*/
531     /*-----------------------------------------------------------------------*/
532 
533     private void $completeSetup() {
534         allComponentsCreated = true;
535         if (log.isDebugEnabled()) {
536             log.debug(this);
537         }
538         addChildrenToTableauBasPanel();
539         // inline complete setup of $JPanel0
540         $JPanel0.add(SwingUtil.boxComponentWithJxLayer(tableauBasScrollPane));
541         addChildrenToTableauBasScrollPane();
542         addChildrenToTableauBasPanelButtons();
543         // inline complete setup of $JPanel1
544         $JPanel1.add(newButton);
545         $JPanel1.add(duplicateButton);
546         $JPanel1.add(multiEditButton);
547         $JPanel1.add(deleteButton);
548         // inline complete setup of $JPanel2
549         $JPanel2.add(fullScreenToggleButton);
550         
551         // apply 5 data bindings
552         JAXXUtil.applyDataBinding(this, $bindings.keySet());
553         
554         // apply 19 property setters
555         tableauBasScrollPane.setBorder(null);
556         newButton.setAlignmentX(Component.CENTER_ALIGNMENT);
557         duplicateButton.setAlignmentX(Component.CENTER_ALIGNMENT);
558         multiEditButton.setAlignmentX(Component.CENTER_ALIGNMENT);
559         deleteButton.setAlignmentX(Component.CENTER_ALIGNMENT);
560         setBorder(BorderFactory.createTitledBorder(""));
561         tableBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
562         newButton.setIcon(SwingUtil.createActionIcon("add"));
563         duplicateButton.setIcon(SwingUtil.createActionIcon("copy"));
564         multiEditButton.setIcon(SwingUtil.createActionIcon("edit"));
565         deleteButton.setIcon(SwingUtil.createActionIcon("delete"));
566         fullScreenToggleButton.setToggledIcon(SwingUtil.createActionIcon("unFullScreen"));
567         fullScreenToggleButton.setToggledText(t("reefdb.table.view.unFullScreen"));
568         fullScreenToggleButton.setIcon(SwingUtil.createActionIcon("fullScreen"));
569         fullScreenToggleButton.setToggledToolTipText(t("reefdb.table.view.unFullScreen.tip"));
570     }
571 
572     private void $initialize() {
573         if (allComponentsCreated) {
574             return;
575         }
576         if (log.isDebugEnabled()) {
577             log.debug(this);
578         }
579         handler.beforeInit(this);
580         $objectMap.put("tableauBasPanel", tableauBasPanel);
581         createModel();
582         createBroker();
583         createTableBlockLayer();
584         // inline creation of $JPanel0
585         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
586         
587         $JPanel0.setName("$JPanel0");
588         $JPanel0.setLayout(new BorderLayout());
589         createTableauBasScrollPane();
590         createSurveyGroupedMeasurementTable();
591         createTableauBasPanelButtons();
592         // inline creation of $JPanel1
593         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
594         
595         $JPanel1.setName("$JPanel1");
596         $JPanel1.setLayout(new FlowLayout());
597         createNewButton();
598         createDuplicateButton();
599         createMultiEditButton();
600         createDeleteButton();
601         // inline creation of $JPanel2
602         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
603         
604         $JPanel2.setName("$JPanel2");
605         createFullScreenToggleButton();
606         // inline creation of tableauBasPanel
607         setName("tableauBasPanel");
608         setLayout(new BorderLayout());
609         tableauBasPanel.putClientProperty("panelType", ReefDbUI.EDITION_PANEL_TYPE);
610         
611         // registers 5 data bindings
612         $registerDefaultBindings();
613         $completeSetup();
614         handler.afterInit(this);
615     }
616 
617     private void $registerDefaultBindings() {
618         // register 5 data bindings
619         registerDataBinding(new DefaultJAXXBinding(this, BINDING_TABLE_BLOCK_LAYER_BLOCK, true) {
620         
621             @Override
622             public void applyDataBinding() {
623                 if (model != null) {
624                     model.addPropertyChangeListener("loading", this);
625                 }
626             }
627         
628             @Override
629             public void processDataBinding() {
630                 if (model != null) {
631                     tableBlockLayer.setBlock(model.isLoading());
632                 }
633             }
634         
635             @Override
636             public void removeDataBinding() {
637                 if (model != null) {
638                     model.removePropertyChangeListener("loading", this);
639                 }
640             }
641         });
642         registerDataBinding(new DefaultJAXXBinding(this, BINDING_NEW_BUTTON_ENABLED, true, true) {
643         
644             @Override
645             public void applyDataBinding() {
646                 if (model != null) {
647                     model.addPropertyChangeListener("survey", this);
648                 }
649                 if (model != null) {
650                     model.addPropertyChangeListener("pmfms", this);
651                 }
652             }
653         
654             @Override
655             public void processDataBinding() {
656                 if (model != null && model.getPmfms() != null && model.getSurvey() != null) {
657                     newButton.setEnabled(model.getSurvey().isEditable() && !model.getPmfms().isEmpty());
658                 }
659             }
660         
661             @Override
662             public void removeDataBinding() {
663                 if (model != null) {
664                     model.removePropertyChangeListener("survey", this);
665                 }
666                 if (model != null) {
667                     model.removePropertyChangeListener("pmfms", this);
668                 }
669             }
670         });
671         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DUPLICATE_BUTTON_ENABLED, true, true) {
672         
673             @Override
674             public void applyDataBinding() {
675                 if (model != null) {
676                     model.addPropertyChangeListener("survey", this);
677                 }
678                 if (model != null) {
679                     model.addPropertyChangeListener("selectedRows", this);
680                 }
681                 if (model != null) {
682                     model.addPropertyChangeListener("pmfms", this);
683                 }
684             }
685         
686             @Override
687             public void processDataBinding() {
688                 if (model != null && model.getPmfms() != null && model.getSurvey() != null && model.getSelectedRows() != null) {
689                     duplicateButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() == 1) && !model.getPmfms().isEmpty());
690                 }
691             }
692         
693             @Override
694             public void removeDataBinding() {
695                 if (model != null) {
696                     model.removePropertyChangeListener("survey", this);
697                 }
698                 if (model != null) {
699                     model.removePropertyChangeListener("selectedRows", this);
700                 }
701                 if (model != null) {
702                     model.removePropertyChangeListener("pmfms", this);
703                 }
704             }
705         });
706         registerDataBinding(new DefaultJAXXBinding(this, BINDING_MULTI_EDIT_BUTTON_ENABLED, true, true) {
707         
708             @Override
709             public void applyDataBinding() {
710                 if (model != null) {
711                     model.addPropertyChangeListener("survey", this);
712                 }
713                 if (model != null) {
714                     model.addPropertyChangeListener("selectedRows", this);
715                 }
716                 if (model != null) {
717                     model.addPropertyChangeListener("pmfms", this);
718                 }
719             }
720         
721             @Override
722             public void processDataBinding() {
723                 if (model != null && model.getPmfms() != null && model.getSurvey() != null && model.getSelectedRows() != null) {
724                     multiEditButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() >= 2) && !model.getPmfms().isEmpty());
725                 }
726             }
727         
728             @Override
729             public void removeDataBinding() {
730                 if (model != null) {
731                     model.removePropertyChangeListener("survey", this);
732                 }
733                 if (model != null) {
734                     model.removePropertyChangeListener("selectedRows", this);
735                 }
736                 if (model != null) {
737                     model.removePropertyChangeListener("pmfms", this);
738                 }
739             }
740         });
741         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_BUTTON_ENABLED, true, true) {
742         
743             @Override
744             public void applyDataBinding() {
745                 if (model != null) {
746                     model.addPropertyChangeListener("survey", this);
747                 }
748                 if (model != null) {
749                     model.addPropertyChangeListener("selectedRows", this);
750                 }
751                 if (model != null) {
752                     model.addPropertyChangeListener("pmfms", this);
753                 }
754             }
755         
756             @Override
757             public void processDataBinding() {
758                 if (model != null && model.getPmfms() != null && model.getSurvey() != null && model.getSelectedRows() != null) {
759                     deleteButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && !model.getPmfms().isEmpty());
760                 }
761             }
762         
763             @Override
764             public void removeDataBinding() {
765                 if (model != null) {
766                     model.removePropertyChangeListener("survey", this);
767                 }
768                 if (model != null) {
769                     model.removePropertyChangeListener("selectedRows", this);
770                 }
771                 if (model != null) {
772                     model.removePropertyChangeListener("pmfms", this);
773                 }
774             }
775         });
776     }
777 
778 }