View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.samplingequipment.local;
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.table.SwingTable;
30  import fr.ifremer.reefdb.ui.swing.ReefDbHelpBroker;
31  import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
32  import fr.ifremer.reefdb.ui.swing.content.manage.referential.samplingequipment.menu.SamplingEquipmentsMenuUI;
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.LayoutManager;
39  import java.awt.event.ActionEvent;
40  import java.awt.event.ActionListener;
41  import java.util.ArrayList;
42  import java.util.HashMap;
43  import java.util.List;
44  import java.util.Map;
45  import java.util.TreeMap;
46  import javax.swing.Box;
47  import javax.swing.BoxLayout;
48  import javax.swing.JButton;
49  import javax.swing.JPanel;
50  import javax.swing.JScrollPane;
51  import jaxx.runtime.JAXXBinding;
52  import jaxx.runtime.JAXXContext;
53  import jaxx.runtime.JAXXObject;
54  import jaxx.runtime.JAXXObjectDescriptor;
55  import jaxx.runtime.JAXXUtil;
56  import jaxx.runtime.SwingUtil;
57  import jaxx.runtime.binding.DefaultJAXXBinding;
58  import jaxx.runtime.context.DefaultJAXXContext;
59  import org.apache.commons.logging.Log;
60  import org.apache.commons.logging.LogFactory;
61  import static org.nuiton.i18n.I18n.t;
62  
63  public class SamplingEquipmentsLocalUI extends JPanel implements ReefDbUI<SamplingEquipmentsLocalUIModel, SamplingEquipmentsLocalUIHandler>, JAXXObject {
64  
65      /*-----------------------------------------------------------------------*/
66      /*------------------ Constants for all public bindings ------------------*/
67      /*-----------------------------------------------------------------------*/
68  
69      public static final String BINDING_REFERENTIAL_SAMPLING_EQUIPMENTS_LOCAL_TABLE_DELETE_BOUTON_ENABLED = "referentialSamplingEquipmentsLocalTableDeleteBouton.enabled";
70      public static final String BINDING_REFERENTIAL_SAMPLING_EQUIPMENTS_LOCAL_TABLE_REPLACE_BOUTON_ENABLED = "referentialSamplingEquipmentsLocalTableReplaceBouton.enabled";
71  
72      /*-----------------------------------------------------------------------*/
73      /*------------------------- Other static fields -------------------------*/
74      /*-----------------------------------------------------------------------*/
75  
76      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAL1Vz28bRRR+duKkcVKghKRBtJCUFBJA61blgAiFNk2jJnJaFKdShMWP8e7EmXZ2ZzIz22yIivgT+BPgzgWJGyfEgTMHLoh/ASEOXBFvdu3dbLNO3ARhySP7zXvf+943O99++wdUtIKZBySKHBUGhvnUWb25uXmv9YC6ZolqVzFphILkUypDuQmjXhrXBl5t1m15rVNeuyV8KQIaHKheqENVmz1O9TalxsDFfIWrda2Rbi9EMlRd1JRUEerXf/1Z/sr78psyQCSR3SiOMn1cVTbJYB3KzDPwPHZ6RGqcBG2koVjQRr5nbewWJ1rfJT7dgS9guA5DkigEM3Cp/5FjjLg+kgbOzK5+SALKrxhobymHbSnqU+UoSre8lhMyR+9if8cVgUE4xycBaVPc3qK2MSPc0cSXHHPoTsikb5O4cDHe6MRvd+O6buP3V6SM2w8ZqPjCo9wA/586r9l2WfuhlhIPqTLw5hH91/H/UusO1i3G2Vn5RV3cZ40G4f0VA/S/mgqXsGCopI8lM5Jy6h7nVXyK7AMTdfol0Xzu2dnVhqsE53YPz/98riDbsukTadXrB7j2EHqDtDg14ByYfycknmJtei2TwNgsp2F/xwUWfyptM9YKjRGBTnmfz9N4u08ad0X4iJJwUYSIZmA8N+Ni3MMivpwCX+sTeInijDTBtaWX8jD98lunkhO3AEfBSznnQE9yMk/KTKPUhIoKMWxgqnnYxtZxKzGwqScMzALGu/9Mjv/6w+/fL3ddawx7TxSmHjBddBOphMTbw2zrZxPLCg3jtTUiF5owolEgN3HkCwXEGp1tJIf9ztlyx5Y7d4jeRojK8G8//jT52S8DUF6GKhfEWyY2fwVGzLZCFQT3IvnBjZjR2O4ZXJ/D74CBKuYxEazYOwYDxENHHTQ0Qpc817mGrvB9ETgB3TUwaoTgG0xu9MiIULoLBdKl/FsjP/893vjuRle+Eo7zYs/0TMLKRzDEAnwuaGz7HUcvtPlRqWnoicy5i7wcTngpZMfR3orXK4cUraCVfEokgrnE6nozVtfAG/v3JA06z++hbkmW41qCj584k2GVFKXnMpFXPd3On02vrGEa2KHwmC/vxy8Up01Nojf11sWunpt3NPuczs1PX78+ffVxFNpB34mPyv569ymUy13Xkyp3eT8xj6cSbciLa1LNXsir0d3NS9YjKVNsdn+ml2RM3/al2ZubLxTsJDZ5nF4lnJKTPcw18Mx7HjFkusUCD5HfP0ShZNfqsYg2/LFdPilGmDw1wit9TFUlnLUDq8zmEUgzfXF5eATC7KkRXutjmkHmJq+qU80RnXqOoxDsHP8C0udsVkwMAAA=";
77      private static final Log log = LogFactory.getLog(SamplingEquipmentsLocalUI.class);
78      private static final long serialVersionUID = 1L;
79  
80      /*-----------------------------------------------------------------------*/
81      /*--------------------------- Internal states ---------------------------*/
82      /*-----------------------------------------------------------------------*/
83  
84      protected List<Object> $activeBindings = new ArrayList<Object>();
85      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
86      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
87      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
88      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
89      private boolean allComponentsCreated;
90      protected final JAXXContext delegateContext = new DefaultJAXXContext();
91  
92      /*-----------------------------------------------------------------------*/
93      /*------------------------ Protected components  ------------------------*/
94      /*-----------------------------------------------------------------------*/
95  
96      protected ReefDbHelpBroker broker;
97      protected JPanel buttonsPanel;
98      protected final SamplingEquipmentsLocalUIHandler handler = createHandler();
99      protected SamplingEquipmentsLocalUIModel model;
100     protected SwingTable referentialSamplingEquipmentsLocalTable;
101     protected JButton referentialSamplingEquipmentsLocalTableDeleteBouton;
102     protected JButton referentialSamplingEquipmentsLocalTableNouveauBouton;
103     protected JButton referentialSamplingEquipmentsLocalTableReplaceBouton;
104     protected SamplingEquipmentsMenuUI samplingEquipmentsLocalMenuUI;
105 
106     /*-----------------------------------------------------------------------*/
107     /*------------------------- Private components  -------------------------*/
108     /*-----------------------------------------------------------------------*/
109 
110     private SamplingEquipmentsLocalUI $JPanel0 = this;
111     private JPanel $JPanel1;
112     private JScrollPane $JScrollPane0;
113 
114     /*-----------------------------------------------------------------------*/
115     /*---------------------------- Constructors  ----------------------------*/
116     /*-----------------------------------------------------------------------*/
117 
118     public SamplingEquipmentsLocalUI(ApplicationUI parentUI) {
119         ApplicationUIUtil.setParentUI(this, parentUI);
120             $initialize();
121     }
122 
123     public SamplingEquipmentsLocalUI(LayoutManager param0, boolean param1) {
124         super(param0 ,param1);
125         $initialize();
126     }
127 
128     public SamplingEquipmentsLocalUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
129         super(param1 ,param2);
130         JAXXUtil.initContext(this, parentContext);
131         $initialize();
132     }
133 
134     public SamplingEquipmentsLocalUI(boolean param0) {
135         super(param0);
136         $initialize();
137     }
138 
139     public SamplingEquipmentsLocalUI(JAXXContext parentContext, boolean param1) {
140         super(param1);
141         JAXXUtil.initContext(this, parentContext);
142         $initialize();
143     }
144 
145     public SamplingEquipmentsLocalUI() {
146         $initialize();
147     }
148 
149     public SamplingEquipmentsLocalUI(JAXXContext parentContext) {
150         JAXXUtil.initContext(this, parentContext);
151         $initialize();
152     }
153 
154     public SamplingEquipmentsLocalUI(LayoutManager param0) {
155         super(param0);
156         $initialize();
157     }
158 
159     public SamplingEquipmentsLocalUI(JAXXContext parentContext, LayoutManager param1) {
160         super(param1);
161         JAXXUtil.initContext(this, parentContext);
162         $initialize();
163     }
164 
165     /*-----------------------------------------------------------------------*/
166     /*--------------------------- Statics methods ---------------------------*/
167     /*-----------------------------------------------------------------------*/
168 
169     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
170         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
171     }
172 
173     /*-----------------------------------------------------------------------*/
174     /*---------------------- JAXXObject implementation ----------------------*/
175     /*-----------------------------------------------------------------------*/
176 
177     @Override
178     public void applyDataBinding(String $binding) {
179         if (allComponentsCreated && $bindings.containsKey($binding)) {
180             getDataBinding($binding).applyDataBinding();
181         }
182         processDataBinding($binding);
183     }
184 
185     @Override
186     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
187         super.firePropertyChange(propertyName, oldValue, newValue);
188     }
189 
190     @Override
191     public Map<String, Object> get$objectMap() {
192         return $objectMap;
193     }
194 
195     @Override
196     public JAXXBinding getDataBinding(String bindingId) {
197         return $bindings.get(bindingId);
198     }
199 
200     @Override
201     public JAXXBinding[] getDataBindings() {
202         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
203     }
204 
205     @Override
206     public Object getObjectById(String id) {
207         return $objectMap.get(id);
208     }
209 
210     @Override
211     public void processDataBinding(String $binding, boolean $force) {
212         if (!$force && $activeBindings.contains($binding)) { 
213             return;
214         }
215         $activeBindings.add($binding);
216         try {
217             if (allComponentsCreated && $bindings.containsKey($binding)) {
218                 getDataBinding($binding).processDataBinding();
219             }
220         } finally {
221             $activeBindings.remove($binding);
222         }
223     }
224 
225     @Override
226     public void processDataBinding(String $binding) {
227         processDataBinding($binding, false);
228     }
229 
230     @Override
231     public void registerDataBinding(JAXXBinding binding) {
232         $bindings.put(binding.getId(), binding);
233     }
234 
235     @Override
236     public void removeDataBinding(String $binding) {
237         if (allComponentsCreated && $bindings.containsKey($binding)) {
238             getDataBinding($binding).removeDataBinding();
239         }
240     }
241 
242     /*-----------------------------------------------------------------------*/
243     /*--------------------- JAXXContext implementation  ---------------------*/
244     /*-----------------------------------------------------------------------*/
245 
246     @Override
247     public <T> T getContextValue(Class<T> clazz) {
248         return delegateContext.getContextValue(clazz, null);
249     }
250 
251     @Override
252     public <T> T getContextValue(Class<T> clazz, String name) {
253         return delegateContext.getContextValue(clazz, name);
254     }
255 
256     @Override
257     public JAXXContext getDelegateContext() {
258         return delegateContext;
259     }
260 
261     @Override
262     public <O extends Container> O getParentContainer(Class<O> clazz) {
263         return SwingUtil.getParentContainer(this, clazz);
264     }
265 
266     @Override
267     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
268         return SwingUtil.getParentContainer(source, clazz);
269     }
270 
271     @Override
272     public <T> void removeContextValue(Class<T> clazz) {
273         delegateContext.removeContextValue(clazz, null);
274     }
275 
276     @Override
277     public <T> void removeContextValue(Class<T> clazz, String name) {
278         delegateContext.removeContextValue(clazz, name);
279     }
280 
281     @Override
282     public <T> void setContextValue(T o) {
283         delegateContext.setContextValue(o, null);
284     }
285 
286     @Override
287     public <T> void setContextValue(T o, String name) {
288         delegateContext.setContextValue(o, name);
289     }
290 
291     /*-----------------------------------------------------------------------*/
292     /*---------------------------- Event methods ----------------------------*/
293     /*-----------------------------------------------------------------------*/
294 
295     public void doActionPerformed__on__referentialSamplingEquipmentsLocalTableNouveauBouton(ActionEvent event) {
296         if (log.isDebugEnabled()) {
297             log.debug(event);
298         }
299         model.addNewRow();
300     }
301 
302     /*-----------------------------------------------------------------------*/
303     /*----------------------- Public acessor methods  -----------------------*/
304     /*-----------------------------------------------------------------------*/
305 
306     public ReefDbHelpBroker getBroker() {
307         return broker;
308     }
309 
310     public JPanel getButtonsPanel() {
311         return buttonsPanel;
312     }
313 
314     public SamplingEquipmentsLocalUIHandler getHandler() {
315         return handler;
316     }
317 
318     public SamplingEquipmentsLocalUIModel getModel() {
319         return model;
320     }
321 
322     public SwingTable getReferentialSamplingEquipmentsLocalTable() {
323         return referentialSamplingEquipmentsLocalTable;
324     }
325 
326     public JButton getReferentialSamplingEquipmentsLocalTableDeleteBouton() {
327         return referentialSamplingEquipmentsLocalTableDeleteBouton;
328     }
329 
330     public JButton getReferentialSamplingEquipmentsLocalTableNouveauBouton() {
331         return referentialSamplingEquipmentsLocalTableNouveauBouton;
332     }
333 
334     public JButton getReferentialSamplingEquipmentsLocalTableReplaceBouton() {
335         return referentialSamplingEquipmentsLocalTableReplaceBouton;
336     }
337 
338     public SamplingEquipmentsMenuUI getSamplingEquipmentsLocalMenuUI() {
339         return samplingEquipmentsLocalMenuUI;
340     }
341 
342     /*-----------------------------------------------------------------------*/
343     /*--------------------- Protected acessors methods  ---------------------*/
344     /*-----------------------------------------------------------------------*/
345 
346     protected JPanel get$JPanel1() {
347         return $JPanel1;
348     }
349 
350     protected JScrollPane get$JScrollPane0() {
351         return $JScrollPane0;
352     }
353 
354     /*-----------------------------------------------------------------------*/
355     /*--------------------- Components creation methods ---------------------*/
356     /*-----------------------------------------------------------------------*/
357 
358     protected void addChildrenToButtonsPanel() {
359         if (!allComponentsCreated) {
360             return;
361         }
362         buttonsPanel.add(referentialSamplingEquipmentsLocalTableNouveauBouton);
363         buttonsPanel.add(referentialSamplingEquipmentsLocalTableDeleteBouton);
364         buttonsPanel.add(referentialSamplingEquipmentsLocalTableReplaceBouton);
365     }
366 
367     protected void createBroker() {
368         $objectMap.put("broker", broker = new ReefDbHelpBroker("reefdb.home.help"));
369     }
370 
371     protected void createButtonsPanel() {
372         $objectMap.put("buttonsPanel", buttonsPanel = new JPanel());
373         
374         buttonsPanel.setName("buttonsPanel");
375         buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
376     }
377 
378     protected SamplingEquipmentsLocalUIHandler createHandler() {
379         return new SamplingEquipmentsLocalUIHandler();
380     }
381 
382     protected void createModel() {
383         $objectMap.put("model", model = getContextValue(SamplingEquipmentsLocalUIModel.class));
384     }
385 
386     protected void createReferentialSamplingEquipmentsLocalTable() {
387         $objectMap.put("referentialSamplingEquipmentsLocalTable", referentialSamplingEquipmentsLocalTable = new SwingTable());
388         
389         referentialSamplingEquipmentsLocalTable.setName("referentialSamplingEquipmentsLocalTable");
390     }
391 
392     protected void createReferentialSamplingEquipmentsLocalTableDeleteBouton() {
393         $objectMap.put("referentialSamplingEquipmentsLocalTableDeleteBouton", referentialSamplingEquipmentsLocalTableDeleteBouton = new JButton());
394         
395         referentialSamplingEquipmentsLocalTableDeleteBouton.setName("referentialSamplingEquipmentsLocalTableDeleteBouton");
396         referentialSamplingEquipmentsLocalTableDeleteBouton.setText(t("reefdb.common.delete"));
397         referentialSamplingEquipmentsLocalTableDeleteBouton.setToolTipText(t("reefdb.common.delete"));
398         referentialSamplingEquipmentsLocalTableDeleteBouton.putClientProperty("applicationAction", DeleteSamplingEquipmentAction.class);
399     }
400 
401     protected void createReferentialSamplingEquipmentsLocalTableNouveauBouton() {
402         $objectMap.put("referentialSamplingEquipmentsLocalTableNouveauBouton", referentialSamplingEquipmentsLocalTableNouveauBouton = new JButton());
403         
404         referentialSamplingEquipmentsLocalTableNouveauBouton.setName("referentialSamplingEquipmentsLocalTableNouveauBouton");
405         referentialSamplingEquipmentsLocalTableNouveauBouton.setText(t("reefdb.common.new"));
406         referentialSamplingEquipmentsLocalTableNouveauBouton.setToolTipText(t("reefdb.common.new"));
407         referentialSamplingEquipmentsLocalTableNouveauBouton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__referentialSamplingEquipmentsLocalTableNouveauBouton"));
408     }
409 
410     protected void createReferentialSamplingEquipmentsLocalTableReplaceBouton() {
411         $objectMap.put("referentialSamplingEquipmentsLocalTableReplaceBouton", referentialSamplingEquipmentsLocalTableReplaceBouton = new JButton());
412         
413         referentialSamplingEquipmentsLocalTableReplaceBouton.setName("referentialSamplingEquipmentsLocalTableReplaceBouton");
414         referentialSamplingEquipmentsLocalTableReplaceBouton.setText(t("reefdb.common.replace"));
415         referentialSamplingEquipmentsLocalTableReplaceBouton.setToolTipText(t("reefdb.common.replace"));
416         referentialSamplingEquipmentsLocalTableReplaceBouton.putClientProperty("applicationAction", OpenReplaceSamplingEquipmentAction.class);
417     }
418 
419     protected void createSamplingEquipmentsLocalMenuUI() {
420         $objectMap.put("samplingEquipmentsLocalMenuUI", samplingEquipmentsLocalMenuUI = new SamplingEquipmentsMenuUI(this));
421         
422         samplingEquipmentsLocalMenuUI.setName("samplingEquipmentsLocalMenuUI");
423     }
424 
425     /*-----------------------------------------------------------------------*/
426     /*------------------------ Internal jaxx methods ------------------------*/
427     /*-----------------------------------------------------------------------*/
428 
429     private void $completeSetup() {
430         allComponentsCreated = true;
431         if (log.isDebugEnabled()) {
432             log.debug(this);
433         }
434         // inline complete setup of $JPanel0
435         add(samplingEquipmentsLocalMenuUI, BorderLayout.LINE_START);
436         add($JPanel1, BorderLayout.CENTER);
437         // inline complete setup of $JPanel1
438         $JPanel1.add($JScrollPane0);
439         $JPanel1.add(buttonsPanel, BorderLayout.PAGE_END);
440         // inline complete setup of $JScrollPane0
441         $JScrollPane0.getViewport().add(referentialSamplingEquipmentsLocalTable);
442         addChildrenToButtonsPanel();
443         
444         // apply 2 data bindings
445         JAXXUtil.applyDataBinding(this, $bindings.keySet());
446         
447         // apply 9 property setters
448         referentialSamplingEquipmentsLocalTableNouveauBouton.setAlignmentX(Component.CENTER_ALIGNMENT);
449         referentialSamplingEquipmentsLocalTableDeleteBouton.setAlignmentX(Component.CENTER_ALIGNMENT);
450         referentialSamplingEquipmentsLocalTableReplaceBouton.setAlignmentX(Component.CENTER_ALIGNMENT);
451         referentialSamplingEquipmentsLocalTableNouveauBouton.setIcon(SwingUtil.createActionIcon("add"));
452         referentialSamplingEquipmentsLocalTableDeleteBouton.setIcon(SwingUtil.createActionIcon("delete"));
453         referentialSamplingEquipmentsLocalTableReplaceBouton.setIcon(SwingUtil.createActionIcon("replace"));
454     }
455 
456     private void $initialize() {
457         if (allComponentsCreated) {
458             return;
459         }
460         if (log.isDebugEnabled()) {
461             log.debug(this);
462         }
463         handler.beforeInit(this);
464         $objectMap.put("$JPanel0", $JPanel0);
465         createModel();
466         createBroker();
467         createSamplingEquipmentsLocalMenuUI();
468         // inline creation of $JPanel1
469         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
470         
471         $JPanel1.setName("$JPanel1");
472         $JPanel1.setLayout(new BorderLayout());
473         // inline creation of $JScrollPane0
474         $objectMap.put("$JScrollPane0", $JScrollPane0 = new JScrollPane());
475         
476         $JScrollPane0.setName("$JScrollPane0");
477         createReferentialSamplingEquipmentsLocalTable();
478         createButtonsPanel();
479         createReferentialSamplingEquipmentsLocalTableNouveauBouton();
480         createReferentialSamplingEquipmentsLocalTableDeleteBouton();
481         createReferentialSamplingEquipmentsLocalTableReplaceBouton();
482         // inline creation of $JPanel0
483         setName("$JPanel0");
484         setLayout(new BorderLayout());
485         
486         // registers 2 data bindings
487         $registerDefaultBindings();
488         $completeSetup();
489         handler.afterInit(this);
490     }
491 
492     private void $registerDefaultBindings() {
493         // register 2 data bindings
494         registerDataBinding(new DefaultJAXXBinding(this, BINDING_REFERENTIAL_SAMPLING_EQUIPMENTS_LOCAL_TABLE_DELETE_BOUTON_ENABLED, true) {
495         
496             @Override
497             public void applyDataBinding() {
498                 if (model != null) {
499                     model.addPropertyChangeListener("selectedRows", this);
500                 }
501             }
502         
503             @Override
504             public void processDataBinding() {
505                 if (model != null && model.getSelectedRows() != null) {
506                     referentialSamplingEquipmentsLocalTableDeleteBouton.setEnabled(!model.getSelectedRows().isEmpty());
507                 }
508             }
509         
510             @Override
511             public void removeDataBinding() {
512                 if (model != null) {
513                     model.removePropertyChangeListener("selectedRows", this);
514                 }
515             }
516         });
517         registerDataBinding(new DefaultJAXXBinding(this, BINDING_REFERENTIAL_SAMPLING_EQUIPMENTS_LOCAL_TABLE_REPLACE_BOUTON_ENABLED, true) {
518         
519             @Override
520             public void applyDataBinding() {
521                 if (model != null) {
522                     model.addPropertyChangeListener("selectedRows", this);
523                 }
524             }
525         
526             @Override
527             public void processDataBinding() {
528                 if (model != null && model.getSelectedRows() != null) {
529                     referentialSamplingEquipmentsLocalTableReplaceBouton.setEnabled(model.getSelectedRows().size() == 1);
530                 }
531             }
532         
533             @Override
534             public void removeDataBinding() {
535                 if (model != null) {
536                     model.removePropertyChangeListener("selectedRows", this);
537                 }
538             }
539         });
540     }
541 
542 }