View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.program.locations;
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.plaf.WaitBlockingLayerUI;
30  import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
31  import fr.ifremer.reefdb.ui.swing.ReefDbHelpBroker;
32  import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
33  import fr.ifremer.reefdb.ui.swing.util.ReefDbUI;
34  import java.awt.BorderLayout;
35  import java.awt.Component;
36  import java.awt.Container;
37  import java.awt.FlowLayout;
38  import java.awt.GridBagConstraints;
39  import java.awt.Insets;
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.JCheckBox;
52  import javax.swing.JComboBox;
53  import javax.swing.JLabel;
54  import javax.swing.JPanel;
55  import javax.swing.JScrollPane;
56  import jaxx.runtime.JAXXBinding;
57  import jaxx.runtime.JAXXContext;
58  import jaxx.runtime.JAXXObject;
59  import jaxx.runtime.JAXXObjectDescriptor;
60  import jaxx.runtime.JAXXUtil;
61  import jaxx.runtime.SwingUtil;
62  import jaxx.runtime.binding.DefaultJAXXBinding;
63  import jaxx.runtime.context.DefaultJAXXContext;
64  import jaxx.runtime.swing.Table;
65  import jaxx.runtime.swing.help.JAXXHelpUI;
66  import org.apache.commons.logging.Log;
67  import org.apache.commons.logging.LogFactory;
68  import static org.nuiton.i18n.I18n.t;
69  
70  public class LocationsTableUI extends Table implements JAXXHelpUI<ReefDbHelpBroker>, ReefDbUI<LocationsTableUIModel, LocationsTableUIHandler>, JAXXObject {
71  
72      /*-----------------------------------------------------------------------*/
73      /*------------------ Constants for all public bindings ------------------*/
74      /*-----------------------------------------------------------------------*/
75  
76      public static final String BINDING_ADD_LOCATIONS_BUTTON_ENABLED = "addLocationsButton.enabled";
77      public static final String BINDING_EDIT_COMBOBOX_ENABLED = "editCombobox.enabled";
78      public static final String BINDING_LOCATIONS_TABLE_EDITABLE = "locationsTable.editable";
79      public static final String BINDING_REMOVE_LOCATIONS_BUTTON_ENABLED = "removeLocationsButton.enabled";
80      public static final String BINDING_SHOW_STRATEGIES_BUTTON_ENABLED = "showStrategiesButton.enabled";
81      public static final String BINDING_STRATEGY_FILTER_CHECKBOX_ENABLED = "strategyFilterCheckbox.enabled";
82      public static final String BINDING_TABLE_BLOCK_LAYER_BLOCK = "tableBlockLayer.block";
83      public static final String BINDING_UPDATE_PERIOD_BUTTON_ENABLED = "updatePeriodButton.enabled";
84  
85      /*-----------------------------------------------------------------------*/
86      /*------------------------- Other static fields -------------------------*/
87      /*-----------------------------------------------------------------------*/
88  
89      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVXy28bRRifuLHz6oPmRVFTmqRVaqt0XUBCoPBo4jZqIhdKHEREDjDrHduTjHe2M+PEVhTEn8CfABLcEBISN06IAwdOHHpB/AsIceCK+GbWXns360dw8WG1+833/b7n/Gb8zR8oKQVa2sf1uiVqrqJVYm2t7e6+Z++TorpPZFFQT3GB/N9IAiX20JQTyKVCN/by2jzbNM/meNXjLnE7rFfzaFKqBiOyQohS6FrYoihlthAsr9a9mmihBkHFoX7x15+Jz53PvkwgVPcguucglcV+Vu1MRvMoQR2FpsHTIc4y7JYhDEHdMsR7QctyDEv5Lq6SJ+hTNJZHKQ8LAFNoefCUDYaxr3sKTSpsM/IYu4QplC8Ji5YEqRJhCUJKjm3VqCWPIAKryF0FgFYVu7hMLE/wssBVi/EiVpS70sq33nY04gebnme8pBRKVrmj4d9/lvCPNGbbR8oW/IAIhW73cLIN3/fth2C3brTb5pdMGdbB3UEeNzTOax04T2rYEbRMXm1DeQyXrA8xVcYGJMasM2sfslAUnDFdX4We1y2sNwG22ivaYCKwu8hCmSpk9Y7EuLEK+t0YaJi5AG385pZp7l0Yq5B7Iw17bum+rL+v6cfVYG0aO07QgvWaUtAvNBNC9KVa/8XA7DxxqIJptLnN6wrNhQyMfJ3XwybTNc/BijwmgnKnjbkc1pqVFX4EmwM0y5TIrnpzUDd+SCKhxyjOSx+ssUGZIiJXIcWDuJi1/FTMrcq9ElM5WMtjO6YDRqqVsh7wxNUQTwADWW0GalPEyB5KihqIFbqyd5q0tmHJp6srEbrSgGb1n/mZpz/8/v1Gi6PmwfdcrGoHxQJ3wI70YF9Q7fqST1A1RVn2EfZW99CEJAz42fDvQkxgheYyBAf+LmtzS5tbD7GsAERy7Lcff5r/5NdzKLGBJhnHzgbW+ptoQlUEVIEzp+69c89EdP5oXJOrjk1vfC4cvWE3jtfNm2/YsIqCQD93qGLE8VfSKr3cpIQov1hK6y1nMid1KN5CTPGCDOyJn/+eKXx3r1XAEUjoha7q7SImP0Ip6jLqEkPzTQaPpfUpT5Kaw9tMHcfdKETeXpN43jDPt+IqNa73ok8ps8eGki0qHzRlaZ25Nl0zKem3HDpFRv28jEJMUH7Q39SEjs4BayiQkjqcUZebtS/yahUq7pIjhaYU52yHejtG43q37oAudAiOqzHi6jgANB2kkIdpIU46s7iysjhgWjFsdtbUUuCIKBJkNxvOrrUaTrDr+Pnq0RwPBsxRS5daYp845QMfJLRYJsqfS+Js8yOZzmiUqqcaXcoUT579KpUIanIrkm6LYjuOdaZJsDNnq2fO0eRiw+5C5QPE3bqpbB1XsOswOHBh8tZM11uHlbl3pE+fUS8txp1ImZPO3F6Pze0/Nid0tPbLLRmZ3lFtDKEdUkkNIyRLmMn2NHfdiZ7fgOhg3+ijH53s/TNM9v8w2DF3jH4V1DeTj7HnMepn5k8FnHbHhVDffblV1Ex9csaqd6UHGcBHC7/S3yRa+2c6hbH3sEF2mq3vzXCFDAUD96K03jIX7OatOscZh7P9TrAfIb4cd0sU9Px3WA9dwbvEGb3gD3BephhucMgHXXwThgUv2tTVAb59Cn5EPxf6ImrxV/rxdTzC9QFimsSMlt0q/FPa7YG0NFAs3/ZAuDk0wq2hETJDI9weGuHO0F29O0BXR2nR/08yVD9/GbobvRAG60YvBN2NfwEBQqd04BEAAA==";
90      private static final Log log = LogFactory.getLog(LocationsTableUI.class);
91      private static final long serialVersionUID = 1L;
92  
93      /*-----------------------------------------------------------------------*/
94      /*--------------------------- Internal states ---------------------------*/
95      /*-----------------------------------------------------------------------*/
96  
97      protected List<Object> $activeBindings = new ArrayList<Object>();
98      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
99      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
100     protected Map<String, Object> $objectMap = new HashMap<String, Object>();
101     protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
102     private boolean allComponentsCreated;
103     protected final JAXXContext delegateContext = new DefaultJAXXContext();
104 
105     /*-----------------------------------------------------------------------*/
106     /*------------------------ Protected components  ------------------------*/
107     /*-----------------------------------------------------------------------*/
108 
109     protected JButton addLocationsButton;
110     protected ReefDbHelpBroker broker;
111     protected JComboBox editCombobox;
112     protected final LocationsTableUIHandler handler = createHandler();
113     protected SwingTable locationsTable;
114     protected LocationsTableUIModel model;
115     protected JButton removeLocationsButton;
116     protected JButton showStrategiesButton;
117     protected JCheckBox strategyFilterCheckbox;
118     protected WaitBlockingLayerUI tableBlockLayer;
119     protected LocationsTableUI tablePanel = this;
120     protected JScrollPane tableScrollPane;
121     protected JButton updatePeriodButton;
122 
123     /*-----------------------------------------------------------------------*/
124     /*------------------------- Private components  -------------------------*/
125     /*-----------------------------------------------------------------------*/
126 
127     private JLabel $JLabel0;
128     private JPanel $JPanel0;
129     private JPanel $JPanel1;
130     private JPanel $JPanel2;
131 
132     /*-----------------------------------------------------------------------*/
133     /*---------------------------- Constructors  ----------------------------*/
134     /*-----------------------------------------------------------------------*/
135 
136     public LocationsTableUI(ApplicationUI parentUI) {
137         ApplicationUIUtil.setParentUI(this, parentUI);
138             $initialize();
139     }
140 
141     public LocationsTableUI() {
142         $initialize();
143     }
144 
145     public LocationsTableUI(JAXXContext parentContext) {
146         JAXXUtil.initContext(this, parentContext);
147         $initialize();
148     }
149 
150     /*-----------------------------------------------------------------------*/
151     /*--------------------------- Statics methods ---------------------------*/
152     /*-----------------------------------------------------------------------*/
153 
154     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
155         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
156     }
157 
158     /*-----------------------------------------------------------------------*/
159     /*---------------------- JAXXObject implementation ----------------------*/
160     /*-----------------------------------------------------------------------*/
161 
162     @Override
163     public void applyDataBinding(String $binding) {
164         if (allComponentsCreated && $bindings.containsKey($binding)) {
165             getDataBinding($binding).applyDataBinding();
166         }
167         processDataBinding($binding);
168     }
169 
170     @Override
171     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
172         super.firePropertyChange(propertyName, oldValue, newValue);
173     }
174 
175     @Override
176     public Map<String, Object> get$objectMap() {
177         return $objectMap;
178     }
179 
180     @Override
181     public JAXXBinding getDataBinding(String bindingId) {
182         return $bindings.get(bindingId);
183     }
184 
185     @Override
186     public JAXXBinding[] getDataBindings() {
187         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
188     }
189 
190     @Override
191     public Object getObjectById(String id) {
192         return $objectMap.get(id);
193     }
194 
195     @Override
196     public void processDataBinding(String $binding, boolean $force) {
197         if (!$force && $activeBindings.contains($binding)) { 
198             return;
199         }
200         $activeBindings.add($binding);
201         try {
202             if (allComponentsCreated && $bindings.containsKey($binding)) {
203                 getDataBinding($binding).processDataBinding();
204             }
205         } finally {
206             $activeBindings.remove($binding);
207         }
208     }
209 
210     @Override
211     public void processDataBinding(String $binding) {
212         processDataBinding($binding, false);
213     }
214 
215     @Override
216     public void registerDataBinding(JAXXBinding binding) {
217         $bindings.put(binding.getId(), binding);
218     }
219 
220     @Override
221     public void removeDataBinding(String $binding) {
222         if (allComponentsCreated && $bindings.containsKey($binding)) {
223             getDataBinding($binding).removeDataBinding();
224         }
225     }
226 
227     /*-----------------------------------------------------------------------*/
228     /*--------------------- JAXXContext implementation  ---------------------*/
229     /*-----------------------------------------------------------------------*/
230 
231     @Override
232     public <T> T getContextValue(Class<T> clazz) {
233         return delegateContext.getContextValue(clazz, null);
234     }
235 
236     @Override
237     public <T> T getContextValue(Class<T> clazz, String name) {
238         return delegateContext.getContextValue(clazz, name);
239     }
240 
241     @Override
242     public JAXXContext getDelegateContext() {
243         return delegateContext;
244     }
245 
246     @Override
247     public <O extends Container> O getParentContainer(Class<O> clazz) {
248         return SwingUtil.getParentContainer(this, clazz);
249     }
250 
251     @Override
252     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
253         return SwingUtil.getParentContainer(source, clazz);
254     }
255 
256     @Override
257     public <T> void removeContextValue(Class<T> clazz) {
258         delegateContext.removeContextValue(clazz, null);
259     }
260 
261     @Override
262     public <T> void removeContextValue(Class<T> clazz, String name) {
263         delegateContext.removeContextValue(clazz, name);
264     }
265 
266     @Override
267     public <T> void setContextValue(T o) {
268         delegateContext.setContextValue(o, null);
269     }
270 
271     @Override
272     public <T> void setContextValue(T o, String name) {
273         delegateContext.setContextValue(o, name);
274     }
275 
276     /*-----------------------------------------------------------------------*/
277     /*---------------------------- Event methods ----------------------------*/
278     /*-----------------------------------------------------------------------*/
279 
280     public void doActionPerformed__on__addLocationsButton(ActionEvent event) {
281         if (log.isDebugEnabled()) {
282             log.debug(event);
283         }
284         handler.addLocations();
285     }
286 
287     public void doActionPerformed__on__removeLocationsButton(ActionEvent event) {
288         if (log.isDebugEnabled()) {
289             log.debug(event);
290         }
291         handler.removeLocations();
292     }
293 
294     public void doActionPerformed__on__updatePeriodButton(ActionEvent event) {
295         if (log.isDebugEnabled()) {
296             log.debug(event);
297         }
298         handler.updatePeriod();
299     }
300 
301     /*-----------------------------------------------------------------------*/
302     /*----------------------- Public acessor methods  -----------------------*/
303     /*-----------------------------------------------------------------------*/
304 
305     public JButton getAddLocationsButton() {
306         return addLocationsButton;
307     }
308 
309     public ReefDbHelpBroker getBroker() {
310         return broker;
311     }
312 
313     public JComboBox getEditCombobox() {
314         return editCombobox;
315     }
316 
317     public LocationsTableUIHandler getHandler() {
318         return handler;
319     }
320 
321     public SwingTable getLocationsTable() {
322         return locationsTable;
323     }
324 
325     public LocationsTableUIModel getModel() {
326         return model;
327     }
328 
329     public JButton getRemoveLocationsButton() {
330         return removeLocationsButton;
331     }
332 
333     public JButton getShowStrategiesButton() {
334         return showStrategiesButton;
335     }
336 
337     public JCheckBox getStrategyFilterCheckbox() {
338         return strategyFilterCheckbox;
339     }
340 
341     public WaitBlockingLayerUI getTableBlockLayer() {
342         return tableBlockLayer;
343     }
344 
345     public JScrollPane getTableScrollPane() {
346         return tableScrollPane;
347     }
348 
349     public JButton getUpdatePeriodButton() {
350         return updatePeriodButton;
351     }
352 
353     /*-----------------------------------------------------------------------*/
354     /*---------------------------- Other methods ----------------------------*/
355     /*-----------------------------------------------------------------------*/
356 
357     @Override
358     public void registerHelpId(ReefDbHelpBroker broker, Component component, String helpId) {
359         broker.installUI(component, helpId);
360     }
361 
362     @Override
363     public void showHelp(String helpId) {
364         getBroker().showHelp(this, helpId);
365     }
366 
367     /*-----------------------------------------------------------------------*/
368     /*--------------------- Protected acessors methods  ---------------------*/
369     /*-----------------------------------------------------------------------*/
370 
371     protected JLabel get$JLabel0() {
372         return $JLabel0;
373     }
374 
375     protected JPanel get$JPanel0() {
376         return $JPanel0;
377     }
378 
379     protected JPanel get$JPanel1() {
380         return $JPanel1;
381     }
382 
383     protected JPanel get$JPanel2() {
384         return $JPanel2;
385     }
386 
387     /*-----------------------------------------------------------------------*/
388     /*--------------------- Components creation methods ---------------------*/
389     /*-----------------------------------------------------------------------*/
390 
391     protected void addChildrenToTablePanel() {
392         if (!allComponentsCreated) {
393             return;
394         }
395         add(SwingUtil.boxComponentWithJxLayer(tableScrollPane), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
396         add($JPanel0, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
397     }
398 
399     protected void addChildrenToTableScrollPane() {
400         if (!allComponentsCreated) {
401             return;
402         }
403         tableScrollPane.getViewport().add(locationsTable);
404     }
405 
406     protected void createAddLocationsButton() {
407         $objectMap.put("addLocationsButton", addLocationsButton = new JButton());
408         
409         addLocationsButton.setName("addLocationsButton");
410         addLocationsButton.setText(t("reefdb.common.new"));
411         addLocationsButton.setToolTipText(t("reefdb.program.location.new.tip"));
412         addLocationsButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__addLocationsButton"));
413     }
414 
415     protected void createBroker() {
416         $objectMap.put("broker", broker = new ReefDbHelpBroker("reefdb.home.help"));
417     }
418 
419     protected void createEditCombobox() {
420         $objectMap.put("editCombobox", editCombobox = new JComboBox());
421         
422         editCombobox.setName("editCombobox");
423     }
424 
425     protected LocationsTableUIHandler createHandler() {
426         return new LocationsTableUIHandler();
427     }
428 
429     protected void createLocationsTable() {
430         $objectMap.put("locationsTable", locationsTable = new SwingTable());
431         
432         locationsTable.setName("locationsTable");
433     }
434 
435     protected void createModel() {
436         $objectMap.put("model", model = getContextValue(LocationsTableUIModel.class));
437     }
438 
439     protected void createRemoveLocationsButton() {
440         $objectMap.put("removeLocationsButton", removeLocationsButton = new JButton());
441         
442         removeLocationsButton.setName("removeLocationsButton");
443         removeLocationsButton.setText(t("reefdb.common.delete"));
444         removeLocationsButton.setToolTipText(t("reefdb.program.location.delete.tip"));
445         removeLocationsButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__removeLocationsButton"));
446     }
447 
448     protected void createShowStrategiesButton() {
449         $objectMap.put("showStrategiesButton", showStrategiesButton = new JButton());
450         
451         showStrategiesButton.setName("showStrategiesButton");
452         showStrategiesButton.setVisible(false);
453         showStrategiesButton.setText(t("reefdb.program.location.strategies"));
454         showStrategiesButton.setToolTipText(t("reefdb.program.location.strategies.tip"));
455         showStrategiesButton.putClientProperty("applicationAction", ShowStrategiesAction.class);
456     }
457 
458     protected void createStrategyFilterCheckbox() {
459         $objectMap.put("strategyFilterCheckbox", strategyFilterCheckbox = new JCheckBox());
460         
461         strategyFilterCheckbox.setName("strategyFilterCheckbox");
462         strategyFilterCheckbox.setText(t("reefdb.program.strategy.locations.label"));
463     }
464 
465     protected void createTableBlockLayer() {
466         $objectMap.put("tableBlockLayer", tableBlockLayer = new WaitBlockingLayerUI());
467     }
468 
469     protected void createTableScrollPane() {
470         $objectMap.put("tableScrollPane", tableScrollPane = new JScrollPane());
471         
472         tableScrollPane.setName("tableScrollPane");
473     }
474 
475     protected void createUpdatePeriodButton() {
476         $objectMap.put("updatePeriodButton", updatePeriodButton = new JButton());
477         
478         updatePeriodButton.setName("updatePeriodButton");
479         updatePeriodButton.setVisible(false);
480         updatePeriodButton.setText(t("reefdb.program.location.periods"));
481         updatePeriodButton.setToolTipText(t("reefdb.program.location.periods.tip"));
482         updatePeriodButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__updatePeriodButton"));
483     }
484 
485     /*-----------------------------------------------------------------------*/
486     /*------------------------ Internal jaxx methods ------------------------*/
487     /*-----------------------------------------------------------------------*/
488 
489     private void $completeSetup() {
490         allComponentsCreated = true;
491         if (log.isDebugEnabled()) {
492             log.debug(this);
493         }
494         addChildrenToTablePanel();
495         addChildrenToTableScrollPane();
496         // inline complete setup of $JPanel0
497         $JPanel0.add($JPanel1, BorderLayout.LINE_START);
498         $JPanel0.add($JPanel2, BorderLayout.CENTER);
499         // inline complete setup of $JPanel1
500         $JPanel1.add(addLocationsButton);
501         $JPanel1.add(editCombobox);
502         $JPanel1.add(updatePeriodButton);
503         $JPanel1.add(showStrategiesButton);
504         $JPanel1.add(removeLocationsButton);
505         $JPanel1.add(strategyFilterCheckbox);
506         // inline complete setup of $JPanel2
507         $JPanel2.add($JLabel0);
508         
509         // apply 8 data bindings
510         JAXXUtil.applyDataBinding(this, $bindings.keySet());
511         
512         // apply 16 property setters
513         addLocationsButton.setAlignmentX(Component.CENTER_ALIGNMENT);
514         editCombobox.setAlignmentX(Component.CENTER_ALIGNMENT);
515         updatePeriodButton.setAlignmentX(Component.CENTER_ALIGNMENT);
516         showStrategiesButton.setAlignmentX(Component.CENTER_ALIGNMENT);
517         removeLocationsButton.setAlignmentX(Component.CENTER_ALIGNMENT);
518         strategyFilterCheckbox.setAlignmentX(Component.CENTER_ALIGNMENT);
519         setBorder(BorderFactory.createTitledBorder(t("reefdb.program.location.title")));
520         tableBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
521         addLocationsButton.setIcon(SwingUtil.createActionIcon("add"));
522         editCombobox.setModel(handler.newActionComboBoxModel(updatePeriodButton, showStrategiesButton));
523         updatePeriodButton.setIcon(SwingUtil.createActionIcon("edit"));
524         showStrategiesButton.setIcon(SwingUtil.createActionIcon("edit"));
525         removeLocationsButton.setIcon(SwingUtil.createActionIcon("delete"));
526     }
527 
528     private void $initialize() {
529         if (allComponentsCreated) {
530             return;
531         }
532         if (log.isDebugEnabled()) {
533             log.debug(this);
534         }
535         handler.beforeInit(this);
536         $objectMap.put("tablePanel", tablePanel);
537         createModel();
538         createBroker();
539         createTableBlockLayer();
540         createTableScrollPane();
541         createLocationsTable();
542         // inline creation of $JPanel0
543         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
544         
545         $JPanel0.setName("$JPanel0");
546         $JPanel0.setLayout(new BorderLayout());
547         // inline creation of $JPanel1
548         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
549         
550         $JPanel1.setName("$JPanel1");
551         $JPanel1.setLayout(new FlowLayout());
552         createAddLocationsButton();
553         createEditCombobox();
554         createUpdatePeriodButton();
555         createShowStrategiesButton();
556         createRemoveLocationsButton();
557         createStrategyFilterCheckbox();
558         // inline creation of $JPanel2
559         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
560         
561         $JPanel2.setName("$JPanel2");
562         $JPanel2.setLayout(new FlowLayout());
563         // inline creation of $JLabel0
564         $objectMap.put("$JLabel0", $JLabel0 = new JLabel());
565         
566         $JLabel0.setName("$JLabel0");
567         // inline creation of tablePanel
568         setName("tablePanel");
569         
570         // registers 8 data bindings
571         $registerDefaultBindings();
572         $completeSetup();
573         handler.afterInit(this);
574     }
575 
576     private void $registerDefaultBindings() {
577         // register 8 data bindings
578         registerDataBinding(new DefaultJAXXBinding(this, BINDING_TABLE_BLOCK_LAYER_BLOCK, true) {
579         
580             @Override
581             public void applyDataBinding() {
582                 if (model != null) {
583                     model.addPropertyChangeListener("loading", this);
584                 }
585             }
586         
587             @Override
588             public void processDataBinding() {
589                 if (model != null) {
590                     tableBlockLayer.setBlock(model.isLoading());
591                 }
592             }
593         
594             @Override
595             public void removeDataBinding() {
596                 if (model != null) {
597                     model.removePropertyChangeListener("loading", this);
598                 }
599             }
600         });
601         registerDataBinding(new DefaultJAXXBinding(this, BINDING_LOCATIONS_TABLE_EDITABLE, true) {
602         
603             @Override
604             public void applyDataBinding() {
605                 if (model != null) {
606                     model.addPropertyChangeListener("editable", this);
607                 }
608             }
609         
610             @Override
611             public void processDataBinding() {
612                 if (model != null) {
613                     locationsTable.setEditable(model.isEditable());
614                 }
615             }
616         
617             @Override
618             public void removeDataBinding() {
619                 if (model != null) {
620                     model.removePropertyChangeListener("editable", this);
621                 }
622             }
623         });
624         registerDataBinding(new DefaultJAXXBinding(this, BINDING_ADD_LOCATIONS_BUTTON_ENABLED, true, true) {
625         
626             @Override
627             public void applyDataBinding() {
628                 if (model != null) {
629                     model.addPropertyChangeListener("loaded", this);
630                 }
631                 if (model != null) {
632                     model.addPropertyChangeListener("editable", this);
633                 }
634             }
635         
636             @Override
637             public void processDataBinding() {
638                 if (model != null) {
639                     addLocationsButton.setEnabled(model.isLoaded() && model.isEditable());
640                 }
641             }
642         
643             @Override
644             public void removeDataBinding() {
645                 if (model != null) {
646                     model.removePropertyChangeListener("loaded", this);
647                 }
648                 if (model != null) {
649                     model.removePropertyChangeListener("editable", this);
650                 }
651             }
652         });
653         registerDataBinding(new DefaultJAXXBinding(this, BINDING_EDIT_COMBOBOX_ENABLED, true, true) {
654         
655             @Override
656             public void applyDataBinding() {
657                 if (model != null) {
658                     model.addPropertyChangeListener("loaded", this);
659                 }
660                 if (model != null) {
661                     model.addPropertyChangeListener("selectedRows", this);
662                 }
663             }
664         
665             @Override
666             public void processDataBinding() {
667                 if (model != null && model.getSelectedRows() != null) {
668                     editCombobox.setEnabled(model.isLoaded() && !model.getSelectedRows().isEmpty());
669                 }
670             }
671         
672             @Override
673             public void removeDataBinding() {
674                 if (model != null) {
675                     model.removePropertyChangeListener("loaded", this);
676                 }
677                 if (model != null) {
678                     model.removePropertyChangeListener("selectedRows", this);
679                 }
680             }
681         });
682         registerDataBinding(new DefaultJAXXBinding(this, BINDING_UPDATE_PERIOD_BUTTON_ENABLED, true, true) {
683         
684             @Override
685             public void applyDataBinding() {
686                 if (model != null) {
687                     model.addPropertyChangeListener("loaded", this);
688                 }
689                 if (model != null) {
690                     model.addPropertyChangeListener("editable", this);
691                 }
692                 if (model != null) {
693                     model.addPropertyChangeListener("periodsEnabled", this);
694                 }
695                 if (model != null) {
696                     model.addPropertyChangeListener("selectedRows", this);
697                 }
698             }
699         
700             @Override
701             public void processDataBinding() {
702                 if (model != null && model.getSelectedRows() != null) {
703                     updatePeriodButton.setEnabled(model.isLoaded() && model.isEditable() && model.isPeriodsEnabled() && !model.getSelectedRows().isEmpty());
704                 }
705             }
706         
707             @Override
708             public void removeDataBinding() {
709                 if (model != null) {
710                     model.removePropertyChangeListener("loaded", this);
711                 }
712                 if (model != null) {
713                     model.removePropertyChangeListener("editable", this);
714                 }
715                 if (model != null) {
716                     model.removePropertyChangeListener("periodsEnabled", this);
717                 }
718                 if (model != null) {
719                     model.removePropertyChangeListener("selectedRows", this);
720                 }
721             }
722         });
723         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SHOW_STRATEGIES_BUTTON_ENABLED, true, true) {
724         
725             @Override
726             public void applyDataBinding() {
727                 if (model != null) {
728                     model.addPropertyChangeListener("loaded", this);
729                 }
730                 if (model != null) {
731                     model.addPropertyChangeListener("selectedRows", this);
732                 }
733             }
734         
735             @Override
736             public void processDataBinding() {
737                 if (model != null && model.getSelectedRows() != null) {
738                     showStrategiesButton.setEnabled(model.isLoaded() && !model.getSelectedRows().isEmpty());
739                 }
740             }
741         
742             @Override
743             public void removeDataBinding() {
744                 if (model != null) {
745                     model.removePropertyChangeListener("loaded", this);
746                 }
747                 if (model != null) {
748                     model.removePropertyChangeListener("selectedRows", this);
749                 }
750             }
751         });
752         registerDataBinding(new DefaultJAXXBinding(this, BINDING_REMOVE_LOCATIONS_BUTTON_ENABLED, true, true) {
753         
754             @Override
755             public void applyDataBinding() {
756                 if (model != null) {
757                     model.addPropertyChangeListener("loaded", this);
758                 }
759                 if (model != null) {
760                     model.addPropertyChangeListener("editable", this);
761                 }
762                 if (model != null) {
763                     model.addPropertyChangeListener("periodsEnabled", this);
764                 }
765                 if (model != null) {
766                     model.addPropertyChangeListener("selectedRows", this);
767                 }
768             }
769         
770             @Override
771             public void processDataBinding() {
772                 if (model != null && model.getSelectedRows() != null) {
773                     removeLocationsButton.setEnabled(model.isLoaded() && model.isEditable() && !model.isPeriodsEnabled() && !model.getSelectedRows().isEmpty());
774                 }
775             }
776         
777             @Override
778             public void removeDataBinding() {
779                 if (model != null) {
780                     model.removePropertyChangeListener("loaded", this);
781                 }
782                 if (model != null) {
783                     model.removePropertyChangeListener("editable", this);
784                 }
785                 if (model != null) {
786                     model.removePropertyChangeListener("periodsEnabled", this);
787                 }
788                 if (model != null) {
789                     model.removePropertyChangeListener("selectedRows", this);
790                 }
791             }
792         });
793         registerDataBinding(new DefaultJAXXBinding(this, BINDING_STRATEGY_FILTER_CHECKBOX_ENABLED, true, true) {
794         
795             @Override
796             public void applyDataBinding() {
797                 if (model != null) {
798                     model.addPropertyChangeListener("loaded", this);
799                 }
800                 if (model != null) {
801                     model.addPropertyChangeListener("periodsEnabled", this);
802                 }
803             }
804         
805             @Override
806             public void processDataBinding() {
807                 if (model != null) {
808                     strategyFilterCheckbox.setEnabled(model.isLoaded() && model.isPeriodsEnabled());
809                 }
810             }
811         
812             @Override
813             public void removeDataBinding() {
814                 if (model != null) {
815                     model.removePropertyChangeListener("loaded", this);
816                 }
817                 if (model != null) {
818                     model.removePropertyChangeListener("periodsEnabled", this);
819                 }
820             }
821         });
822     }
823 
824 }