View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.context;
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.reefdb.ui.swing.ReefDbHelpBroker;
30  import fr.ifremer.reefdb.ui.swing.ReefDbUIContext;
31  import fr.ifremer.reefdb.ui.swing.content.ReefDbMainUI;
32  import fr.ifremer.reefdb.ui.swing.content.manage.context.contextslist.ManageContextsListTableUI;
33  import fr.ifremer.reefdb.ui.swing.content.manage.context.filtercontent.ManageFilterContentTableUI;
34  import fr.ifremer.reefdb.ui.swing.content.manage.context.filterslist.ManageFiltersListTableUI;
35  import fr.ifremer.reefdb.ui.swing.content.manage.context.menu.ManageContextsListMenuUI;
36  import fr.ifremer.reefdb.ui.swing.util.ReefDbUI;
37  import java.awt.BorderLayout;
38  import java.awt.Component;
39  import java.awt.Container;
40  import java.awt.FlowLayout;
41  import java.awt.GridBagConstraints;
42  import java.awt.GridLayout;
43  import java.awt.Insets;
44  import java.awt.LayoutManager;
45  import java.util.ArrayList;
46  import java.util.HashMap;
47  import java.util.List;
48  import java.util.Map;
49  import java.util.TreeMap;
50  import javax.swing.BorderFactory;
51  import javax.swing.Box;
52  import javax.swing.BoxLayout;
53  import javax.swing.JButton;
54  import javax.swing.JPanel;
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.JAXXValidator;
61  import jaxx.runtime.SwingUtil;
62  import jaxx.runtime.binding.DefaultJAXXBinding;
63  import jaxx.runtime.context.DefaultJAXXContext;
64  import jaxx.runtime.swing.Table;
65  import jaxx.runtime.swing.help.JAXXHelpUI;
66  import jaxx.runtime.validator.swing.SwingValidator;
67  import jaxx.runtime.validator.swing.SwingValidatorUtil;
68  import jaxx.runtime.validator.swing.meta.Validator;
69  import jaxx.runtime.validator.swing.meta.ValidatorField;
70  import jaxx.runtime.validator.swing.ui.ImageValidationUI;
71  import org.apache.commons.logging.Log;
72  import org.apache.commons.logging.LogFactory;
73  import static org.nuiton.i18n.I18n.t;
74  
75  public class ManageContextsUI extends JPanel implements JAXXHelpUI<ReefDbHelpBroker>, ReefDbUI<ManageContextsUIModel, ManageContextsUIHandler>, JAXXObject, JAXXValidator {
76  
77      /*-----------------------------------------------------------------------*/
78      /*------------------ Constants for all public bindings ------------------*/
79      /*-----------------------------------------------------------------------*/
80  
81      public static final String BINDING_SAVE_BUTTON_ENABLED = "saveButton.enabled";
82  
83      /*-----------------------------------------------------------------------*/
84      /*------------------------- Other static fields -------------------------*/
85      /*-----------------------------------------------------------------------*/
86  
87      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKVWS29bRRQeG9upbSiQkColRUpDWyU8rgEJoSoImrgJTbHbKk6jqF7A+N5xMuW+mJmbXssK4ifwE2DPBokdK8SCNQs2iL+AEAu2FWdm7sO3vnEcEiljz8w53/nOnJnv+Pu/UJkzdPUxDkODBa6gDjHuru/v3+89Jqa4TbjJqC88hvRfoYiKXVS3knUu0OvdlnRvRO6Npuf4nkvcEe+1FqpxMbAJPyRECPRa1sPkvNFJttdCP2AxakIqD/Xbf/4ufmN9/V0RodAHdhchlaXTvNJMSi1UpJZAsxDpCDds7B4ADUbdA+D7glxr2pjze9ghX6Kv0EwLVXzMAEyg5elTVhjKP/QFunDt7gPsEvsdgTb6zKB9RhzCDEZI3+oZATX4E4hvmJ4rAM5wsIsPiJ6GwmiraVPP+MNt31fIFYHKjmcRW6BPzg/alkgpcqXHvC8IE+jNCdA7ML/duwN+G8o6da8eYZtaGE4EEDK1STYijI4c9+LFFGHByRBsUS7axA0ebgt0/+zZOuD6TMopooxYTQLHtXoXroi8DWGErFeztjPXdnHPJlDWhUyS2kPtScuFxOGV8axkRvtnzyj65DZA5GSmYuvUFlO6fWoLwtT01ezWnIbf0gYxr72z84pCjNAawRxhdTUJPT8auqlRZfBH/zd4vNkex80lEFf8veRc0oLVTdvjZCMQAgDQXOZC6FVpuJrY1zg+IunG29EuQ4uZCwLaZ6Tal4pToYvKLIBluFHdcbncgS0tlAvPCKUEVLtPL839/tOfP27F6liH2PO5piPiDqrlM8+H905l6Be1NAaC2o029te6qMqJDZ1BKf+VHGKdaBvIQbyXpbsh3Y07mB8CRHnmj59/ufT5b8+h4haq2R62trC030ZVccjgFDzbCv2PbylGzz+5AONL8F+CN/gZ9n2bmlhQz1035Qh1GDZlWfTUMKXWHsPZYzXflvVHFRO7ptTG+XGAT8lAoJvDCfdLcdfyBsbQHkDeuNFcv9fcbEGkkrxtQCNyMz3HUTyAUwjFuZJTnOSEetVf/53r/HArLlABDuzyieZpkcqPUIW6NnWJamBRb8ptWHWfk8Dy0h6U15VQ9nL7kfS+r8abY6WonFCK2WEHbvykSpTkkzi5Dh+cvQ6d9b3NtAqz2SroaHXhefYu9XeVyWJkomkpk0RAQRaJK2UBfhNcH6qGalAO7ZD2ByurSzduLMVrqkutrB6HgTyipqqd/LaJMu/+tJMsyO7qMUt2153hhvqmX8PAMBnBguxSAXT0zopYWU4SzEq/VNRYbw0hfZZX89nFwj8NNRsPPMgDXfwQOjJe6lHXgkp8NAZbkGPtVES53JODmY9w+dwIy+dGeGOKc6lB8Q9c+B0h9icgvTUVFzEBoTEFlxI1dXs5F4vjU1j8B6Q2x14mDAAA";
88      private static final Log log = LogFactory.getLog(ManageContextsUI.class);
89      private static final long serialVersionUID = 1L;
90  
91      /*-----------------------------------------------------------------------*/
92      /*--------------------------- Internal states ---------------------------*/
93      /*-----------------------------------------------------------------------*/
94  
95      protected List<Object> $activeBindings = new ArrayList<Object>();
96      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
97      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
98      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
99      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
100     private boolean allComponentsCreated;
101     protected final JAXXContext delegateContext = new DefaultJAXXContext();
102 
103     /*-----------------------------------------------------------------------*/
104     /*------------------------ Protected components  ------------------------*/
105     /*-----------------------------------------------------------------------*/
106 
107     protected ReefDbHelpBroker broker;
108     protected JButton closeButton;
109     protected JPanel filters;
110     protected final ManageContextsUIHandler handler = createHandler();
111     protected ManageContextsListMenuUI manageContextsListMenuUI;
112     @ValidatorField( validatorId = "validator",  propertyName = "contextListModel",  editorName = "manageContextsListUI")
113     protected ManageContextsListTableUI manageContextsListUI;
114     protected ManageFilterContentTableUI manageFilterContentUI;
115     protected ManageFiltersListTableUI manageFiltersListUI;
116     protected ManageContextsUIModel model;
117     protected JButton saveButton;
118     @Validator( validatorId = "validator")
119     protected SwingValidator<ManageContextsUIModel> validator;
120     protected List<String> validatorIds = new ArrayList<String>();
121 
122     /*-----------------------------------------------------------------------*/
123     /*------------------------- Private components  -------------------------*/
124     /*-----------------------------------------------------------------------*/
125 
126     private ManageContextsUI $JPanel0 = this;
127     private JPanel $JPanel1;
128     private JPanel $JPanel2;
129     private Table $Table0;
130 
131     /*-----------------------------------------------------------------------*/
132     /*---------------------------- Constructors  ----------------------------*/
133     /*-----------------------------------------------------------------------*/
134 
135     public ManageContextsUI(ReefDbMainUI parentUI) {
136         ApplicationUIUtil.setParentUI(this, parentUI);
137             $initialize();
138     }
139 
140     public ManageContextsUI(LayoutManager param0, boolean param1) {
141         super(param0 ,param1);
142         $initialize();
143     }
144 
145     public ManageContextsUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
146         super(param1 ,param2);
147         JAXXUtil.initContext(this, parentContext);
148         $initialize();
149     }
150 
151     public ManageContextsUI(boolean param0) {
152         super(param0);
153         $initialize();
154     }
155 
156     public ManageContextsUI(JAXXContext parentContext, boolean param1) {
157         super(param1);
158         JAXXUtil.initContext(this, parentContext);
159         $initialize();
160     }
161 
162     public ManageContextsUI() {
163         $initialize();
164     }
165 
166     public ManageContextsUI(JAXXContext parentContext) {
167         JAXXUtil.initContext(this, parentContext);
168         $initialize();
169     }
170 
171     public ManageContextsUI(LayoutManager param0) {
172         super(param0);
173         $initialize();
174     }
175 
176     public ManageContextsUI(JAXXContext parentContext, LayoutManager param1) {
177         super(param1);
178         JAXXUtil.initContext(this, parentContext);
179         $initialize();
180     }
181 
182     /*-----------------------------------------------------------------------*/
183     /*--------------------------- Statics methods ---------------------------*/
184     /*-----------------------------------------------------------------------*/
185 
186     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
187         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
188     }
189 
190     /*-----------------------------------------------------------------------*/
191     /*---------------------- JAXXObject implementation ----------------------*/
192     /*-----------------------------------------------------------------------*/
193 
194     @Override
195     public void applyDataBinding(String $binding) {
196         if (allComponentsCreated && $bindings.containsKey($binding)) {
197             getDataBinding($binding).applyDataBinding();
198         }
199         processDataBinding($binding);
200     }
201 
202     @Override
203     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
204         super.firePropertyChange(propertyName, oldValue, newValue);
205     }
206 
207     @Override
208     public Map<String, Object> get$objectMap() {
209         return $objectMap;
210     }
211 
212     @Override
213     public JAXXBinding getDataBinding(String bindingId) {
214         return $bindings.get(bindingId);
215     }
216 
217     @Override
218     public JAXXBinding[] getDataBindings() {
219         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
220     }
221 
222     @Override
223     public Object getObjectById(String id) {
224         return $objectMap.get(id);
225     }
226 
227     @Override
228     public void processDataBinding(String $binding, boolean $force) {
229         if (!$force && $activeBindings.contains($binding)) { 
230             return;
231         }
232         $activeBindings.add($binding);
233         try {
234             if (allComponentsCreated && $bindings.containsKey($binding)) {
235                 getDataBinding($binding).processDataBinding();
236             }
237         } finally {
238             $activeBindings.remove($binding);
239         }
240     }
241 
242     @Override
243     public void processDataBinding(String $binding) {
244         processDataBinding($binding, false);
245     }
246 
247     @Override
248     public void registerDataBinding(JAXXBinding binding) {
249         $bindings.put(binding.getId(), binding);
250     }
251 
252     @Override
253     public void removeDataBinding(String $binding) {
254         if (allComponentsCreated && $bindings.containsKey($binding)) {
255             getDataBinding($binding).removeDataBinding();
256         }
257     }
258 
259     /*-----------------------------------------------------------------------*/
260     /*--------------------- JAXXContext implementation  ---------------------*/
261     /*-----------------------------------------------------------------------*/
262 
263     @Override
264     public <T> T getContextValue(Class<T> clazz) {
265         return delegateContext.getContextValue(clazz, null);
266     }
267 
268     @Override
269     public <T> T getContextValue(Class<T> clazz, String name) {
270         return delegateContext.getContextValue(clazz, name);
271     }
272 
273     @Override
274     public JAXXContext getDelegateContext() {
275         return delegateContext;
276     }
277 
278     @Override
279     public <O extends Container> O getParentContainer(Class<O> clazz) {
280         return SwingUtil.getParentContainer(this, clazz);
281     }
282 
283     @Override
284     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
285         return SwingUtil.getParentContainer(source, clazz);
286     }
287 
288     @Override
289     public <T> void removeContextValue(Class<T> clazz) {
290         delegateContext.removeContextValue(clazz, null);
291     }
292 
293     @Override
294     public <T> void removeContextValue(Class<T> clazz, String name) {
295         delegateContext.removeContextValue(clazz, name);
296     }
297 
298     @Override
299     public <T> void setContextValue(T o) {
300         delegateContext.setContextValue(o, null);
301     }
302 
303     @Override
304     public <T> void setContextValue(T o, String name) {
305         delegateContext.setContextValue(o, name);
306     }
307 
308     /*-----------------------------------------------------------------------*/
309     /*-------------------- JAXXValidator implementation  --------------------*/
310     /*-----------------------------------------------------------------------*/
311 
312     @Override
313     public SwingValidator<?> getValidator(String validatorId) {
314         return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
315     }
316 
317     @Override
318     public List<String> getValidatorIds() {
319         return validatorIds;
320     }
321 
322     @Override
323     public void registerValidatorFields() {
324         SwingValidatorUtil.detectValidatorFields(this);
325     }
326 
327     /*-----------------------------------------------------------------------*/
328     /*----------------------- Public acessor methods  -----------------------*/
329     /*-----------------------------------------------------------------------*/
330 
331     public ReefDbHelpBroker getBroker() {
332         return broker;
333     }
334 
335     public JButton getCloseButton() {
336         return closeButton;
337     }
338 
339     public JPanel getFilters() {
340         return filters;
341     }
342 
343     public ManageContextsUIHandler getHandler() {
344         return handler;
345     }
346 
347     public ManageContextsListMenuUI getManageContextsListMenuUI() {
348         return manageContextsListMenuUI;
349     }
350 
351     public ManageContextsListTableUI getManageContextsListUI() {
352         return manageContextsListUI;
353     }
354 
355     public ManageFilterContentTableUI getManageFilterContentUI() {
356         return manageFilterContentUI;
357     }
358 
359     public ManageFiltersListTableUI getManageFiltersListUI() {
360         return manageFiltersListUI;
361     }
362 
363     public ManageContextsUIModel getModel() {
364         return model;
365     }
366 
367     public JButton getSaveButton() {
368         return saveButton;
369     }
370 
371     public SwingValidator<ManageContextsUIModel> getValidator() {
372         return validator;
373     }
374 
375     /*-----------------------------------------------------------------------*/
376     /*---------------------------- Other methods ----------------------------*/
377     /*-----------------------------------------------------------------------*/
378 
379     @Override
380     public void registerHelpId(ReefDbHelpBroker broker, Component component, String helpId) {
381         broker.installUI(component, helpId);
382     }
383 
384     @Override
385     public void showHelp(String helpId) {
386         getBroker().showHelp(this, helpId);
387     }
388 
389     /*-----------------------------------------------------------------------*/
390     /*--------------------- Protected acessors methods  ---------------------*/
391     /*-----------------------------------------------------------------------*/
392 
393     protected JPanel get$JPanel1() {
394         return $JPanel1;
395     }
396 
397     protected JPanel get$JPanel2() {
398         return $JPanel2;
399     }
400 
401     protected Table get$Table0() {
402         return $Table0;
403     }
404 
405     /*-----------------------------------------------------------------------*/
406     /*--------------------- Components creation methods ---------------------*/
407     /*-----------------------------------------------------------------------*/
408 
409     protected void addChildrenToFilters() {
410         if (!allComponentsCreated) {
411             return;
412         }
413         filters.add(manageFiltersListUI);
414         filters.add(manageFilterContentUI);
415     }
416 
417     protected void addChildrenToValidator() {
418         if (!allComponentsCreated) {
419             return;
420         }
421         validator.setUiClass(ImageValidationUI.class);
422         validator.setBean(model);
423     }
424 
425     protected void createBroker() {
426         $objectMap.put("broker", broker = new ReefDbHelpBroker("reefdb.home.help"));
427     }
428 
429     protected void createCloseButton() {
430         $objectMap.put("closeButton", closeButton = new JButton());
431         
432         closeButton.setName("closeButton");
433         closeButton.setText(t("reefdb.common.close"));
434         closeButton.putClientProperty("applicationActionKey", fr.ifremer.reefdb.ui.swing.util.ReefDbKeyStrokes.CANCEL);
435         closeButton.putClientProperty("applicationAction", CloseAction.class);
436     }
437 
438     protected void createFilters() {
439         $objectMap.put("filters", filters = new JPanel());
440         
441         filters.setName("filters");
442         filters.setLayout(new GridLayout(0,1));
443     }
444 
445     protected ManageContextsUIHandler createHandler() {
446         return new ManageContextsUIHandler();
447     }
448 
449     protected void createManageContextsListMenuUI() {
450         $objectMap.put("manageContextsListMenuUI", manageContextsListMenuUI = new ManageContextsListMenuUI(this));
451         
452         manageContextsListMenuUI.setName("manageContextsListMenuUI");
453     }
454 
455     protected void createManageContextsListUI() {
456         $objectMap.put("manageContextsListUI", manageContextsListUI = new ManageContextsListTableUI(this));
457         
458         manageContextsListUI.setName("manageContextsListUI");
459     }
460 
461     protected void createManageFilterContentUI() {
462         $objectMap.put("manageFilterContentUI", manageFilterContentUI = new ManageFilterContentTableUI(this));
463         
464         manageFilterContentUI.setName("manageFilterContentUI");
465     }
466 
467     protected void createManageFiltersListUI() {
468         $objectMap.put("manageFiltersListUI", manageFiltersListUI = new ManageFiltersListTableUI(this));
469         
470         manageFiltersListUI.setName("manageFiltersListUI");
471     }
472 
473     protected void createModel() {
474         $objectMap.put("model", model = getContextValue(ManageContextsUIModel.class));
475     }
476 
477     protected void createSaveButton() {
478         $objectMap.put("saveButton", saveButton = new JButton());
479         
480         saveButton.setName("saveButton");
481         saveButton.setText(t("reefdb.common.save"));
482         saveButton.setToolTipText(t("reefdb.action.save.contexts"));
483         saveButton.putClientProperty("applicationActionKey", fr.ifremer.reefdb.ui.swing.util.ReefDbKeyStrokes.SAVE);
484         saveButton.putClientProperty("applicationAction", SaveAction.class);
485     }
486 
487     protected void createValidator() {
488         $objectMap.put("validator", validator = SwingValidator.newValidator(ManageContextsUIModel.class, null));
489     }
490 
491     /*-----------------------------------------------------------------------*/
492     /*------------------------ Internal jaxx methods ------------------------*/
493     /*-----------------------------------------------------------------------*/
494 
495     private void $completeSetup() {
496         allComponentsCreated = true;
497         if (log.isDebugEnabled()) {
498             log.debug(this);
499         }
500         // inline complete setup of $JPanel0
501         add(manageContextsListMenuUI, BorderLayout.LINE_START);
502         add($JPanel1, BorderLayout.CENTER);
503         addChildrenToValidator();
504         // inline complete setup of $JPanel1
505         $JPanel1.add($Table0, BorderLayout.CENTER);
506         $JPanel1.add($JPanel2, BorderLayout.PAGE_END);
507         // inline complete setup of $Table0
508         $Table0.add(SwingUtil.boxComponentWithJxLayer(manageContextsListUI), new GridBagConstraints(0, 0, 1, 1, 1.0, 0.2, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
509         $Table0.add(filters, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.8, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
510         addChildrenToFilters();
511         // inline complete setup of $JPanel2
512         $JPanel2.add(closeButton);
513         $JPanel2.add(saveButton);
514         
515         // apply 1 data bindings
516         JAXXUtil.applyDataBinding(this, $bindings.keySet());
517         
518         // apply 9 property setters
519         closeButton.setAlignmentX(Component.CENTER_ALIGNMENT);
520         saveButton.setAlignmentX(Component.CENTER_ALIGNMENT);
521         filters.setBorder(BorderFactory.createTitledBorder(t("reefdb.context.contextsList.filters.title")));
522         closeButton.setIcon(SwingUtil.createActionIcon("cancel"));
523         saveButton.setIcon(SwingUtil.createActionIcon("save"));
524         // late initializer
525         // register 1 validator(s)
526         validatorIds = SwingValidatorUtil.detectValidators(this);
527         SwingValidatorUtil.installUI(this);
528     }
529 
530     private void $initialize() {
531         if (allComponentsCreated) {
532             return;
533         }
534         if (log.isDebugEnabled()) {
535             log.debug(this);
536         }
537         handler.beforeInit(this);
538         $objectMap.put("$JPanel0", $JPanel0);
539         createModel();
540         createBroker();
541         createValidator();
542         createManageContextsListMenuUI();
543         // inline creation of $JPanel1
544         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
545         
546         $JPanel1.setName("$JPanel1");
547         $JPanel1.setLayout(new BorderLayout());
548         // inline creation of $Table0
549         $objectMap.put("$Table0", $Table0 = new Table());
550         
551         $Table0.setName("$Table0");
552         createManageContextsListUI();
553         createFilters();
554         createManageFiltersListUI();
555         createManageFilterContentUI();
556         // inline creation of $JPanel2
557         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
558         
559         $JPanel2.setName("$JPanel2");
560         $JPanel2.setLayout(new GridLayout(1,0));
561         createCloseButton();
562         createSaveButton();
563         // inline creation of $JPanel0
564         setName("$JPanel0");
565         setLayout(new BorderLayout());
566         
567         // registers 1 data bindings
568         $registerDefaultBindings();
569         $completeSetup();
570         handler.afterInit(this);
571     }
572 
573     private void $registerDefaultBindings() {
574         // register 1 data bindings
575         registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_BUTTON_ENABLED, true, true) {
576         
577             @Override
578             public void applyDataBinding() {
579                 if (model != null) {
580                     model.addPropertyChangeListener("modify", this);
581                 }
582                 if (model != null) {
583                     model.addPropertyChangeListener("valid", this);
584                 }
585             }
586         
587             @Override
588             public void processDataBinding() {
589                 if (model != null) {
590                     saveButton.setEnabled(model.isModify() && model.isValid());
591                 }
592             }
593         
594             @Override
595             public void removeDataBinding() {
596                 if (model != null) {
597                     model.removePropertyChangeListener("modify", this);
598                 }
599                 if (model != null) {
600                     model.removePropertyChangeListener("valid", this);
601                 }
602             }
603         });
604     }
605 
606 }