View Javadoc
1   package fr.ifremer.quadrige3.ui.swing.content.db;
2   
3   /*-
4    * #%L
5    * Quadrige3 Core :: UI Swing Common
6    * %%
7    * Copyright (C) 2017 - 2024 Ifremer
8    * %%
9    * This program is free software: you can redistribute it and/or modify
10   * it under the terms of the GNU Affero General Public License as published by
11   * the Free Software Foundation, either version 3 of the License, or
12   * (at your option) any later version.
13   * 
14   * This program is distributed in the hope that it will be useful,
15   * but WITHOUT ANY WARRANTY; without even the implied warranty of
16   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   * GNU General Public License for more details.
18   * 
19   * You should have received a copy of the GNU Affero General Public License
20   * along with this program.  If not, see <http://www.gnu.org/licenses/>.
21   * #L%
22   */
23  
24  
25  import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
26  import fr.ifremer.quadrige3.ui.swing.ApplicationUIContext;
27  import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
28  import java.awt.BorderLayout;
29  import java.awt.Container;
30  import java.awt.GridLayout;
31  import java.awt.LayoutManager;
32  import java.util.ArrayList;
33  import java.util.HashMap;
34  import java.util.List;
35  import java.util.Map;
36  import java.util.TreeMap;
37  import javax.swing.JButton;
38  import javax.swing.JPanel;
39  import javax.swing.JTextPane;
40  import javax.swing.border.EmptyBorder;
41  import jaxx.runtime.JAXXBinding;
42  import jaxx.runtime.JAXXContext;
43  import jaxx.runtime.JAXXObject;
44  import jaxx.runtime.JAXXObjectDescriptor;
45  import jaxx.runtime.JAXXUtil;
46  import jaxx.runtime.SwingUtil;
47  import jaxx.runtime.binding.DefaultJAXXBinding;
48  import jaxx.runtime.context.DefaultJAXXContext;
49  import org.apache.commons.logging.Log;
50  import org.apache.commons.logging.LogFactory;
51  import static org.nuiton.i18n.I18n.t;
52  
53  public class DbManagerUI extends JPanel implements ApplicationUI<ApplicationUIContext, DbManagerUIHandler>, JAXXObject {
54  
55      /*-----------------------------------------------------------------------*/
56      /*------------------ Constants for all public bindings ------------------*/
57      /*-----------------------------------------------------------------------*/
58  
59      public static final String BINDING_BACKUP_DB_BUTTON_VISIBLE = "backupDbButton.visible";
60      public static final String BINDING_CLOSE_BUTTON_VISIBLE = "closeButton.visible";
61      public static final String BINDING_EXPORT_ALL_REFERENTIAL_TO_FILE_BUTTON_VISIBLE = "exportAllReferentialToFileButton.visible";
62      public static final String BINDING_INSTALL_DB_BUTTON_TEXT = "installDbButton.text";
63      public static final String BINDING_INSTALL_DB_BUTTON_TOOL_TIP_TEXT = "installDbButton.toolTipText";
64      public static final String BINDING_OPEN_DB_BUTTON_VISIBLE = "openDbButton.visible";
65  
66      /*-----------------------------------------------------------------------*/
67      /*------------------------- Other static fields -------------------------*/
68      /*-----------------------------------------------------------------------*/
69  
70      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVXzW8bRRSfmNipk9J8kZCqieokUJIqWRNCJVBQqPNFEzltlbhSRQ5ldndsT5ndme6Omw1WEX8CfwLcuSBxAHFCSHDmwAXxLyDEgStiZnbt9cd610kgitb2zHu/95v3e+95/NUfIO06YP4p9DzNqdkcW0g7KDx+/EB/igy+g1zDwYxTB/h/AymQOgEjZnPd5WDxpCjd84F7fptajNrIbvHeKIJhl58R5FYR4hzMtXsYrps/bm5veKzmNFCbpKJQv/jrz9Tn5mdfpgDwmGA3Io6SS/IKTzJYBClscjAhIj2HeQLtiqDhYLsi+L4s17YJdN370ELPwKdgqAgyDDoCjIOF/o+sMJS/xzgYN/VDaMMKckqUPYQ2Ihy8XXY0XHaQhRztWQ2aDq6gda2GNfdUcNEManMBrZm6ttNwfrTPmALNcJC2qClh3oqHKTBGsAE5pvaj/W2J6fEQJIvtMg34TMije4HbgVqUVtmm8ag0diyFVXAQ5GCqzaUkoKWbNB9teg1BQzqoj+PtgFcpQ/aOvlXjXBADk21o/qq0nGpl4HJISMNHLl/vMHGQK3RAMSbXdGh8XGMxFjnkMerwAiFHqIyk9hiSEt3DBPX0GTEIdSO2HXCjrTZF1Wth1YdlOXAC0k5NLHMwc9LdKEdiy2+RmY4WkYBq95/pyV+///2bvUZfTIjYU5GmLW0t6pU5QgeHYxl61G+KGsckfwjZxgnIuoiImaB6fjaC2HGwLciJeOPSXZPu2j3oVgVEeui3H36c/uiXl0BqDwwTCs09KO33QZZXhVhVSkyPvX9XMbp6ekU8xyQ3UeFPqoiI5pmtL4SF3WwkTW4uvPBERmYjMtKkpWd//nvy+Ou7jawMCJbXe5qHmUl/CDLYJthGal4EoyByPowwF9VMGrZ81BAAUVOABa24rJ6rXVlIia6oUgd/IvoDkgLBFdtSk2i0flCEOiLa9u790u7RCw6G/T7bl3MDjLS0qleT2Gvq6PLdumAy1rKvcJKIDHKQ0aljijoBc3UbneZ2LcbPttTS0p2VXPC/LJhcQSbmUCeiutNlSFzxmi1To+a2r40EE650xqSFHEz5KrdIFN/O0ZNEd0gMF7z2jn1oI4va2ODgdlQJ+SnT/DGkWU3jiScwHJsFZcTBK/UHys7/rBlS2868D0moVVMX755jF6vzrtfVpNawu6PvetjlS8u5W7dy843Vh8hxxSqyDVQU3YHMJZnEQZkPDuYTaYd9cju6T9oP6XeNyD6nlJQwK6kwryc7csyilGmb4UmyZLpkWY0J3Bz2Scq8Wt9vmMaJMxwAKn2C/K7Vq9A2iQhaQTxA8c8iE7PUpZyUppHv1dh8h+yjU/5m78iYRQXu0RdtX4j/rQDNr9JkAY4apucV4LV+4veb85BwdM6X+vLtUemdN4vzz6CVmPCNO0lSqqfrW4FlXKaz/gWmYxLN1fuaOYt90AwVWYlVpHmsaEHe6Me1hx4d17jzy7EZE7z3BTBJoKN6/IXcPbONqkMbgXZVoK4o/5u4dy506FDuzVi5Y9IWXQDvXgysR0kk3tuTiiTdVSQ3Q4IGtSylibjnJ1XBRkIVBEf8gJboPWrFyp1WAS8g9XQ09ajEtf54ScqRuJlnCDyjwhhce8+EHOZ0bJviVJtd0APyOZyIKJe/lY/vohHGLo0w3cepBrHh/3TrgTHTF4ufYhBuXBph7tIINy+NMH9phEWB8C9WQSdOhBIAAA==";
71      private static final Log log = LogFactory.getLog(DbManagerUI.class);
72      private static final long serialVersionUID = 1L;
73  
74      /*-----------------------------------------------------------------------*/
75      /*--------------------------- Internal states ---------------------------*/
76      /*-----------------------------------------------------------------------*/
77  
78      protected List<Object> $activeBindings = new ArrayList<Object>();
79      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
80      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
81      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
82      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
83      private boolean allComponentsCreated;
84      protected final JAXXContext delegateContext = new DefaultJAXXContext();
85  
86      /*-----------------------------------------------------------------------*/
87      /*------------------------ Protected components  ------------------------*/
88      /*-----------------------------------------------------------------------*/
89  
90      protected JPanel actions;
91      protected JButton backupDbButton;
92      protected JButton closeButton;
93      protected DbManagerUI dbManagerTopPanel = this;
94      protected JButton exportAllReferentialToFileButton;
95      protected final DbManagerUIHandler handler = createHandler();
96      protected JPanel infoPanel;
97      protected JTextPane informationArea;
98      protected JButton installDbButton;
99      protected ApplicationUIContext model;
100     protected JButton openDbButton;
101     protected JButton restoreDbButton;
102 
103     /*-----------------------------------------------------------------------*/
104     /*---------------------------- Constructors  ----------------------------*/
105     /*-----------------------------------------------------------------------*/
106 
107     public DbManagerUI(ApplicationUI parentUI) {
108         ApplicationUIUtil.setParentUI(this, parentUI);
109             $initialize();
110     }
111 
112     public DbManagerUI() {
113         $initialize();
114     }
115 
116     public DbManagerUI(JAXXContext parentContext) {
117         JAXXUtil.initContext(this, parentContext);
118         $initialize();
119     }
120 
121     public DbManagerUI(boolean param0) {
122         super(param0);
123         $initialize();
124     }
125 
126     public DbManagerUI(JAXXContext parentContext, boolean param1) {
127         super(param1);
128         JAXXUtil.initContext(this, parentContext);
129         $initialize();
130     }
131 
132     public DbManagerUI(LayoutManager param0) {
133         super(param0);
134         $initialize();
135     }
136 
137     public DbManagerUI(JAXXContext parentContext, LayoutManager param1) {
138         super(param1);
139         JAXXUtil.initContext(this, parentContext);
140         $initialize();
141     }
142 
143     public DbManagerUI(LayoutManager param0, boolean param1) {
144         super(param0 ,param1);
145         $initialize();
146     }
147 
148     public DbManagerUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
149         super(param1 ,param2);
150         JAXXUtil.initContext(this, parentContext);
151         $initialize();
152     }
153 
154     /*-----------------------------------------------------------------------*/
155     /*--------------------------- Statics methods ---------------------------*/
156     /*-----------------------------------------------------------------------*/
157 
158     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
159         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
160     }
161 
162     /*-----------------------------------------------------------------------*/
163     /*---------------------- JAXXObject implementation ----------------------*/
164     /*-----------------------------------------------------------------------*/
165 
166     @Override
167     public void applyDataBinding(String $binding) {
168         if (allComponentsCreated && $bindings.containsKey($binding)) {
169             getDataBinding($binding).applyDataBinding();
170         }
171         processDataBinding($binding);
172     }
173 
174     @Override
175     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
176         super.firePropertyChange(propertyName, oldValue, newValue);
177     }
178 
179     @Override
180     public Map<String, Object> get$objectMap() {
181         return $objectMap;
182     }
183 
184     @Override
185     public JAXXBinding getDataBinding(String bindingId) {
186         return $bindings.get(bindingId);
187     }
188 
189     @Override
190     public JAXXBinding[] getDataBindings() {
191         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
192     }
193 
194     @Override
195     public Object getObjectById(String id) {
196         return $objectMap.get(id);
197     }
198 
199     @Override
200     public void processDataBinding(String $binding, boolean $force) {
201         if (!$force && $activeBindings.contains($binding)) { 
202             return;
203         }
204         $activeBindings.add($binding);
205         try {
206             if (allComponentsCreated && $bindings.containsKey($binding)) {
207                 getDataBinding($binding).processDataBinding();
208             }
209         } finally {
210             $activeBindings.remove($binding);
211         }
212     }
213 
214     @Override
215     public void processDataBinding(String $binding) {
216         processDataBinding($binding, false);
217     }
218 
219     @Override
220     public void registerDataBinding(JAXXBinding binding) {
221         $bindings.put(binding.getId(), binding);
222     }
223 
224     @Override
225     public void removeDataBinding(String $binding) {
226         if (allComponentsCreated && $bindings.containsKey($binding)) {
227             getDataBinding($binding).removeDataBinding();
228         }
229     }
230 
231     /*-----------------------------------------------------------------------*/
232     /*--------------------- JAXXContext implementation  ---------------------*/
233     /*-----------------------------------------------------------------------*/
234 
235     @Override
236     public <T> T getContextValue(Class<T> clazz) {
237         return delegateContext.getContextValue(clazz, null);
238     }
239 
240     @Override
241     public <T> T getContextValue(Class<T> clazz, String name) {
242         return delegateContext.getContextValue(clazz, name);
243     }
244 
245     @Override
246     public JAXXContext getDelegateContext() {
247         return delegateContext;
248     }
249 
250     @Override
251     public <O extends Container> O getParentContainer(Class<O> clazz) {
252         return SwingUtil.getParentContainer(this, clazz);
253     }
254 
255     @Override
256     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
257         return SwingUtil.getParentContainer(source, clazz);
258     }
259 
260     @Override
261     public <T> void removeContextValue(Class<T> clazz) {
262         delegateContext.removeContextValue(clazz, null);
263     }
264 
265     @Override
266     public <T> void removeContextValue(Class<T> clazz, String name) {
267         delegateContext.removeContextValue(clazz, name);
268     }
269 
270     @Override
271     public <T> void setContextValue(T o) {
272         delegateContext.setContextValue(o, null);
273     }
274 
275     @Override
276     public <T> void setContextValue(T o, String name) {
277         delegateContext.setContextValue(o, name);
278     }
279 
280     /*-----------------------------------------------------------------------*/
281     /*----------------------- Public acessor methods  -----------------------*/
282     /*-----------------------------------------------------------------------*/
283 
284     public JPanel getActions() {
285         return actions;
286     }
287 
288     public JButton getBackupDbButton() {
289         return backupDbButton;
290     }
291 
292     public JButton getCloseButton() {
293         return closeButton;
294     }
295 
296     public JButton getExportAllReferentialToFileButton() {
297         return exportAllReferentialToFileButton;
298     }
299 
300     public DbManagerUIHandler getHandler() {
301         return handler;
302     }
303 
304     public JPanel getInfoPanel() {
305         return infoPanel;
306     }
307 
308     public JTextPane getInformationArea() {
309         return informationArea;
310     }
311 
312     public JButton getInstallDbButton() {
313         return installDbButton;
314     }
315 
316     public ApplicationUIContext getModel() {
317         return model;
318     }
319 
320     public JButton getOpenDbButton() {
321         return openDbButton;
322     }
323 
324     public JButton getRestoreDbButton() {
325         return restoreDbButton;
326     }
327 
328     /*-----------------------------------------------------------------------*/
329     /*--------------------- Components creation methods ---------------------*/
330     /*-----------------------------------------------------------------------*/
331 
332     protected void addChildrenToActions() {
333         if (!allComponentsCreated) {
334             return;
335         }
336         actions.add(openDbButton);
337         actions.add(installDbButton);
338         actions.add(restoreDbButton);
339         actions.add(backupDbButton);
340         actions.add(exportAllReferentialToFileButton);
341         actions.add(closeButton);
342     }
343 
344     protected void addChildrenToDbManagerTopPanel() {
345         if (!allComponentsCreated) {
346             return;
347         }
348         add(infoPanel, BorderLayout.CENTER);
349         add(actions, BorderLayout.SOUTH);
350     }
351 
352     protected void addChildrenToInfoPanel() {
353         if (!allComponentsCreated) {
354             return;
355         }
356         infoPanel.add(informationArea, BorderLayout.CENTER);
357     }
358 
359     protected void createActions() {
360         $objectMap.put("actions", actions = new JPanel());
361         
362         actions.setName("actions");
363         actions.setLayout(new GridLayout(0, 1));
364     }
365 
366     protected void createBackupDbButton() {
367         $objectMap.put("backupDbButton", backupDbButton = new JButton());
368         
369         backupDbButton.setName("backupDbButton");
370         backupDbButton.setText(t("quadrige3.dbManager.action.backupDb"));
371         backupDbButton.setToolTipText(t("quadrige3.dbManager.action.backupDb.tip"));
372         backupDbButton.putClientProperty("help", "quadrige3.dbManager.action.backupDb.help");
373         backupDbButton.putClientProperty("applicationAction", BackupDbAction.class);
374     }
375 
376     protected void createCloseButton() {
377         $objectMap.put("closeButton", closeButton = new JButton());
378         
379         closeButton.setName("closeButton");
380         closeButton.setText(t("quadrige3.common.close"));
381         closeButton.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.action.GoToHomeAction.class);
382     }
383 
384     protected void createExportAllReferentialToFileButton() {
385         $objectMap.put("exportAllReferentialToFileButton", exportAllReferentialToFileButton = new JButton());
386         
387         exportAllReferentialToFileButton.setName("exportAllReferentialToFileButton");
388         exportAllReferentialToFileButton.setText(t("quadrige3.dbManager.action.exportAllReferentialToFile"));
389         exportAllReferentialToFileButton.setToolTipText(t("quadrige3.dbManager.action.exportAllReferentialToFile.tip"));
390         exportAllReferentialToFileButton.putClientProperty("help", "quadrige3.dbManager.action.exportAllReferentialToFile.help");
391         exportAllReferentialToFileButton.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.synchro.action.ExportReferentialToFileAction.class);
392     }
393 
394     protected DbManagerUIHandler createHandler() {
395         return new DbManagerUIHandler();
396     }
397 
398     protected void createInfoPanel() {
399         $objectMap.put("infoPanel", infoPanel = new JPanel());
400         
401         infoPanel.setName("infoPanel");
402         infoPanel.setLayout(new BorderLayout());
403     }
404 
405     protected void createInformationArea() {
406         $objectMap.put("informationArea", informationArea = new JTextPane());
407         
408         informationArea.setName("informationArea");
409         informationArea.setEditable(false);
410         informationArea.setFocusable(false);
411         informationArea.setContentType("text/html");
412     }
413 
414     protected void createInstallDbButton() {
415         $objectMap.put("installDbButton", installDbButton = new JButton());
416         
417         installDbButton.setName("installDbButton");
418         installDbButton.putClientProperty("help", "quadrige3.dbManager.action.installDb.help");
419         installDbButton.putClientProperty("applicationAction", InstallDbAction.class);
420     }
421 
422     protected void createModel() {
423         $objectMap.put("model", model = getContextValue(ApplicationUIContext.class));
424     }
425 
426     protected void createOpenDbButton() {
427         $objectMap.put("openDbButton", openDbButton = new JButton());
428         
429         openDbButton.setName("openDbButton");
430         openDbButton.setText(t("quadrige3.dbManager.action.openDb"));
431         openDbButton.setToolTipText(t("quadrige3.dbManager.action.openDb.tip"));
432         openDbButton.putClientProperty("help", "quadrige3.dbManager.action.openDb.help");
433         openDbButton.putClientProperty("applicationAction", OpenDbAction.class);
434     }
435 
436     protected void createRestoreDbButton() {
437         $objectMap.put("restoreDbButton", restoreDbButton = new JButton());
438         
439         restoreDbButton.setName("restoreDbButton");
440         restoreDbButton.setText(t("quadrige3.dbManager.action.restoreDb"));
441         restoreDbButton.setToolTipText(t("quadrige3.dbManager.action.restoreDb.tip"));
442         restoreDbButton.putClientProperty("help", "quadrige3.dbManager.action.restoreDb.help");
443         restoreDbButton.putClientProperty("applicationAction", RestoreDbAction.class);
444     }
445 
446     /*-----------------------------------------------------------------------*/
447     /*------------------------ Internal jaxx methods ------------------------*/
448     /*-----------------------------------------------------------------------*/
449 
450     private void $completeSetup() {
451         allComponentsCreated = true;
452         if (log.isDebugEnabled()) {
453             log.debug(this);
454         }
455         addChildrenToDbManagerTopPanel();
456         addChildrenToInfoPanel();
457         addChildrenToActions();
458         
459         // apply 6 data bindings
460         JAXXUtil.applyDataBinding(this, $bindings.keySet());
461         
462         // apply 16 property setters
463         informationArea.setBorder(new EmptyBorder(5, 5, 5, 5));
464         openDbButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.dbManager.action.openDb.mnemonic"),'Z'));
465         openDbButton.setIcon(SwingUtil.createActionIcon("open-db"));
466         installDbButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.dbManager.action.installDb.mnemonic"),'Z'));
467         installDbButton.setIcon(SwingUtil.createActionIcon("install-db"));
468         restoreDbButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.dbManager.action.restoreDb.mnemonic"),'Z'));
469         restoreDbButton.setIcon(SwingUtil.createActionIcon("install-db"));
470         backupDbButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.dbManager.action.backupDb.mnemonic"),'Z'));
471         backupDbButton.setIcon(SwingUtil.createActionIcon("export-db"));
472         exportAllReferentialToFileButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.dbManager.action.exportAllReferentialToFile.mnemonic"),'Z'));
473         exportAllReferentialToFileButton.setIcon(SwingUtil.createActionIcon("export-db"));
474         closeButton.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.common.close.mnemonic"),'Z'));
475         closeButton.setIcon(SwingUtil.createActionIcon("close"));
476     }
477 
478     private void $initialize() {
479         if (allComponentsCreated) {
480             return;
481         }
482         if (log.isDebugEnabled()) {
483             log.debug(this);
484         }
485         handler.beforeInit(this);
486         $objectMap.put("dbManagerTopPanel", dbManagerTopPanel);
487         createModel();
488         createInfoPanel();
489         createInformationArea();
490         createActions();
491         createOpenDbButton();
492         createInstallDbButton();
493         createRestoreDbButton();
494         createBackupDbButton();
495         createExportAllReferentialToFileButton();
496         createCloseButton();
497         // inline creation of dbManagerTopPanel
498         setName("dbManagerTopPanel");
499         setLayout(new BorderLayout());
500         dbManagerTopPanel.putClientProperty("help", "quadrige3.dbManager.help");
501         
502         // registers 6 data bindings
503         $registerDefaultBindings();
504         $completeSetup();
505         handler.afterInit(this);
506     }
507 
508     private void $registerDefaultBindings() {
509         // register 6 data bindings
510         registerDataBinding(new DefaultJAXXBinding(this, BINDING_OPEN_DB_BUTTON_VISIBLE, true, true) {
511         
512             @Override
513             public void applyDataBinding() {
514                 if (model != null) {
515                     model.addPropertyChangeListener("dbExist", this);
516                 }
517                 if (model != null) {
518                     model.addPropertyChangeListener("persistenceLoaded", this);
519                 }
520             }
521         
522             @Override
523             public void processDataBinding() {
524                 if (model != null) {
525                     openDbButton.setVisible(model.isDbExist() && !model.isPersistenceLoaded());
526                 }
527             }
528         
529             @Override
530             public void removeDataBinding() {
531                 if (model != null) {
532                     model.removePropertyChangeListener("dbExist", this);
533                 }
534                 if (model != null) {
535                     model.removePropertyChangeListener("persistenceLoaded", this);
536                 }
537             }
538         });
539         registerDataBinding(new DefaultJAXXBinding(this, BINDING_INSTALL_DB_BUTTON_TEXT, true) {
540         
541             @Override
542             public void applyDataBinding() {
543                 if (model != null) {
544                     model.addPropertyChangeListener("dbExist", this);
545                 }
546             }
547         
548             @Override
549             public void processDataBinding() {
550                 if (model != null) {
551                     installDbButton.setText(t(handler.getInstallButtonText(model.isDbExist())));
552                 }
553             }
554         
555             @Override
556             public void removeDataBinding() {
557                 if (model != null) {
558                     model.removePropertyChangeListener("dbExist", this);
559                 }
560             }
561         });
562         registerDataBinding(new DefaultJAXXBinding(this, BINDING_INSTALL_DB_BUTTON_TOOL_TIP_TEXT, true) {
563         
564             @Override
565             public void applyDataBinding() {
566                 if (model != null) {
567                     model.addPropertyChangeListener("dbExist", this);
568                 }
569             }
570         
571             @Override
572             public void processDataBinding() {
573                 if (model != null) {
574                     installDbButton.setToolTipText(t(handler.getInstallButtonTip(model.isDbExist())));
575                 }
576             }
577         
578             @Override
579             public void removeDataBinding() {
580                 if (model != null) {
581                     model.removePropertyChangeListener("dbExist", this);
582                 }
583             }
584         });
585         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BACKUP_DB_BUTTON_VISIBLE, true) {
586         
587             @Override
588             public void applyDataBinding() {
589                 if (model != null) {
590                     model.addPropertyChangeListener("persistenceLoaded", this);
591                 }
592             }
593         
594             @Override
595             public void processDataBinding() {
596                 if (model != null) {
597                     backupDbButton.setVisible(model.isPersistenceLoaded());
598                 }
599             }
600         
601             @Override
602             public void removeDataBinding() {
603                 if (model != null) {
604                     model.removePropertyChangeListener("persistenceLoaded", this);
605                 }
606             }
607         });
608         registerDataBinding(new DefaultJAXXBinding(this, BINDING_EXPORT_ALL_REFERENTIAL_TO_FILE_BUTTON_VISIBLE, true) {
609         
610             @Override
611             public void applyDataBinding() {
612                 if (model != null) {
613                     model.addPropertyChangeListener("persistenceLoaded", this);
614                 }
615             }
616         
617             @Override
618             public void processDataBinding() {
619                 if (model != null) {
620                     exportAllReferentialToFileButton.setVisible(model.isPersistenceLoaded());
621                 }
622             }
623         
624             @Override
625             public void removeDataBinding() {
626                 if (model != null) {
627                     model.removePropertyChangeListener("persistenceLoaded", this);
628                 }
629             }
630         });
631         registerDataBinding(new DefaultJAXXBinding(this, BINDING_CLOSE_BUTTON_VISIBLE, true) {
632         
633             @Override
634             public void applyDataBinding() {
635                 if (model != null) {
636                     model.addPropertyChangeListener("persistenceLoaded", this);
637                 }
638             }
639         
640             @Override
641             public void processDataBinding() {
642                 if (model != null) {
643                     closeButton.setVisible(model.isPersistenceLoaded());
644                 }
645             }
646         
647             @Override
648             public void removeDataBinding() {
649                 if (model != null) {
650                     model.removePropertyChangeListener("persistenceLoaded", this);
651                 }
652             }
653         });
654     }
655 
656 }