View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.pmfm.parameter.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.pmfm.parameter.menu.ManageParametersMenuUI;
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.awt.event.MouseEvent;
42  import java.awt.event.MouseListener;
43  import java.util.ArrayList;
44  import java.util.HashMap;
45  import java.util.List;
46  import java.util.Map;
47  import java.util.TreeMap;
48  import javax.swing.Box;
49  import javax.swing.BoxLayout;
50  import javax.swing.JButton;
51  import javax.swing.JMenuItem;
52  import javax.swing.JPanel;
53  import javax.swing.JPopupMenu;
54  import javax.swing.JScrollPane;
55  import jaxx.runtime.JAXXBinding;
56  import jaxx.runtime.JAXXContext;
57  import jaxx.runtime.JAXXObject;
58  import jaxx.runtime.JAXXObjectDescriptor;
59  import jaxx.runtime.JAXXUtil;
60  import jaxx.runtime.SwingUtil;
61  import jaxx.runtime.binding.DefaultJAXXBinding;
62  import jaxx.runtime.context.DefaultJAXXContext;
63  import org.apache.commons.logging.Log;
64  import org.apache.commons.logging.LogFactory;
65  import static org.nuiton.i18n.I18n.t;
66  
67  public class ManageParametersLocalUI extends JPanel implements ReefDbUI<ManageParametersLocalUIModel, ManageParametersLocalUIHandler>, JAXXObject {
68  
69      /*-----------------------------------------------------------------------*/
70      /*------------------ Constants for all public bindings ------------------*/
71      /*-----------------------------------------------------------------------*/
72  
73      public static final String BINDING_DELETE_BUTTON_ENABLED = "deleteButton.enabled";
74      public static final String BINDING_EDIT_PARAMETER_CODE_ENABLED = "editParameterCode.enabled";
75      public static final String BINDING_REPLACE_BUTTON_ENABLED = "replaceButton.enabled";
76  
77      /*-----------------------------------------------------------------------*/
78      /*------------------------- Other static fields -------------------------*/
79      /*-----------------------------------------------------------------------*/
80  
81      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVWz28bRRQeO3ZSO00hpElTtREOpCUBNKYgcQkpaROiOnLayE6lCB/oeHfsTJndmczOYoeoFXcu/Alw54LEjRPiwJkDF8S/gBCHXhFvdu1db/wjFoFIWdnvx/fe+2bet/72D5T1FFp+StptrHxXM4fi3XuHh4/qT6mlt6lnKSa1UCj8S6VRuoam7cjuafR6rWzSi5304pZwpHCp25O9XkZ5T59w6h1RqjVaSmZYnlesRu71tvRVFzVqahDq13/9mf7K/uKbNEJtCd3NwCiF87LiSTJllGa2Rq9Apc9IkRO3CW0o5jah3xlj2+LE8x4Shx6j52iqjCYlUQCm0WvjjxxgBPltqdGlld194lL+jkb1hsKsoahDFVaUNuw69hn2WlAfW8LVAIcd4pImBXeDmsKMcCydhoOhD+hKQyYXFhj3grj9rtUrG+vjkpRB5UmNso6wKdeo+f8X3TOV4sqTdSU+pUqjt0aUrsD37foDyLsfRPekO9T1H5c0evKfdG7Q+hrfC0qYgrmobveg7sD9MFeh3SkVWpOxMyu7VUsJzo0PTvZaIiF2mfD5KCuvSZ3TfSF9uBcLyRrGaLqKeZilNtNRy1vAsUbziSQTX9LUMQk3oryrMnk+B6aoRriHzWOf2Io16XsxoUFruGo+BwkGbDHCvFz3tRauF1FxLTlZzqWt+0GIRnOJHkOrCVuJ0eC6QH+xazXpn1FUcmINCFDoRmLbQUdwrCPxoqdqKKt8MGu0WOuXngq4QtFZPCM6BjDw/r0w9+sPv3+/01WaK1B7fmBoj1CCAkglJNx9Zkq/FMqMrxkv7hG5XkM5Dya3QhW9OaCxascNzUG9WZOOTTp+QLwjgMhO/fbjTwtPfplA6R2U54LYO8TEl1BOHylgQXC7LT/cDDq63LoEz5fhfwLuHsQx4ZbM4qAJYoMKZjRtg7LNdnbLEo4jXAwnqdG0FoIfMHkwJKIN1N0cQF3Ufz3384u56nebXfpSMM71oeExhdmP0SRzOXNpINUdFR4ozdPSo74tYrUdpL+o927KznK9Gzzf76MpC5v/CZGSM4sYsu4FlIH2nz6S1K2ElzLayNCLLVPt2RmCpzo3OCJ5Pklh5E4SPSxqirpmJ+HMbp0Gso6bVIfkUbsiWt7qGvbY53R1rbCxUbjzrO2bAe8GvJtPm+jsUv1bKpZOt4PdHYuFyXDPIxKuJsfrepMcDAmKKVg5XR7GAfM+cqQ+WV0byEBCds4jIHNmloxR42iS650m49eMcYcanRxnaWgk1vCzoWeuSs/RgnRy2jMcHOzyRsH1OS/cvl0YFQccPKQtgz+Ehf7XynlUpOAkOTkRwBu68oFNNCnUmWtD7bt9BVLmmT8X0ZileRwPRli4MMKtMabKE86aLvxA0IcjkN4Yq5fnIxDevDDC22NMk2FW+LIcgvHqWF18eWEmRiGMx8QoBMPEP/ZWN/TEDAAA";
82      private static final Log log = LogFactory.getLog(ManageParametersLocalUI.class);
83      private static final long serialVersionUID = 1L;
84  
85      /*-----------------------------------------------------------------------*/
86      /*--------------------------- Internal states ---------------------------*/
87      /*-----------------------------------------------------------------------*/
88  
89      protected List<Object> $activeBindings = new ArrayList<Object>();
90      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
91      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
92      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
93      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
94      private boolean allComponentsCreated;
95      protected final JAXXContext delegateContext = new DefaultJAXXContext();
96  
97      /*-----------------------------------------------------------------------*/
98      /*------------------------ Protected components  ------------------------*/
99      /*-----------------------------------------------------------------------*/
100 
101     protected ReefDbHelpBroker broker;
102     protected JPanel buttonsPanel;
103     protected JButton deleteButton;
104     protected JMenuItem editParameterCode;
105     protected final ManageParametersLocalUIHandler handler = createHandler();
106     protected ManageParametersMenuUI menuUI;
107     protected ManageParametersLocalUIModel model;
108     protected JButton newButton;
109     protected SwingTable parametersLocalTable;
110     protected JButton replaceButton;
111     protected JPopupMenu tablePopup;
112 
113     /*-----------------------------------------------------------------------*/
114     /*------------------------- Private components  -------------------------*/
115     /*-----------------------------------------------------------------------*/
116 
117     private ManageParametersLocalUI $JPanel0 = this;
118     private JPanel $JPanel1;
119     private JScrollPane $JScrollPane0;
120 
121     /*-----------------------------------------------------------------------*/
122     /*---------------------------- Constructors  ----------------------------*/
123     /*-----------------------------------------------------------------------*/
124 
125     public ManageParametersLocalUI(ApplicationUI parentUI) {
126         ApplicationUIUtil.setParentUI(this, parentUI);
127             $initialize();
128     }
129 
130     public ManageParametersLocalUI(LayoutManager param0, boolean param1) {
131         super(param0 ,param1);
132         $initialize();
133     }
134 
135     public ManageParametersLocalUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
136         super(param1 ,param2);
137         JAXXUtil.initContext(this, parentContext);
138         $initialize();
139     }
140 
141     public ManageParametersLocalUI(boolean param0) {
142         super(param0);
143         $initialize();
144     }
145 
146     public ManageParametersLocalUI(JAXXContext parentContext, boolean param1) {
147         super(param1);
148         JAXXUtil.initContext(this, parentContext);
149         $initialize();
150     }
151 
152     public ManageParametersLocalUI() {
153         $initialize();
154     }
155 
156     public ManageParametersLocalUI(JAXXContext parentContext) {
157         JAXXUtil.initContext(this, parentContext);
158         $initialize();
159     }
160 
161     public ManageParametersLocalUI(LayoutManager param0) {
162         super(param0);
163         $initialize();
164     }
165 
166     public ManageParametersLocalUI(JAXXContext parentContext, LayoutManager param1) {
167         super(param1);
168         JAXXUtil.initContext(this, parentContext);
169         $initialize();
170     }
171 
172     /*-----------------------------------------------------------------------*/
173     /*--------------------------- Statics methods ---------------------------*/
174     /*-----------------------------------------------------------------------*/
175 
176     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
177         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
178     }
179 
180     /*-----------------------------------------------------------------------*/
181     /*---------------------- JAXXObject implementation ----------------------*/
182     /*-----------------------------------------------------------------------*/
183 
184     @Override
185     public void applyDataBinding(String $binding) {
186         if (allComponentsCreated && $bindings.containsKey($binding)) {
187             getDataBinding($binding).applyDataBinding();
188         }
189         processDataBinding($binding);
190     }
191 
192     @Override
193     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
194         super.firePropertyChange(propertyName, oldValue, newValue);
195     }
196 
197     @Override
198     public Map<String, Object> get$objectMap() {
199         return $objectMap;
200     }
201 
202     @Override
203     public JAXXBinding getDataBinding(String bindingId) {
204         return $bindings.get(bindingId);
205     }
206 
207     @Override
208     public JAXXBinding[] getDataBindings() {
209         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
210     }
211 
212     @Override
213     public Object getObjectById(String id) {
214         return $objectMap.get(id);
215     }
216 
217     @Override
218     public void processDataBinding(String $binding, boolean $force) {
219         if (!$force && $activeBindings.contains($binding)) { 
220             return;
221         }
222         $activeBindings.add($binding);
223         try {
224             if (allComponentsCreated && $bindings.containsKey($binding)) {
225                 getDataBinding($binding).processDataBinding();
226             }
227         } finally {
228             $activeBindings.remove($binding);
229         }
230     }
231 
232     @Override
233     public void processDataBinding(String $binding) {
234         processDataBinding($binding, false);
235     }
236 
237     @Override
238     public void registerDataBinding(JAXXBinding binding) {
239         $bindings.put(binding.getId(), binding);
240     }
241 
242     @Override
243     public void removeDataBinding(String $binding) {
244         if (allComponentsCreated && $bindings.containsKey($binding)) {
245             getDataBinding($binding).removeDataBinding();
246         }
247     }
248 
249     /*-----------------------------------------------------------------------*/
250     /*--------------------- JAXXContext implementation  ---------------------*/
251     /*-----------------------------------------------------------------------*/
252 
253     @Override
254     public <T> T getContextValue(Class<T> clazz) {
255         return delegateContext.getContextValue(clazz, null);
256     }
257 
258     @Override
259     public <T> T getContextValue(Class<T> clazz, String name) {
260         return delegateContext.getContextValue(clazz, name);
261     }
262 
263     @Override
264     public JAXXContext getDelegateContext() {
265         return delegateContext;
266     }
267 
268     @Override
269     public <O extends Container> O getParentContainer(Class<O> clazz) {
270         return SwingUtil.getParentContainer(this, clazz);
271     }
272 
273     @Override
274     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
275         return SwingUtil.getParentContainer(source, clazz);
276     }
277 
278     @Override
279     public <T> void removeContextValue(Class<T> clazz) {
280         delegateContext.removeContextValue(clazz, null);
281     }
282 
283     @Override
284     public <T> void removeContextValue(Class<T> clazz, String name) {
285         delegateContext.removeContextValue(clazz, name);
286     }
287 
288     @Override
289     public <T> void setContextValue(T o) {
290         delegateContext.setContextValue(o, null);
291     }
292 
293     @Override
294     public <T> void setContextValue(T o, String name) {
295         delegateContext.setContextValue(o, name);
296     }
297 
298     /*-----------------------------------------------------------------------*/
299     /*---------------------------- Event methods ----------------------------*/
300     /*-----------------------------------------------------------------------*/
301 
302     public void doActionPerformed__on__editParameterCode(ActionEvent event) {
303         if (log.isDebugEnabled()) {
304             log.debug(event);
305         }
306         handler.editParameterCode();
307     }
308 
309     public void doActionPerformed__on__newButton(ActionEvent event) {
310         if (log.isDebugEnabled()) {
311             log.debug(event);
312         }
313         model.addNewRow();
314     }
315 
316     public void doMouseClicked__on__parametersLocalTable(MouseEvent event) {
317         if (log.isDebugEnabled()) {
318             log.debug(event);
319         }
320         handler.autoSelectRowInTable(event, tablePopup);
321     }
322 
323     /*-----------------------------------------------------------------------*/
324     /*----------------------- Public acessor methods  -----------------------*/
325     /*-----------------------------------------------------------------------*/
326 
327     public ReefDbHelpBroker getBroker() {
328         return broker;
329     }
330 
331     public JPanel getButtonsPanel() {
332         return buttonsPanel;
333     }
334 
335     public JButton getDeleteButton() {
336         return deleteButton;
337     }
338 
339     public JMenuItem getEditParameterCode() {
340         return editParameterCode;
341     }
342 
343     public ManageParametersLocalUIHandler getHandler() {
344         return handler;
345     }
346 
347     public ManageParametersMenuUI getMenuUI() {
348         return menuUI;
349     }
350 
351     public ManageParametersLocalUIModel getModel() {
352         return model;
353     }
354 
355     public JButton getNewButton() {
356         return newButton;
357     }
358 
359     public SwingTable getParametersLocalTable() {
360         return parametersLocalTable;
361     }
362 
363     public JButton getReplaceButton() {
364         return replaceButton;
365     }
366 
367     public JPopupMenu getTablePopup() {
368         return tablePopup;
369     }
370 
371     /*-----------------------------------------------------------------------*/
372     /*--------------------- Protected acessors methods  ---------------------*/
373     /*-----------------------------------------------------------------------*/
374 
375     protected JPanel get$JPanel1() {
376         return $JPanel1;
377     }
378 
379     protected JScrollPane get$JScrollPane0() {
380         return $JScrollPane0;
381     }
382 
383     /*-----------------------------------------------------------------------*/
384     /*--------------------- Components creation methods ---------------------*/
385     /*-----------------------------------------------------------------------*/
386 
387     protected void addChildrenToButtonsPanel() {
388         if (!allComponentsCreated) {
389             return;
390         }
391         buttonsPanel.add(newButton);
392         buttonsPanel.add(deleteButton);
393         buttonsPanel.add(replaceButton);
394     }
395 
396     protected void addChildrenToTablePopup() {
397         if (!allComponentsCreated) {
398             return;
399         }
400         tablePopup.add(editParameterCode);
401     }
402 
403     protected void createBroker() {
404         $objectMap.put("broker", broker = new ReefDbHelpBroker("reefdb.home.help"));
405     }
406 
407     protected void createButtonsPanel() {
408         $objectMap.put("buttonsPanel", buttonsPanel = new JPanel());
409         
410         buttonsPanel.setName("buttonsPanel");
411         buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.LINE_AXIS));
412     }
413 
414     protected void createDeleteButton() {
415         $objectMap.put("deleteButton", deleteButton = new JButton());
416         
417         deleteButton.setName("deleteButton");
418         deleteButton.setText(t("reefdb.common.delete"));
419         deleteButton.setToolTipText(t("reefdb.common.delete"));
420         deleteButton.putClientProperty("applicationAction", DeleteParameterAction.class);
421     }
422 
423     protected void createEditParameterCode() {
424         $objectMap.put("editParameterCode", editParameterCode = new JMenuItem());
425         
426         editParameterCode.setName("editParameterCode");
427         editParameterCode.setText(t("reefdb.parameter.editCode"));
428         editParameterCode.setToolTipText(t("reefdb.parameter.editCode.tip"));
429         editParameterCode.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__editParameterCode"));
430     }
431 
432     protected ManageParametersLocalUIHandler createHandler() {
433         return new ManageParametersLocalUIHandler();
434     }
435 
436     protected void createMenuUI() {
437         $objectMap.put("menuUI", menuUI = new ManageParametersMenuUI(this));
438         
439         menuUI.setName("menuUI");
440     }
441 
442     protected void createModel() {
443         $objectMap.put("model", model = getContextValue(ManageParametersLocalUIModel.class));
444     }
445 
446     protected void createNewButton() {
447         $objectMap.put("newButton", newButton = new JButton());
448         
449         newButton.setName("newButton");
450         newButton.setText(t("reefdb.common.new"));
451         newButton.setToolTipText(t("reefdb.common.new"));
452         newButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__newButton"));
453     }
454 
455     protected void createParametersLocalTable() {
456         $objectMap.put("parametersLocalTable", parametersLocalTable = new SwingTable());
457         
458         parametersLocalTable.setName("parametersLocalTable");
459         parametersLocalTable.addMouseListener(JAXXUtil.getEventListener(MouseListener.class, "mouseClicked", this, "doMouseClicked__on__parametersLocalTable"));
460     }
461 
462     protected void createReplaceButton() {
463         $objectMap.put("replaceButton", replaceButton = new JButton());
464         
465         replaceButton.setName("replaceButton");
466         replaceButton.setText(t("reefdb.common.replace"));
467         replaceButton.setToolTipText(t("reefdb.common.replace"));
468         replaceButton.putClientProperty("applicationAction", OpenReplaceParameterAction.class);
469     }
470 
471     protected void createTablePopup() {
472         $objectMap.put("tablePopup", tablePopup = new JPopupMenu());
473         
474         tablePopup.setName("tablePopup");
475     }
476 
477     /*-----------------------------------------------------------------------*/
478     /*------------------------ Internal jaxx methods ------------------------*/
479     /*-----------------------------------------------------------------------*/
480 
481     private void $completeSetup() {
482         allComponentsCreated = true;
483         if (log.isDebugEnabled()) {
484             log.debug(this);
485         }
486         // inline complete setup of $JPanel0
487         add(menuUI, BorderLayout.LINE_START);
488         add($JPanel1, BorderLayout.CENTER);
489         // inline complete setup of $JPanel1
490         $JPanel1.add($JScrollPane0);
491         $JPanel1.add(buttonsPanel, BorderLayout.PAGE_END);
492         // inline complete setup of $JScrollPane0
493         $JScrollPane0.getViewport().add(parametersLocalTable);
494         addChildrenToTablePopup();
495         addChildrenToButtonsPanel();
496         
497         // apply 3 data bindings
498         JAXXUtil.applyDataBinding(this, $bindings.keySet());
499         
500         // apply 10 property setters
501         newButton.setAlignmentX(Component.CENTER_ALIGNMENT);
502         deleteButton.setAlignmentX(Component.CENTER_ALIGNMENT);
503         replaceButton.setAlignmentX(Component.CENTER_ALIGNMENT);
504         editParameterCode.setIcon(SwingUtil.createActionIcon("edit"));
505         newButton.setIcon(SwingUtil.createActionIcon("add"));
506         deleteButton.setIcon(SwingUtil.createActionIcon("delete"));
507         replaceButton.setIcon(SwingUtil.createActionIcon("replace"));
508     }
509 
510     private void $initialize() {
511         if (allComponentsCreated) {
512             return;
513         }
514         if (log.isDebugEnabled()) {
515             log.debug(this);
516         }
517         handler.beforeInit(this);
518         $objectMap.put("$JPanel0", $JPanel0);
519         createModel();
520         createBroker();
521         createMenuUI();
522         // inline creation of $JPanel1
523         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
524         
525         $JPanel1.setName("$JPanel1");
526         $JPanel1.setLayout(new BorderLayout());
527         // inline creation of $JScrollPane0
528         $objectMap.put("$JScrollPane0", $JScrollPane0 = new JScrollPane());
529         
530         $JScrollPane0.setName("$JScrollPane0");
531         createTablePopup();
532         createEditParameterCode();
533         createParametersLocalTable();
534         createButtonsPanel();
535         createNewButton();
536         createDeleteButton();
537         createReplaceButton();
538         // inline creation of $JPanel0
539         setName("$JPanel0");
540         setLayout(new BorderLayout());
541         
542         // registers 3 data bindings
543         $registerDefaultBindings();
544         $completeSetup();
545         handler.afterInit(this);
546     }
547 
548     private void $registerDefaultBindings() {
549         // register 3 data bindings
550         registerDataBinding(new DefaultJAXXBinding(this, BINDING_EDIT_PARAMETER_CODE_ENABLED, true) {
551         
552             @Override
553             public void applyDataBinding() {
554                 if (model != null) {
555                     model.addPropertyChangeListener("singleSelectedRow", this);
556                 }
557             }
558         
559             @Override
560             public void processDataBinding() {
561                 if (model != null && model.getSingleSelectedRow() != null) {
562                     editParameterCode.setEnabled(model.getSingleSelectedRow() != null && model.getSingleSelectedRow().isNewCode());
563                 }
564             }
565         
566             @Override
567             public void removeDataBinding() {
568                 if (model != null) {
569                     model.removePropertyChangeListener("singleSelectedRow", this);
570                 }
571             }
572         });
573         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_BUTTON_ENABLED, true) {
574         
575             @Override
576             public void applyDataBinding() {
577                 if (model != null) {
578                     model.addPropertyChangeListener("selectedRows", this);
579                 }
580             }
581         
582             @Override
583             public void processDataBinding() {
584                 if (model != null && model.getSelectedRows() != null) {
585                     deleteButton.setEnabled(!model.getSelectedRows().isEmpty());
586                 }
587             }
588         
589             @Override
590             public void removeDataBinding() {
591                 if (model != null) {
592                     model.removePropertyChangeListener("selectedRows", this);
593                 }
594             }
595         });
596         registerDataBinding(new DefaultJAXXBinding(this, BINDING_REPLACE_BUTTON_ENABLED, true) {
597         
598             @Override
599             public void applyDataBinding() {
600                 if (model != null) {
601                     model.addPropertyChangeListener("selectedRows", this);
602                 }
603             }
604         
605             @Override
606             public void processDataBinding() {
607                 if (model != null && model.getSelectedRows() != null) {
608                     replaceButton.setEnabled(model.getSelectedRows().size() == 1);
609                 }
610             }
611         
612             @Override
613             public void removeDataBinding() {
614                 if (model != null) {
615                     model.removePropertyChangeListener("selectedRows", this);
616                 }
617             }
618         });
619     }
620 
621 }