View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.program.strategies;
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.plaf.WaitBlockingLayerUI;
9   import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
10  import java.awt.BorderLayout;
11  import java.awt.Component;
12  import java.awt.Container;
13  import java.awt.GridBagConstraints;
14  import java.awt.Insets;
15  import java.awt.event.ActionEvent;
16  import java.awt.event.ActionListener;
17  import java.util.ArrayList;
18  import java.util.HashMap;
19  import java.util.List;
20  import java.util.Map;
21  import java.util.TreeMap;
22  import javax.swing.BorderFactory;
23  import javax.swing.Box;
24  import javax.swing.BoxLayout;
25  import javax.swing.JButton;
26  import javax.swing.JPanel;
27  import javax.swing.JScrollPane;
28  import jaxx.runtime.JAXXBinding;
29  import jaxx.runtime.JAXXContext;
30  import jaxx.runtime.JAXXObject;
31  import jaxx.runtime.JAXXObjectDescriptor;
32  import jaxx.runtime.JAXXUtil;
33  import jaxx.runtime.SwingUtil;
34  import jaxx.runtime.binding.DefaultJAXXBinding;
35  import jaxx.runtime.context.DefaultJAXXContext;
36  import jaxx.runtime.swing.Table;
37  import jaxx.runtime.swing.help.JAXXHelpUI;
38  import org.apache.commons.logging.Log;
39  import org.apache.commons.logging.LogFactory;
40  import static org.nuiton.i18n.I18n.t;
41  
42  public class StrategiesTableUI extends Table implements JAXXHelpUI<DaliHelpBroker>, DaliUI<StrategiesTableUIModel, StrategiesTableUIHandler>, JAXXObject {
43  
44      /*-----------------------------------------------------------------------*/
45      /*------------------ Constants for all public bindings ------------------*/
46      /*-----------------------------------------------------------------------*/
47  
48      public static final String BINDING_DUPLICATE_STRATEGY_BUTTON_ENABLED = "duplicateStrategyButton.enabled";
49      public static final String BINDING_NEW_STRATEGY_BUTTON_ENABLED = "newStrategyButton.enabled";
50      public static final String BINDING_REMOVE_STRATEGY_BUTTON_ENABLED = "removeStrategyButton.enabled";
51      public static final String BINDING_STRATEGIES_TABLE_EDITABLE = "strategiesTable.editable";
52      public static final String BINDING_TABLE_BLOCK_LAYER_BLOCK = "tableBlockLayer.block";
53  
54      /*-----------------------------------------------------------------------*/
55      /*------------------------- Other static fields -------------------------*/
56      /*-----------------------------------------------------------------------*/
57  
58      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAK1Wz28bRRSeuLbzi5C26S+UBBxTBUeCcStQL6HQJiFqIreFOhURPsB4d+JMO7sznZ1t7EZF3LjyJ8CdCxI3TogDZw5cEP8CQj1wRbyZtXe9zjpxFXxYree99733fTPvzX7/FyoECi09Iu02VqGvmUfx9u3d3fvNR9TRGzRwFJNaKBT9xnIo10DTbrweaPRmo2bCq93w6rrwpPCp3xe9WkNTge5wGuxTqjVaTEc4QVCtx+bVtgxVDzUuKgv12xd/575xv/ouh1BbQnXTQKV0UlTCJF9DOeZqdB4yPSVVTvwWlKGY34J6Z8zaOidBcI949An6Eo3XUFESBWAalUenbDFsfFtqNKVJk9OPiU+5RrU9hdmeoh5V2CWc4ZDh4ADyY0f4GuCwR3zSolgq0VLEw4FWRNMWowGux687BvHhlpQ2S1GjgidcA//J/wl/12AmOYpNJR5TpdFbQ5NswL87ELNmPZPQWSvBGhfO4xrpGIwbfRhPQuIq1qLvJkCSkz38KWHaxsCKDetnHEHWHSU4N9pqdNlsX7sLsJ1YTMBkEhekaWqEjy/F5sF1824DDM7FGG7i6rbd2WtwplL57Wo6dc/3uvm/aB7zse2cTw+6G9BZC7WG3UJzKcBo1bi/HkdddkPJmQNR6VhjLqddLwBB8fQYP4XmU30EHYqTDk1aaKyBCiqEZY2uNI429QMwRe18ZaCdDaC1/ntp7vef/vxxs9fDM5D7YqZr3wiC3oIzK+HsMJN6NmrgUDNevUvkagNNBpTD/LLzaSGjsHrXDMVBvnMmHJtwfIcE+wBRGP/j518uffHbGZTbRFNcEHeTGP8tNKn3FagguNuWH96yFb1yMAHPs6Y20xhCueZQbxyu2bcosIMdRUHsHaY5dSNLRVfKtmUG+q+DtfEqr6w8b4N0CxnSxfU3J3/9Z67+w62efGNA57Wh7omEhc9Qkfmc+dQOwe58yxx60zKgoSuSOZY12VBqtMlua75tn9eydJqgLtNRz104tAMLs+Cj7lrFMDeh71lK5u0GOtquJ6XJQ1GgPhP+lpl46AxxYdznNW3DCJ+10jvC84SPoeE0mtZC8B0md6x9MXtrwBO2Byb5OPVNDQBYieuvwUGhbmWltLxcGpHT0V5/WVZFyEM1jYmd7yfWs6W5lbK5Rc6D9O6NSM+sLkXLLaqjI0fdB+IgqKwYR0/qzhARMufRSToUgOrnREYzD9S4bTXR6I3DjcFBGJmwYw7s8wH58o6QnVi8eatMZMfxQMWcNM2NmlaxnO3b18UpHe+/hI7DZAzYM+Nx82bpeqaQw+6Ak7TMwVdD09yucNGkyoTbBvZMo5lm9+5dF1zAdHvncJ/4LodbEopcF/4eA7/oHeypi3pYMw98BowwM4qcdATwQa++7xJNSk3mmwI/OAI/Zp4LIyBOwQ62fA++hXaNT5iNtHQikll+dgzC1VMjLI/AJs+c6Bo/FY+vT83jOATD4z9PYE0KdgwAAA==";
59      private static final Log log = LogFactory.getLog(StrategiesTableUI.class);
60      private static final long serialVersionUID = 1L;
61  
62      /*-----------------------------------------------------------------------*/
63      /*--------------------------- Internal states ---------------------------*/
64      /*-----------------------------------------------------------------------*/
65  
66      protected List<Object> $activeBindings = new ArrayList<Object>();
67      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
68      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
69      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
70      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
71      private boolean allComponentsCreated;
72      protected final JAXXContext delegateContext = new DefaultJAXXContext();
73  
74      /*-----------------------------------------------------------------------*/
75      /*------------------------ Protected components  ------------------------*/
76      /*-----------------------------------------------------------------------*/
77  
78      protected DaliHelpBroker broker;
79      protected JButton duplicateStrategyButton;
80      protected final StrategiesTableUIHandler handler = createHandler();
81      protected StrategiesTableUIModel model;
82      protected JButton newStrategyButton;
83      protected JButton removeStrategyButton;
84      protected SwingTable strategiesTable;
85      protected WaitBlockingLayerUI tableBlockLayer;
86      protected StrategiesTableUI tablePanel = this;
87      protected JScrollPane tableScrollPane;
88  
89      /*-----------------------------------------------------------------------*/
90      /*------------------------- Private components  -------------------------*/
91      /*-----------------------------------------------------------------------*/
92  
93      private JPanel $JPanel0;
94      private JPanel $JPanel1;
95  
96      /*-----------------------------------------------------------------------*/
97      /*---------------------------- Constructors  ----------------------------*/
98      /*-----------------------------------------------------------------------*/
99  
100     public StrategiesTableUI(ApplicationUI parentUI) {
101         ApplicationUIUtil.setParentUI(this, parentUI);
102             $initialize();
103     }
104 
105     public StrategiesTableUI() {
106         $initialize();
107     }
108 
109     public StrategiesTableUI(JAXXContext parentContext) {
110         JAXXUtil.initContext(this, parentContext);
111         $initialize();
112     }
113 
114     /*-----------------------------------------------------------------------*/
115     /*--------------------------- Statics methods ---------------------------*/
116     /*-----------------------------------------------------------------------*/
117 
118     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
119         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
120     }
121 
122     /*-----------------------------------------------------------------------*/
123     /*---------------------- JAXXObject implementation ----------------------*/
124     /*-----------------------------------------------------------------------*/
125 
126     @Override
127     public void applyDataBinding(String $binding) {
128         if (allComponentsCreated && $bindings.containsKey($binding)) {
129             getDataBinding($binding).applyDataBinding();
130         }
131         processDataBinding($binding);
132     }
133 
134     @Override
135     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
136         super.firePropertyChange(propertyName, oldValue, newValue);
137     }
138 
139     @Override
140     public Map<String, Object> get$objectMap() {
141         return $objectMap;
142     }
143 
144     @Override
145     public JAXXBinding getDataBinding(String bindingId) {
146         return $bindings.get(bindingId);
147     }
148 
149     @Override
150     public JAXXBinding[] getDataBindings() {
151         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
152     }
153 
154     @Override
155     public Object getObjectById(String id) {
156         return $objectMap.get(id);
157     }
158 
159     @Override
160     public void processDataBinding(String $binding, boolean $force) {
161         if (!$force && $activeBindings.contains($binding)) { 
162             return;
163         }
164         $activeBindings.add($binding);
165         try {
166             if (allComponentsCreated && $bindings.containsKey($binding)) {
167                 getDataBinding($binding).processDataBinding();
168             }
169         } finally {
170             $activeBindings.remove($binding);
171         }
172     }
173 
174     @Override
175     public void processDataBinding(String $binding) {
176         processDataBinding($binding, false);
177     }
178 
179     @Override
180     public void registerDataBinding(JAXXBinding binding) {
181         $bindings.put(binding.getId(), binding);
182     }
183 
184     @Override
185     public void removeDataBinding(String $binding) {
186         if (allComponentsCreated && $bindings.containsKey($binding)) {
187             getDataBinding($binding).removeDataBinding();
188         }
189     }
190 
191     /*-----------------------------------------------------------------------*/
192     /*--------------------- JAXXContext implementation  ---------------------*/
193     /*-----------------------------------------------------------------------*/
194 
195     @Override
196     public <T> T getContextValue(Class<T> clazz) {
197         return delegateContext.getContextValue(clazz, null);
198     }
199 
200     @Override
201     public <T> T getContextValue(Class<T> clazz, String name) {
202         return delegateContext.getContextValue(clazz, name);
203     }
204 
205     @Override
206     public JAXXContext getDelegateContext() {
207         return delegateContext;
208     }
209 
210     @Override
211     public <O extends Container> O getParentContainer(Class<O> clazz) {
212         return SwingUtil.getParentContainer(this, clazz);
213     }
214 
215     @Override
216     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
217         return SwingUtil.getParentContainer(source, clazz);
218     }
219 
220     @Override
221     public <T> void removeContextValue(Class<T> clazz) {
222         delegateContext.removeContextValue(clazz, null);
223     }
224 
225     @Override
226     public <T> void removeContextValue(Class<T> clazz, String name) {
227         delegateContext.removeContextValue(clazz, name);
228     }
229 
230     @Override
231     public <T> void setContextValue(T o) {
232         delegateContext.setContextValue(o, null);
233     }
234 
235     @Override
236     public <T> void setContextValue(T o, String name) {
237         delegateContext.setContextValue(o, name);
238     }
239 
240     /*-----------------------------------------------------------------------*/
241     /*---------------------------- Event methods ----------------------------*/
242     /*-----------------------------------------------------------------------*/
243 
244     public void doActionPerformed__on__newStrategyButton(ActionEvent event) {
245         if (log.isDebugEnabled()) {
246             log.debug(event);
247         }
248         model.addNewRow();
249     }
250 
251     public void doActionPerformed__on__removeStrategyButton(ActionEvent event) {
252         if (log.isDebugEnabled()) {
253             log.debug(event);
254         }
255         handler.removeStrategies();
256     }
257 
258     /*-----------------------------------------------------------------------*/
259     /*----------------------- Public acessor methods  -----------------------*/
260     /*-----------------------------------------------------------------------*/
261 
262     public DaliHelpBroker getBroker() {
263         return broker;
264     }
265 
266     public JButton getDuplicateStrategyButton() {
267         return duplicateStrategyButton;
268     }
269 
270     public StrategiesTableUIHandler getHandler() {
271         return handler;
272     }
273 
274     public StrategiesTableUIModel getModel() {
275         return model;
276     }
277 
278     public JButton getNewStrategyButton() {
279         return newStrategyButton;
280     }
281 
282     public JButton getRemoveStrategyButton() {
283         return removeStrategyButton;
284     }
285 
286     public SwingTable getStrategiesTable() {
287         return strategiesTable;
288     }
289 
290     public WaitBlockingLayerUI getTableBlockLayer() {
291         return tableBlockLayer;
292     }
293 
294     public JScrollPane getTableScrollPane() {
295         return tableScrollPane;
296     }
297 
298     /*-----------------------------------------------------------------------*/
299     /*---------------------------- Other methods ----------------------------*/
300     /*-----------------------------------------------------------------------*/
301 
302     @Override
303     public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
304         broker.installUI(component, helpId);
305     }
306 
307     @Override
308     public void showHelp(String helpId) {
309         getBroker().showHelp(this, helpId);
310     }
311 
312     /*-----------------------------------------------------------------------*/
313     /*--------------------- Protected acessors methods  ---------------------*/
314     /*-----------------------------------------------------------------------*/
315 
316     protected JPanel get$JPanel0() {
317         return $JPanel0;
318     }
319 
320     protected JPanel get$JPanel1() {
321         return $JPanel1;
322     }
323 
324     /*-----------------------------------------------------------------------*/
325     /*--------------------- Components creation methods ---------------------*/
326     /*-----------------------------------------------------------------------*/
327 
328     protected void addChildrenToTablePanel() {
329         if (!allComponentsCreated) {
330             return;
331         }
332         add(SwingUtil.boxComponentWithJxLayer(tableScrollPane), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
333         add($JPanel0, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
334     }
335 
336     protected void addChildrenToTableScrollPane() {
337         if (!allComponentsCreated) {
338             return;
339         }
340         tableScrollPane.getViewport().add(strategiesTable);
341     }
342 
343     protected void createBroker() {
344         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
345     }
346 
347     protected void createDuplicateStrategyButton() {
348         $objectMap.put("duplicateStrategyButton", duplicateStrategyButton = new JButton());
349         
350         duplicateStrategyButton.setName("duplicateStrategyButton");
351         duplicateStrategyButton.setText(t("dali.action.duplicate.label"));
352         duplicateStrategyButton.setToolTipText(t("dali.action.duplicate.strategy.tip"));
353         duplicateStrategyButton.putClientProperty("applicationAction", DuplicateStrategyAction.class);
354     }
355 
356     protected StrategiesTableUIHandler createHandler() {
357         return new StrategiesTableUIHandler();
358     }
359 
360     protected void createModel() {
361         $objectMap.put("model", model = getContextValue(StrategiesTableUIModel.class));
362     }
363 
364     protected void createNewStrategyButton() {
365         $objectMap.put("newStrategyButton", newStrategyButton = new JButton());
366         
367         newStrategyButton.setName("newStrategyButton");
368         newStrategyButton.setText(t("dali.common.new"));
369         newStrategyButton.setToolTipText(t("dali.program.strategy.new.tip"));
370         newStrategyButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__newStrategyButton"));
371     }
372 
373     protected void createRemoveStrategyButton() {
374         $objectMap.put("removeStrategyButton", removeStrategyButton = new JButton());
375         
376         removeStrategyButton.setName("removeStrategyButton");
377         removeStrategyButton.setText(t("dali.common.delete"));
378         removeStrategyButton.setToolTipText(t("dali.program.strategy.delete.tip"));
379         removeStrategyButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__removeStrategyButton"));
380     }
381 
382     protected void createStrategiesTable() {
383         $objectMap.put("strategiesTable", strategiesTable = new SwingTable());
384         
385         strategiesTable.setName("strategiesTable");
386     }
387 
388     protected void createTableBlockLayer() {
389         $objectMap.put("tableBlockLayer", tableBlockLayer = new WaitBlockingLayerUI());
390     }
391 
392     protected void createTableScrollPane() {
393         $objectMap.put("tableScrollPane", tableScrollPane = new JScrollPane());
394         
395         tableScrollPane.setName("tableScrollPane");
396     }
397 
398     /*-----------------------------------------------------------------------*/
399     /*------------------------ Internal jaxx methods ------------------------*/
400     /*-----------------------------------------------------------------------*/
401 
402     private void $completeSetup() {
403         allComponentsCreated = true;
404         if (log.isDebugEnabled()) {
405             log.debug(this);
406         }
407         addChildrenToTablePanel();
408         addChildrenToTableScrollPane();
409         // inline complete setup of $JPanel0
410         $JPanel0.add($JPanel1, BorderLayout.LINE_START);
411         // inline complete setup of $JPanel1
412         $JPanel1.add(newStrategyButton);
413         $JPanel1.add(duplicateStrategyButton);
414         $JPanel1.add(removeStrategyButton);
415         
416         // apply 5 data bindings
417         JAXXUtil.applyDataBinding(this, $bindings.keySet());
418         
419         // apply 9 property setters
420         newStrategyButton.setAlignmentX(Component.CENTER_ALIGNMENT);
421         duplicateStrategyButton.setAlignmentX(Component.CENTER_ALIGNMENT);
422         removeStrategyButton.setAlignmentX(Component.CENTER_ALIGNMENT);
423         setBorder(BorderFactory.createTitledBorder(t("dali.program.strategy.title")));
424         tableBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
425         newStrategyButton.setIcon(SwingUtil.createActionIcon("add"));
426         duplicateStrategyButton.setIcon(SwingUtil.createActionIcon("copy"));
427         removeStrategyButton.setIcon(SwingUtil.createActionIcon("delete"));
428     }
429 
430     private void $initialize() {
431         if (allComponentsCreated) {
432             return;
433         }
434         if (log.isDebugEnabled()) {
435             log.debug(this);
436         }
437         handler.beforeInit(this);
438         $objectMap.put("tablePanel", tablePanel);
439         createModel();
440         createBroker();
441         createTableBlockLayer();
442         createTableScrollPane();
443         createStrategiesTable();
444         // inline creation of $JPanel0
445         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
446         
447         $JPanel0.setName("$JPanel0");
448         $JPanel0.setLayout(new BorderLayout());
449         // inline creation of $JPanel1
450         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
451         
452         $JPanel1.setName("$JPanel1");
453         createNewStrategyButton();
454         createDuplicateStrategyButton();
455         createRemoveStrategyButton();
456         // inline creation of tablePanel
457         setName("tablePanel");
458         
459         // registers 5 data bindings
460         $registerDefaultBindings();
461         $completeSetup();
462         handler.afterInit(this);
463     }
464 
465     private void $registerDefaultBindings() {
466         // register 5 data bindings
467         registerDataBinding(new DefaultJAXXBinding(this, BINDING_TABLE_BLOCK_LAYER_BLOCK, true) {
468         
469             @Override
470             public void applyDataBinding() {
471                 if (model != null) {
472                     model.addPropertyChangeListener("loading", this);
473                 }
474             }
475         
476             @Override
477             public void processDataBinding() {
478                 if (model != null) {
479                     tableBlockLayer.setBlock(model.isLoading());
480                 }
481             }
482         
483             @Override
484             public void removeDataBinding() {
485                 if (model != null) {
486                     model.removePropertyChangeListener("loading", this);
487                 }
488             }
489         });
490         registerDataBinding(new DefaultJAXXBinding(this, BINDING_STRATEGIES_TABLE_EDITABLE, true) {
491         
492             @Override
493             public void applyDataBinding() {
494                 if (model != null) {
495                     model.addPropertyChangeListener("editable", this);
496                 }
497             }
498         
499             @Override
500             public void processDataBinding() {
501                 if (model != null) {
502                     strategiesTable.setEditable(model.isEditable());
503                 }
504             }
505         
506             @Override
507             public void removeDataBinding() {
508                 if (model != null) {
509                     model.removePropertyChangeListener("editable", this);
510                 }
511             }
512         });
513         registerDataBinding(new DefaultJAXXBinding(this, BINDING_NEW_STRATEGY_BUTTON_ENABLED, true, true) {
514         
515             @Override
516             public void applyDataBinding() {
517                 if (model != null) {
518                     model.addPropertyChangeListener("loaded", this);
519                 }
520                 if (model != null) {
521                     model.addPropertyChangeListener("editable", this);
522                 }
523             }
524         
525             @Override
526             public void processDataBinding() {
527                 if (model != null) {
528                     newStrategyButton.setEnabled(model.isLoaded() && model.isEditable());
529                 }
530             }
531         
532             @Override
533             public void removeDataBinding() {
534                 if (model != null) {
535                     model.removePropertyChangeListener("loaded", this);
536                 }
537                 if (model != null) {
538                     model.removePropertyChangeListener("editable", this);
539                 }
540             }
541         });
542         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DUPLICATE_STRATEGY_BUTTON_ENABLED, true, true) {
543         
544             @Override
545             public void applyDataBinding() {
546                 if (model != null) {
547                     model.addPropertyChangeListener("loaded", this);
548                 }
549                 if (model != null) {
550                     model.addPropertyChangeListener("editable", this);
551                 }
552                 if (model != null) {
553                     model.addPropertyChangeListener("selectedRows", this);
554                 }
555             }
556         
557             @Override
558             public void processDataBinding() {
559                 if (model != null && model.getSelectedRows() != null) {
560                     duplicateStrategyButton.setEnabled(model.isLoaded() && model.isEditable() && model.getSelectedRows().size() == 1);
561                 }
562             }
563         
564             @Override
565             public void removeDataBinding() {
566                 if (model != null) {
567                     model.removePropertyChangeListener("loaded", this);
568                 }
569                 if (model != null) {
570                     model.removePropertyChangeListener("editable", this);
571                 }
572                 if (model != null) {
573                     model.removePropertyChangeListener("selectedRows", this);
574                 }
575             }
576         });
577         registerDataBinding(new DefaultJAXXBinding(this, BINDING_REMOVE_STRATEGY_BUTTON_ENABLED, true, true) {
578         
579             @Override
580             public void applyDataBinding() {
581                 if (model != null) {
582                     model.addPropertyChangeListener("loaded", this);
583                 }
584                 if (model != null) {
585                     model.addPropertyChangeListener("editable", this);
586                 }
587                 if (model != null) {
588                     model.addPropertyChangeListener("selectedRows", this);
589                 }
590             }
591         
592             @Override
593             public void processDataBinding() {
594                 if (model != null && model.getSelectedRows() != null) {
595                     removeStrategyButton.setEnabled(model.isLoaded() && model.isEditable() && !model.getSelectedRows().isEmpty());
596                 }
597             }
598         
599             @Override
600             public void removeDataBinding() {
601                 if (model != null) {
602                     model.removePropertyChangeListener("loaded", this);
603                 }
604                 if (model != null) {
605                     model.removePropertyChangeListener("editable", this);
606                 }
607                 if (model != null) {
608                     model.removePropertyChangeListener("selectedRows", this);
609                 }
610             }
611         });
612     }
613 
614 }