View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.context.contextslist;
2   
3   import fr.ifremer.dali.ui.swing.DaliHelpBroker;
4   import fr.ifremer.dali.ui.swing.DaliUIContext;
5   import fr.ifremer.dali.ui.swing.util.DaliUI;
6   import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
7   import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
8   import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
9   import java.awt.BorderLayout;
10  import java.awt.Component;
11  import java.awt.Container;
12  import java.awt.LayoutManager;
13  import java.awt.event.ActionEvent;
14  import java.awt.event.ActionListener;
15  import java.util.ArrayList;
16  import java.util.HashMap;
17  import java.util.List;
18  import java.util.Map;
19  import java.util.TreeMap;
20  import javax.swing.BorderFactory;
21  import javax.swing.Box;
22  import javax.swing.BoxLayout;
23  import javax.swing.JButton;
24  import javax.swing.JPanel;
25  import javax.swing.JScrollPane;
26  import jaxx.runtime.JAXXBinding;
27  import jaxx.runtime.JAXXContext;
28  import jaxx.runtime.JAXXObject;
29  import jaxx.runtime.JAXXObjectDescriptor;
30  import jaxx.runtime.JAXXUtil;
31  import jaxx.runtime.SwingUtil;
32  import jaxx.runtime.binding.DefaultJAXXBinding;
33  import jaxx.runtime.context.DefaultJAXXContext;
34  import jaxx.runtime.swing.help.JAXXHelpUI;
35  import org.apache.commons.logging.Log;
36  import org.apache.commons.logging.LogFactory;
37  import static org.nuiton.i18n.I18n.t;
38  
39  public class ManageContextsListTableUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, DaliUI<ManageContextsListTableUIModel, ManageContextsListTableUIHandler>, JAXXObject {
40  
41      /*-----------------------------------------------------------------------*/
42      /*------------------ Constants for all public bindings ------------------*/
43      /*-----------------------------------------------------------------------*/
44  
45      public static final String BINDING_ACTIVATE_BUTTON_ENABLED = "activateButton.enabled";
46      public static final String BINDING_DELETE_BUTTON_ENABLED = "deleteButton.enabled";
47      public static final String BINDING_DUPLICATE_BUTTON_ENABLED = "duplicateButton.enabled";
48      public static final String BINDING_EXPORT_BUTTON_ENABLED = "exportButton.enabled";
49  
50      /*-----------------------------------------------------------------------*/
51      /*------------------------- Other static fields -------------------------*/
52      /*-----------------------------------------------------------------------*/
53  
54      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVWz28bRRSeOLZTO20KidompC35YagtpHEjxAGFQvOjUVI5BdUBRfgA492pM2W9u519btZYQfwJHOCK4M4FCYkDJ8SBMwcuiH+hQhy4os7seHe99tpexZDDZj3vvW/e+968b/a7ZyjjcLT6mLgu5i0TWJPi+1vHx+/WH1MNdqmjcWaDxZH6m0qhVA3N6sG6A2i9VpHh5W54ecdq2pZJzZ7ozQrKO9A2qHNCKQC6EY3QHKdcDcybrt3iPmqQVBzqN3//lfpC//zbFEKuLbKbE6WsjIsKK0lXUIrpgObFTk9J2SBmQ6TBmdkQ+V6SazsGcZwHpEmfoM/QTAVlbcIFGKC15CV7GF68awNabhKTNOiOZQJ1wakwBw4JM49I3aCAPnjEMXvEaZNyrBOD4RbDzqlICGsywASswtVPF/z/jiFw8OEAtAf7/oFtewlkAWWalk4NQLX/Z6NDiR7ulq1z6xPKAd0aut2u+LUvYrY9zzD0UuF+VeOWYbxHTHob0DXZDrcb1GOS7rkg6togu11mcU8GT1pE56xBXw/TAOmFq/LdC5B48wHs+hBYmYCx3QKwTDEH85EUPVs0uwsFtXpb/n5JPhYDW86kpwoJ0EIESK1Kt+XA+7Lesg2mEaCh9eWoy0XRCTrC7iezEZPMHNGAPR1EL4ToTBx4DsPt1I23c7QcGVAx+jgc/XA2p2oow1tiGdBibVAtHgqT0onFPp2QgJ7136sLv//05w97vjhcEXtfiXXt0TYxtDa3bHFmmdz6slKGFjCjfEjszRrKOYJWTQnf9ZjEql2zSE7s96IMxzIc7xPnREBkZv74+ZerH/82jVJ7KG9YRN8j0v8A5eCECxYsQ3ftd+56GV08vSCeL8jc5DBZXJfDtN/Z9t5UYBtrnIpWHTEwqK4sRSiueWPWP73y5GKQnmul0pkr6LseQ19QQz336z8L1e/v+hROiZKWhrqHNGY+RFlmGsyknsJ2xTNWUWdth7Z0KxTJONlEo3XT7srGhvd8Y4C8aUB5eaIt80ASgaaJLlQ/LYHkKCmimk3LxGIIAc2CZRlHzD6KtbstucmbHhvybRP1Du+4VDJCJj4ithpekdCWlxagm51df6K7JSoL1iQNZ30FpDXLbgcVLHsZKjsOhAEbpC6VPlrNUrwviCsLzVBTsimoeaXjXRO4QUE1l+oPrVOnWMIO+5QWSyt37qxsnMUx0S9M5+VjubPryVcCMrJK6AI65nsb5tuiLMS6hOUXOqvD6mfOvaYN7WIptvqI5p639Budra76Jih+xlNqqQrd6kfMvS/q/Wy8Oj6k/4Ccm6G+m2UcR+mhx+PAu3+SHA91U8UfD98WJaQwnBAVIOmI7X/vrXj+o3/PTVqbumXja/NtiWtTAf9ZqyOfAOPIkPebQdqWcEZzb+kEyEqdmbr4AHp7AHtKPvNjEeXyl/LxVTzCUoKc8oKshtkU38PHI5BuJsrl6xEIqxMjrE+McGtihNLECK8l6EmaaeqTcqJu/DhxN0YhJOvGKIRk3RiFkKwboxBkN54De4Z6xSEQAAA=";
55      private static final Log log = LogFactory.getLog(ManageContextsListTableUI.class);
56      private static final long serialVersionUID = 1L;
57  
58      /*-----------------------------------------------------------------------*/
59      /*--------------------------- Internal states ---------------------------*/
60      /*-----------------------------------------------------------------------*/
61  
62      protected List<Object> $activeBindings = new ArrayList<Object>();
63      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
64      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
65      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
66      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
67      private boolean allComponentsCreated;
68      protected final JAXXContext delegateContext = new DefaultJAXXContext();
69  
70      /*-----------------------------------------------------------------------*/
71      /*------------------------ Protected components  ------------------------*/
72      /*-----------------------------------------------------------------------*/
73  
74      protected JButton activateButton;
75      protected DaliHelpBroker broker;
76      protected JButton deleteButton;
77      protected JButton duplicateButton;
78      protected JButton exportButton;
79      protected final ManageContextsListTableUIHandler handler = createHandler();
80      protected JButton importButton;
81      protected ManageContextsListTableUI manageContextsListMainTable = this;
82      protected SwingTable manageContextsListTable;
83      protected JPanel manageContextsListTablePanelButtons;
84      protected ManageContextsListTableUIModel model;
85      protected JButton newButton;
86  
87      /*-----------------------------------------------------------------------*/
88      /*------------------------- Private components  -------------------------*/
89      /*-----------------------------------------------------------------------*/
90  
91      private JPanel $JPanel0;
92      private JPanel $JPanel1;
93      private JScrollPane $JScrollPane0;
94  
95      /*-----------------------------------------------------------------------*/
96      /*---------------------------- Constructors  ----------------------------*/
97      /*-----------------------------------------------------------------------*/
98  
99      public ManageContextsListTableUI(ApplicationUI parentUI) {
100         ApplicationUIUtil.setParentUI(this, parentUI);
101             $initialize();
102     }
103 
104     public ManageContextsListTableUI() {
105         $initialize();
106     }
107 
108     public ManageContextsListTableUI(JAXXContext parentContext) {
109         JAXXUtil.initContext(this, parentContext);
110         $initialize();
111     }
112 
113     public ManageContextsListTableUI(boolean param0) {
114         super(param0);
115         $initialize();
116     }
117 
118     public ManageContextsListTableUI(JAXXContext parentContext, boolean param1) {
119         super(param1);
120         JAXXUtil.initContext(this, parentContext);
121         $initialize();
122     }
123 
124     public ManageContextsListTableUI(LayoutManager param0) {
125         super(param0);
126         $initialize();
127     }
128 
129     public ManageContextsListTableUI(JAXXContext parentContext, LayoutManager param1) {
130         super(param1);
131         JAXXUtil.initContext(this, parentContext);
132         $initialize();
133     }
134 
135     public ManageContextsListTableUI(LayoutManager param0, boolean param1) {
136         super(param0 ,param1);
137         $initialize();
138     }
139 
140     public ManageContextsListTableUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
141         super(param1 ,param2);
142         JAXXUtil.initContext(this, parentContext);
143         $initialize();
144     }
145 
146     /*-----------------------------------------------------------------------*/
147     /*--------------------------- Statics methods ---------------------------*/
148     /*-----------------------------------------------------------------------*/
149 
150     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
151         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
152     }
153 
154     /*-----------------------------------------------------------------------*/
155     /*---------------------- JAXXObject implementation ----------------------*/
156     /*-----------------------------------------------------------------------*/
157 
158     @Override
159     public void applyDataBinding(String $binding) {
160         if (allComponentsCreated && $bindings.containsKey($binding)) {
161             getDataBinding($binding).applyDataBinding();
162         }
163         processDataBinding($binding);
164     }
165 
166     @Override
167     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
168         super.firePropertyChange(propertyName, oldValue, newValue);
169     }
170 
171     @Override
172     public Map<String, Object> get$objectMap() {
173         return $objectMap;
174     }
175 
176     @Override
177     public JAXXBinding getDataBinding(String bindingId) {
178         return $bindings.get(bindingId);
179     }
180 
181     @Override
182     public JAXXBinding[] getDataBindings() {
183         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
184     }
185 
186     @Override
187     public Object getObjectById(String id) {
188         return $objectMap.get(id);
189     }
190 
191     @Override
192     public void processDataBinding(String $binding, boolean $force) {
193         if (!$force && $activeBindings.contains($binding)) { 
194             return;
195         }
196         $activeBindings.add($binding);
197         try {
198             if (allComponentsCreated && $bindings.containsKey($binding)) {
199                 getDataBinding($binding).processDataBinding();
200             }
201         } finally {
202             $activeBindings.remove($binding);
203         }
204     }
205 
206     @Override
207     public void processDataBinding(String $binding) {
208         processDataBinding($binding, false);
209     }
210 
211     @Override
212     public void registerDataBinding(JAXXBinding binding) {
213         $bindings.put(binding.getId(), binding);
214     }
215 
216     @Override
217     public void removeDataBinding(String $binding) {
218         if (allComponentsCreated && $bindings.containsKey($binding)) {
219             getDataBinding($binding).removeDataBinding();
220         }
221     }
222 
223     /*-----------------------------------------------------------------------*/
224     /*--------------------- JAXXContext implementation  ---------------------*/
225     /*-----------------------------------------------------------------------*/
226 
227     @Override
228     public <T> T getContextValue(Class<T> clazz) {
229         return delegateContext.getContextValue(clazz, null);
230     }
231 
232     @Override
233     public <T> T getContextValue(Class<T> clazz, String name) {
234         return delegateContext.getContextValue(clazz, name);
235     }
236 
237     @Override
238     public JAXXContext getDelegateContext() {
239         return delegateContext;
240     }
241 
242     @Override
243     public <O extends Container> O getParentContainer(Class<O> clazz) {
244         return SwingUtil.getParentContainer(this, clazz);
245     }
246 
247     @Override
248     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
249         return SwingUtil.getParentContainer(source, clazz);
250     }
251 
252     @Override
253     public <T> void removeContextValue(Class<T> clazz) {
254         delegateContext.removeContextValue(clazz, null);
255     }
256 
257     @Override
258     public <T> void removeContextValue(Class<T> clazz, String name) {
259         delegateContext.removeContextValue(clazz, name);
260     }
261 
262     @Override
263     public <T> void setContextValue(T o) {
264         delegateContext.setContextValue(o, null);
265     }
266 
267     @Override
268     public <T> void setContextValue(T o, String name) {
269         delegateContext.setContextValue(o, name);
270     }
271 
272     /*-----------------------------------------------------------------------*/
273     /*---------------------------- Event methods ----------------------------*/
274     /*-----------------------------------------------------------------------*/
275 
276     public void doActionPerformed__on__newButton(ActionEvent event) {
277         if (log.isDebugEnabled()) {
278             log.debug(event);
279         }
280         model.addNewRow();
281     }
282 
283     /*-----------------------------------------------------------------------*/
284     /*----------------------- Public acessor methods  -----------------------*/
285     /*-----------------------------------------------------------------------*/
286 
287     public JButton getActivateButton() {
288         return activateButton;
289     }
290 
291     public DaliHelpBroker getBroker() {
292         return broker;
293     }
294 
295     public JButton getDeleteButton() {
296         return deleteButton;
297     }
298 
299     public JButton getDuplicateButton() {
300         return duplicateButton;
301     }
302 
303     public JButton getExportButton() {
304         return exportButton;
305     }
306 
307     public ManageContextsListTableUIHandler getHandler() {
308         return handler;
309     }
310 
311     public JButton getImportButton() {
312         return importButton;
313     }
314 
315     public SwingTable getManageContextsListTable() {
316         return manageContextsListTable;
317     }
318 
319     public JPanel getManageContextsListTablePanelButtons() {
320         return manageContextsListTablePanelButtons;
321     }
322 
323     public ManageContextsListTableUIModel getModel() {
324         return model;
325     }
326 
327     public JButton getNewButton() {
328         return newButton;
329     }
330 
331     /*-----------------------------------------------------------------------*/
332     /*---------------------------- Other methods ----------------------------*/
333     /*-----------------------------------------------------------------------*/
334 
335     @Override
336     public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
337         broker.installUI(component, helpId);
338     }
339 
340     @Override
341     public void showHelp(String helpId) {
342         getBroker().showHelp(this, helpId);
343     }
344 
345     /*-----------------------------------------------------------------------*/
346     /*--------------------- Protected acessors methods  ---------------------*/
347     /*-----------------------------------------------------------------------*/
348 
349     protected JPanel get$JPanel0() {
350         return $JPanel0;
351     }
352 
353     protected JPanel get$JPanel1() {
354         return $JPanel1;
355     }
356 
357     protected JScrollPane get$JScrollPane0() {
358         return $JScrollPane0;
359     }
360 
361     /*-----------------------------------------------------------------------*/
362     /*--------------------- Components creation methods ---------------------*/
363     /*-----------------------------------------------------------------------*/
364 
365     protected void addChildrenToManageContextsListMainTable() {
366         if (!allComponentsCreated) {
367             return;
368         }
369         add($JScrollPane0, BorderLayout.CENTER);
370         add(manageContextsListTablePanelButtons, BorderLayout.PAGE_END);
371     }
372 
373     protected void addChildrenToManageContextsListTablePanelButtons() {
374         if (!allComponentsCreated) {
375             return;
376         }
377         manageContextsListTablePanelButtons.add($JPanel0, BorderLayout.LINE_START);
378         manageContextsListTablePanelButtons.add($JPanel1, BorderLayout.LINE_END);
379     }
380 
381     protected void createActivateButton() {
382         $objectMap.put("activateButton", activateButton = new JButton());
383         
384         activateButton.setName("activateButton");
385         activateButton.setText(t("dali.context.contextsList.activate"));
386         activateButton.setToolTipText(t("dali.context.contextsList.activate.tip"));
387         activateButton.putClientProperty("applicationAction", ActivateContextAction.class);
388     }
389 
390     protected void createBroker() {
391         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
392     }
393 
394     protected void createDeleteButton() {
395         $objectMap.put("deleteButton", deleteButton = new JButton());
396         
397         deleteButton.setName("deleteButton");
398         deleteButton.setText(t("dali.common.delete"));
399         deleteButton.setToolTipText(t("dali.common.delete"));
400         deleteButton.putClientProperty("applicationAction", DeleteContextAction.class);
401     }
402 
403     protected void createDuplicateButton() {
404         $objectMap.put("duplicateButton", duplicateButton = new JButton());
405         
406         duplicateButton.setName("duplicateButton");
407         duplicateButton.setText(t("dali.action.duplicate.label"));
408         duplicateButton.setToolTipText(t("dali.action.duplicate.tip"));
409         duplicateButton.putClientProperty("applicationAction", DuplicateContextAction.class);
410     }
411 
412     protected void createExportButton() {
413         $objectMap.put("exportButton", exportButton = new JButton());
414         
415         exportButton.setName("exportButton");
416         exportButton.setText(t("dali.common.export"));
417         exportButton.setToolTipText(t("dali.context.contextsList.export.tip"));
418         exportButton.putClientProperty("applicationAction", ExportContextAction.class);
419     }
420 
421     protected ManageContextsListTableUIHandler createHandler() {
422         return new ManageContextsListTableUIHandler();
423     }
424 
425     protected void createImportButton() {
426         $objectMap.put("importButton", importButton = new JButton());
427         
428         importButton.setName("importButton");
429         importButton.setText(t("dali.common.import"));
430         importButton.setToolTipText(t("dali.context.contextsList.import.tip"));
431         importButton.putClientProperty("applicationAction", ImportContextAction.class);
432     }
433 
434     protected void createManageContextsListTable() {
435         $objectMap.put("manageContextsListTable", manageContextsListTable = new SwingTable());
436         
437         manageContextsListTable.setName("manageContextsListTable");
438     }
439 
440     protected void createManageContextsListTablePanelButtons() {
441         $objectMap.put("manageContextsListTablePanelButtons", manageContextsListTablePanelButtons = new JPanel());
442         
443         manageContextsListTablePanelButtons.setName("manageContextsListTablePanelButtons");
444         manageContextsListTablePanelButtons.setLayout(new BorderLayout());
445     }
446 
447     protected void createModel() {
448         $objectMap.put("model", model = getContextValue(ManageContextsListTableUIModel.class));
449     }
450 
451     protected void createNewButton() {
452         $objectMap.put("newButton", newButton = new JButton());
453         
454         newButton.setName("newButton");
455         newButton.setText(t("dali.common.new"));
456         newButton.setToolTipText(t("dali.common.new"));
457         newButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__newButton"));
458     }
459 
460     /*-----------------------------------------------------------------------*/
461     /*------------------------ Internal jaxx methods ------------------------*/
462     /*-----------------------------------------------------------------------*/
463 
464     private void $completeSetup() {
465         allComponentsCreated = true;
466         if (log.isDebugEnabled()) {
467             log.debug(this);
468         }
469         addChildrenToManageContextsListMainTable();
470         // inline complete setup of $JScrollPane0
471         $JScrollPane0.getViewport().add(manageContextsListTable);
472         addChildrenToManageContextsListTablePanelButtons();
473         // inline complete setup of $JPanel0
474         $JPanel0.add(newButton);
475         $JPanel0.add(duplicateButton);
476         $JPanel0.add(deleteButton);
477         // inline complete setup of $JPanel1
478         $JPanel1.add(activateButton);
479         $JPanel1.add(importButton);
480         $JPanel1.add(exportButton);
481         
482         // apply 4 data bindings
483         JAXXUtil.applyDataBinding(this, $bindings.keySet());
484         
485         // apply 15 property setters
486         newButton.setAlignmentX(Component.CENTER_ALIGNMENT);
487         duplicateButton.setAlignmentX(Component.CENTER_ALIGNMENT);
488         deleteButton.setAlignmentX(Component.CENTER_ALIGNMENT);
489         activateButton.setAlignmentX(Component.CENTER_ALIGNMENT);
490         importButton.setAlignmentX(Component.CENTER_ALIGNMENT);
491         exportButton.setAlignmentX(Component.CENTER_ALIGNMENT);
492         setBorder(BorderFactory.createTitledBorder(t("dali.context.contextsList.title")));
493         newButton.setIcon(SwingUtil.createActionIcon("add"));
494         duplicateButton.setIcon(SwingUtil.createActionIcon("copy"));
495         deleteButton.setIcon(SwingUtil.createActionIcon("delete"));
496         activateButton.setIcon(SwingUtil.createActionIcon("activer"));
497         importButton.setIcon(SwingUtil.createActionIcon("import"));
498         exportButton.setIcon(SwingUtil.createActionIcon("export"));
499     }
500 
501     private void $initialize() {
502         if (allComponentsCreated) {
503             return;
504         }
505         if (log.isDebugEnabled()) {
506             log.debug(this);
507         }
508         handler.beforeInit(this);
509         $objectMap.put("manageContextsListMainTable", manageContextsListMainTable);
510         createModel();
511         createBroker();
512         // inline creation of $JScrollPane0
513         $objectMap.put("$JScrollPane0", $JScrollPane0 = new JScrollPane());
514         
515         $JScrollPane0.setName("$JScrollPane0");
516         createManageContextsListTable();
517         createManageContextsListTablePanelButtons();
518         // inline creation of $JPanel0
519         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
520         
521         $JPanel0.setName("$JPanel0");
522         createNewButton();
523         createDuplicateButton();
524         createDeleteButton();
525         // inline creation of $JPanel1
526         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
527         
528         $JPanel1.setName("$JPanel1");
529         createActivateButton();
530         createImportButton();
531         createExportButton();
532         // inline creation of manageContextsListMainTable
533         setName("manageContextsListMainTable");
534         setLayout(new BorderLayout());
535         
536         // registers 4 data bindings
537         $registerDefaultBindings();
538         $completeSetup();
539         handler.afterInit(this);
540     }
541 
542     private void $registerDefaultBindings() {
543         // register 4 data bindings
544         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DUPLICATE_BUTTON_ENABLED, true) {
545         
546             @Override
547             public void applyDataBinding() {
548                 if (model != null) {
549                     model.addPropertyChangeListener("selectedRows", this);
550                 }
551             }
552         
553             @Override
554             public void processDataBinding() {
555                 if (model != null && model.getSelectedRows() != null) {
556                     duplicateButton.setEnabled(model.getSelectedRows().size() == 1);
557                 }
558             }
559         
560             @Override
561             public void removeDataBinding() {
562                 if (model != null) {
563                     model.removePropertyChangeListener("selectedRows", this);
564                 }
565             }
566         });
567         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_BUTTON_ENABLED, true) {
568         
569             @Override
570             public void applyDataBinding() {
571                 if (model != null) {
572                     model.addPropertyChangeListener("selectedRows", this);
573                 }
574             }
575         
576             @Override
577             public void processDataBinding() {
578                 if (model != null && model.getSelectedRows() != null) {
579                     deleteButton.setEnabled(!model.getSelectedRows().isEmpty());
580                 }
581             }
582         
583             @Override
584             public void removeDataBinding() {
585                 if (model != null) {
586                     model.removePropertyChangeListener("selectedRows", this);
587                 }
588             }
589         });
590         registerDataBinding(new DefaultJAXXBinding(this, BINDING_ACTIVATE_BUTTON_ENABLED, true) {
591         
592             @Override
593             public void applyDataBinding() {
594                 if (model != null) {
595                     model.addPropertyChangeListener("selectedRows", this);
596                 }
597             }
598         
599             @Override
600             public void processDataBinding() {
601                 if (model != null && model.getSelectedRows() != null) {
602                     activateButton.setEnabled(!model.getSelectedRows().isEmpty());
603                 }
604             }
605         
606             @Override
607             public void removeDataBinding() {
608                 if (model != null) {
609                     model.removePropertyChangeListener("selectedRows", this);
610                 }
611             }
612         });
613         registerDataBinding(new DefaultJAXXBinding(this, BINDING_EXPORT_BUTTON_ENABLED, true) {
614         
615             @Override
616             public void applyDataBinding() {
617                 if (model != null) {
618                     model.addPropertyChangeListener("selectedRows", this);
619                 }
620             }
621         
622             @Override
623             public void processDataBinding() {
624                 if (model != null && model.getSelectedRows() != null) {
625                     exportButton.setEnabled(!model.getSelectedRows().isEmpty());
626                 }
627             }
628         
629             @Override
630             public void removeDataBinding() {
631                 if (model != null) {
632                     model.removePropertyChangeListener("selectedRows", this);
633                 }
634             }
635         });
636     }
637 
638 }