View Javadoc
1   package fr.ifremer.quadrige3.ui.swing.content;
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 fr.ifremer.quadrige3.ui.swing.Screen;
29  import fr.ifremer.quadrige3.ui.swing.content.widget.ValidatorMessageWidget;
30  import fr.ifremer.quadrige3.ui.swing.synchro.SynchroWidget;
31  import java.awt.BorderLayout;
32  import java.awt.Container;
33  import java.awt.GraphicsConfiguration;
34  import java.awt.event.WindowEvent;
35  import java.awt.event.WindowListener;
36  import java.util.ArrayList;
37  import java.util.HashMap;
38  import java.util.List;
39  import java.util.Map;
40  import java.util.TreeMap;
41  import javax.swing.JButton;
42  import javax.swing.JFrame;
43  import javax.swing.JLabel;
44  import javax.swing.JMenu;
45  import javax.swing.JMenuBar;
46  import javax.swing.JMenuItem;
47  import javax.swing.JToolBar;
48  import javax.swing.JToolBar.Separator;
49  import jaxx.runtime.JAXXBinding;
50  import jaxx.runtime.JAXXContext;
51  import jaxx.runtime.JAXXObject;
52  import jaxx.runtime.JAXXObjectDescriptor;
53  import jaxx.runtime.JAXXUtil;
54  import jaxx.runtime.SwingUtil;
55  import jaxx.runtime.binding.DefaultJAXXBinding;
56  import jaxx.runtime.context.DefaultJAXXContext;
57  import jaxx.runtime.swing.BlockingLayerUI;
58  import jaxx.runtime.swing.StatusMessagePanel;
59  import org.apache.commons.logging.Log;
60  import org.apache.commons.logging.LogFactory;
61  import org.jdesktop.swingx.JXTitledPanel;
62  import static org.nuiton.i18n.I18n.t;
63  
64  public abstract class MainUI<H extends AbstractMainUIHandler<? extends ApplicationUIContext,?>> extends JFrame implements ApplicationUI<ApplicationUIContext, H>, JAXXObject {
65  
66      /*-----------------------------------------------------------------------*/
67      /*------------------ Constants for all public bindings ------------------*/
68      /*-----------------------------------------------------------------------*/
69  
70      public static final String BINDING_AUTHENTICATION_LABEL_TEXT = "authenticationLabel.text";
71      public static final String BINDING_AUTHENTICATION_LABEL_TOOL_TIP_TEXT = "authenticationLabel.toolTipText";
72      public static final String BINDING_BUSY_BLOCK_LAYER_UI_BLOCK = "busyBlockLayerUI.block";
73      public static final String BINDING_BUSY_BLOCK_LAYER_UI_BLOCKING_COLOR = "busyBlockLayerUI.blockingColor";
74  
75      /*-----------------------------------------------------------------------*/
76      /*------------------------- Other static fields -------------------------*/
77      /*-----------------------------------------------------------------------*/
78  
79      private static final String $jaxxObjectDescriptor = "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";
80      private static final Log log = LogFactory.getLog(MainUI.class);
81      private static final long serialVersionUID = 1L;
82  
83      /*-----------------------------------------------------------------------*/
84      /*--------------------------- Internal states ---------------------------*/
85      /*-----------------------------------------------------------------------*/
86  
87      protected List<Object> $activeBindings = new ArrayList<Object>();
88      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
89      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
90      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
91      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
92      private boolean allComponentsCreated;
93      protected final JAXXContext delegateContext = new DefaultJAXXContext();
94  
95      /*-----------------------------------------------------------------------*/
96      /*------------------------ Protected components  ------------------------*/
97      /*-----------------------------------------------------------------------*/
98  
99      protected JLabel authenticationLabel;
100     protected JXTitledPanel body;
101     protected JToolBar bottomBar;
102     protected BlockingLayerUI busyBlockLayerUI;
103     protected MainUI<H> mainFrame = this;
104     protected JMenuBar menu;
105     protected JMenu menuChangeLocale;
106     protected JMenuItem menuChangeLocaleES;
107     protected JMenuItem menuChangeLocaleFR;
108     protected JMenuItem menuChangeLocaleUK;
109     protected JMenuItem menuFileExit;
110     protected ApplicationUIContext model;
111     protected JButton showHelp;
112     protected StatusMessagePanel status;
113     protected SynchroWidget synchroWidget;
114     protected ValidatorMessageWidget validatorMessageWidget;
115 
116     /*-----------------------------------------------------------------------*/
117     /*------------------------- Private components  -------------------------*/
118     /*-----------------------------------------------------------------------*/
119 
120     private Separator $JToolBar$Separator0;
121     private Separator $JToolBar$Separator1;
122 
123     /*-----------------------------------------------------------------------*/
124     /*---------------------------- Constructors  ----------------------------*/
125     /*-----------------------------------------------------------------------*/
126 
127     public MainUI(ApplicationUIContext context) {
128         ApplicationUIUtil.setApplicationContext(this, context);
129                 	context.setMainUI(this);
130             $initialize();
131     }
132 
133     public MainUI(String param0, GraphicsConfiguration param1) {
134         super(param0 ,param1);
135         $initialize();
136     }
137 
138     public MainUI(JAXXContext parentContext, String param1, GraphicsConfiguration param2) {
139         super(param1 ,param2);
140         JAXXUtil.initContext(this, parentContext);
141         $initialize();
142     }
143 
144     public MainUI(String param0) {
145         super(param0);
146         $initialize();
147     }
148 
149     public MainUI(JAXXContext parentContext, String param1) {
150         super(param1);
151         JAXXUtil.initContext(this, parentContext);
152         $initialize();
153     }
154 
155     public MainUI(GraphicsConfiguration param0) {
156         super(param0);
157         $initialize();
158     }
159 
160     public MainUI(JAXXContext parentContext, GraphicsConfiguration param1) {
161         super(param1);
162         JAXXUtil.initContext(this, parentContext);
163         $initialize();
164     }
165 
166     public MainUI() {
167         $initialize();
168     }
169 
170     public MainUI(JAXXContext parentContext) {
171         JAXXUtil.initContext(this, parentContext);
172         $initialize();
173     }
174 
175     /*-----------------------------------------------------------------------*/
176     /*--------------------------- Statics methods ---------------------------*/
177     /*-----------------------------------------------------------------------*/
178 
179     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
180         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
181     }
182 
183     /*-----------------------------------------------------------------------*/
184     /*---------------------- JAXXObject implementation ----------------------*/
185     /*-----------------------------------------------------------------------*/
186 
187     @Override
188     public void applyDataBinding(String $binding) {
189         if (allComponentsCreated && $bindings.containsKey($binding)) {
190             getDataBinding($binding).applyDataBinding();
191         }
192         processDataBinding($binding);
193     }
194 
195     @Override
196     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
197         super.firePropertyChange(propertyName, oldValue, newValue);
198     }
199 
200     @Override
201     public Map<String, Object> get$objectMap() {
202         return $objectMap;
203     }
204 
205     @Override
206     public JAXXBinding getDataBinding(String bindingId) {
207         return $bindings.get(bindingId);
208     }
209 
210     @Override
211     public JAXXBinding[] getDataBindings() {
212         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
213     }
214 
215     @Override
216     public Object getObjectById(String id) {
217         return $objectMap.get(id);
218     }
219 
220     @Override
221     public void processDataBinding(String $binding, boolean $force) {
222         if (!$force && $activeBindings.contains($binding)) { 
223             return;
224         }
225         $activeBindings.add($binding);
226         try {
227             if (allComponentsCreated && $bindings.containsKey($binding)) {
228                 getDataBinding($binding).processDataBinding();
229             }
230         } finally {
231             $activeBindings.remove($binding);
232         }
233     }
234 
235     @Override
236     public void processDataBinding(String $binding) {
237         processDataBinding($binding, false);
238     }
239 
240     @Override
241     public void registerDataBinding(JAXXBinding binding) {
242         $bindings.put(binding.getId(), binding);
243     }
244 
245     @Override
246     public void removeDataBinding(String $binding) {
247         if (allComponentsCreated && $bindings.containsKey($binding)) {
248             getDataBinding($binding).removeDataBinding();
249         }
250     }
251 
252     /*-----------------------------------------------------------------------*/
253     /*--------------------- JAXXContext implementation  ---------------------*/
254     /*-----------------------------------------------------------------------*/
255 
256     @Override
257     public <T> T getContextValue(Class<T> clazz) {
258         return delegateContext.getContextValue(clazz, null);
259     }
260 
261     @Override
262     public <T> T getContextValue(Class<T> clazz, String name) {
263         return delegateContext.getContextValue(clazz, name);
264     }
265 
266     @Override
267     public JAXXContext getDelegateContext() {
268         return delegateContext;
269     }
270 
271     @Override
272     public <O extends Container> O getParentContainer(Class<O> clazz) {
273         return SwingUtil.getParentContainer(this, clazz);
274     }
275 
276     @Override
277     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
278         return SwingUtil.getParentContainer(source, clazz);
279     }
280 
281     @Override
282     public <T> void removeContextValue(Class<T> clazz) {
283         delegateContext.removeContextValue(clazz, null);
284     }
285 
286     @Override
287     public <T> void removeContextValue(Class<T> clazz, String name) {
288         delegateContext.removeContextValue(clazz, name);
289     }
290 
291     @Override
292     public <T> void setContextValue(T o) {
293         delegateContext.setContextValue(o, null);
294     }
295 
296     @Override
297     public <T> void setContextValue(T o, String name) {
298         delegateContext.setContextValue(o, name);
299     }
300 
301     /*-----------------------------------------------------------------------*/
302     /*---------------------------- Event methods ----------------------------*/
303     /*-----------------------------------------------------------------------*/
304 
305     public void doWindowClosing__on__mainFrame(WindowEvent event) {
306         if (log.isDebugEnabled()) {
307             log.debug(event);
308         }
309         menuFileExit.getAction().actionPerformed(null);
310     }
311 
312     /*-----------------------------------------------------------------------*/
313     /*----------------------- Public acessor methods  -----------------------*/
314     /*-----------------------------------------------------------------------*/
315 
316     public JLabel getAuthenticationLabel() {
317         return authenticationLabel;
318     }
319 
320     public JXTitledPanel getBody() {
321         return body;
322     }
323 
324     public JToolBar getBottomBar() {
325         return bottomBar;
326     }
327 
328     public BlockingLayerUI getBusyBlockLayerUI() {
329         return busyBlockLayerUI;
330     }
331 
332     public JMenuBar getMenu() {
333         return menu;
334     }
335 
336     public JMenu getMenuChangeLocale() {
337         return menuChangeLocale;
338     }
339 
340     public JMenuItem getMenuChangeLocaleES() {
341         return menuChangeLocaleES;
342     }
343 
344     public JMenuItem getMenuChangeLocaleFR() {
345         return menuChangeLocaleFR;
346     }
347 
348     public JMenuItem getMenuChangeLocaleUK() {
349         return menuChangeLocaleUK;
350     }
351 
352     public JMenuItem getMenuFileExit() {
353         return menuFileExit;
354     }
355 
356     public ApplicationUIContext getModel() {
357         return model;
358     }
359 
360     public JButton getShowHelp() {
361         return showHelp;
362     }
363 
364     public StatusMessagePanel getStatus() {
365         return status;
366     }
367 
368     public SynchroWidget getSynchroWidget() {
369         return synchroWidget;
370     }
371 
372     public ValidatorMessageWidget getValidatorMessageWidget() {
373         return validatorMessageWidget;
374     }
375 
376     /*-----------------------------------------------------------------------*/
377     /*--------------------- Protected acessors methods  ---------------------*/
378     /*-----------------------------------------------------------------------*/
379 
380     protected Separator get$JToolBar$Separator0() {
381         return $JToolBar$Separator0;
382     }
383 
384     protected Separator get$JToolBar$Separator1() {
385         return $JToolBar$Separator1;
386     }
387 
388     /*-----------------------------------------------------------------------*/
389     /*--------------------- Components creation methods ---------------------*/
390     /*-----------------------------------------------------------------------*/
391 
392     protected void addChildrenToBottomBar() {
393         if (!allComponentsCreated) {
394             return;
395         }
396         bottomBar.add(authenticationLabel);
397         bottomBar.add($JToolBar$Separator0);
398         bottomBar.add(synchroWidget);
399         bottomBar.add($JToolBar$Separator1);
400         bottomBar.add(validatorMessageWidget);
401     }
402 
403     protected void addChildrenToMainFrame() {
404         if (!allComponentsCreated) {
405             return;
406         }
407         add(menuFileExit);
408         add(menuChangeLocale);
409         add(bottomBar);
410         add(showHelp);
411         add(SwingUtil.boxComponentWithJxLayer(body), BorderLayout.CENTER);
412         add(status, BorderLayout.SOUTH);
413         mainFrame.setJMenuBar(menu);
414     }
415 
416     protected void addChildrenToMenuChangeLocale() {
417         if (!allComponentsCreated) {
418             return;
419         }
420         menuChangeLocale.add(menuChangeLocaleUK);
421         menuChangeLocale.add(menuChangeLocaleFR);
422         menuChangeLocale.add(menuChangeLocaleES);
423     }
424 
425     protected void createAuthenticationLabel() {
426         $objectMap.put("authenticationLabel", authenticationLabel = new JLabel());
427         
428         authenticationLabel.setName("authenticationLabel");
429     }
430 
431     protected void createBody() {
432         $objectMap.put("body", body = new JXTitledPanel());
433         
434         body.setName("body");
435     }
436 
437     protected void createBottomBar() {
438         $objectMap.put("bottomBar", bottomBar = new JToolBar());
439         
440         bottomBar.setName("bottomBar");
441         bottomBar.setBorderPainted(false);
442         bottomBar.setFloatable(false);
443     }
444 
445     protected void createBusyBlockLayerUI() {
446         $objectMap.put("busyBlockLayerUI", busyBlockLayerUI = new BlockingLayerUI());
447         
448         busyBlockLayerUI.setUseIcon(false);
449     }
450 
451     protected void createMenu() {
452         $objectMap.put("menu", menu = new JMenuBar());
453         
454         menu.setName("menu");
455     }
456 
457     protected void createMenuChangeLocale() {
458         $objectMap.put("menuChangeLocale", menuChangeLocale = new JMenu());
459         
460         menuChangeLocale.setName("menuChangeLocale");
461         menuChangeLocale.setText(t("quadrige3.main.menu.changeLocale"));
462         menuChangeLocale.putClientProperty("help", "quadrige3.main.menu.menu.changeLocale.help");
463     }
464 
465     protected void createMenuChangeLocaleES() {
466         $objectMap.put("menuChangeLocaleES", menuChangeLocaleES = new JMenuItem());
467         
468         menuChangeLocaleES.setName("menuChangeLocaleES");
469         menuChangeLocaleES.setText(t("quadrige3.main.menu.changeLocaleES"));
470         menuChangeLocaleES.putClientProperty("help", "quadrige3.main.menu.action.changeLocaleES.help");
471         menuChangeLocaleES.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.action.ChangeToLocaleESAction.class);
472     }
473 
474     protected void createMenuChangeLocaleFR() {
475         $objectMap.put("menuChangeLocaleFR", menuChangeLocaleFR = new JMenuItem());
476         
477         menuChangeLocaleFR.setName("menuChangeLocaleFR");
478         menuChangeLocaleFR.setText(t("quadrige3.main.menu.changeLocaleFR"));
479         menuChangeLocaleFR.putClientProperty("help", "quadrige3.main.menu.action.changeLocaleFR.help");
480         menuChangeLocaleFR.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.action.ChangeToLocaleFRAction.class);
481     }
482 
483     protected void createMenuChangeLocaleUK() {
484         $objectMap.put("menuChangeLocaleUK", menuChangeLocaleUK = new JMenuItem());
485         
486         menuChangeLocaleUK.setName("menuChangeLocaleUK");
487         menuChangeLocaleUK.setText(t("quadrige3.main.menu.changeLocaleUK"));
488         menuChangeLocaleUK.putClientProperty("help", "quadrige3.main.menu.action.changeLocaleUK.help");
489         menuChangeLocaleUK.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.action.ChangeToLocaleUKAction.class);
490     }
491 
492     protected void createMenuFileExit() {
493         $objectMap.put("menuFileExit", menuFileExit = new JMenuItem());
494         
495         menuFileExit.setName("menuFileExit");
496         menuFileExit.setText(t("quadrige3.main.menu.exit"));
497         menuFileExit.putClientProperty("applicationActionKey", fr.ifremer.quadrige3.ui.swing.ApplicationKeyStrokes.CLOSE);
498         menuFileExit.putClientProperty("help", "quadrige3.main.menu.action.exit.help");
499         menuFileExit.putClientProperty("applicationAction", fr.ifremer.quadrige3.ui.swing.action.CloseApplicationAction.class);
500     }
501 
502     protected void createModel() {
503         $objectMap.put("model", model = getContextValue(ApplicationUIContext.class));
504     }
505 
506     protected void createShowHelp() {
507         $objectMap.put("showHelp", showHelp = new JButton());
508         
509         showHelp.setName("showHelp");
510         showHelp.setToolTipText(t("quadrige3.main.menu.showHelp.tip"));
511         showHelp.putClientProperty("help", "quadrige3.main.menu.action.showHelp.help");
512     }
513 
514     protected void createStatus() {
515         $objectMap.put("status", status = new StatusMessagePanel());
516         
517         status.setName("status");
518         status.setShowMemoryStatus(true);
519     }
520 
521     protected void createSynchroWidget() {
522         $objectMap.put("synchroWidget", synchroWidget = new SynchroWidget(this));
523         
524         synchroWidget.setName("synchroWidget");
525     }
526 
527     protected void createValidatorMessageWidget() {
528         $objectMap.put("validatorMessageWidget", validatorMessageWidget = new ValidatorMessageWidget());
529         
530         validatorMessageWidget.setName("validatorMessageWidget");
531         validatorMessageWidget.setFocusPainted(false);
532     }
533 
534     /*-----------------------------------------------------------------------*/
535     /*------------------------ Internal jaxx methods ------------------------*/
536     /*-----------------------------------------------------------------------*/
537 
538     private void $completeSetup() {
539         allComponentsCreated = true;
540         if (log.isDebugEnabled()) {
541             log.debug(this);
542         }
543         addChildrenToMainFrame();
544         addChildrenToMenuChangeLocale();
545         addChildrenToBottomBar();
546         
547         // apply 4 data bindings
548         JAXXUtil.applyDataBinding(this, $bindings.keySet());
549         
550         // apply 16 property setters
551         setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
552         menuFileExit.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.main.menu.exit.mnemonic"),'Z'));
553         menuFileExit.setIcon(SwingUtil.createActionIcon("close"));
554         menuChangeLocale.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.main.menu.changeLocale.mnemonic"),'Z'));
555         menuChangeLocale.setIcon(SwingUtil.createActionIcon("translate"));
556         menuChangeLocaleUK.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.main.menu.changeLocaleUK.mnemonic"),'Z'));
557         menuChangeLocaleUK.setIcon(SwingUtil.createActionIcon("i18n-uk"));
558         menuChangeLocaleUK.setEnabled(!ApplicationUIContext.getInstance().acceptLocale("en_GB"));
559         menuChangeLocaleFR.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.main.menu.changeLocaleFR.mnemonic"),'Z'));
560         menuChangeLocaleFR.setIcon(SwingUtil.createActionIcon("i18n-fr"));
561         menuChangeLocaleFR.setEnabled(!ApplicationUIContext.getInstance().acceptLocale("fr_FR"));
562         menuChangeLocaleES.setMnemonic(SwingUtil.getFirstCharAt(t("quadrige3.main.menu.changeLocaleES.mnemonic"),'Z'));
563         menuChangeLocaleES.setIcon(SwingUtil.createActionIcon("i18n-es"));
564         menuChangeLocaleES.setEnabled(!ApplicationUIContext.getInstance().acceptLocale("es_ES"));
565         bottomBar.setMargin(new java.awt.Insets(0, 0, 0, 5));
566         showHelp.setIcon(SwingUtil.createActionIcon("show-help"));
567     }
568 
569     private void $initialize() {
570         if (allComponentsCreated) {
571             return;
572         }
573         if (log.isDebugEnabled()) {
574             log.debug(this);
575         }
576         $objectMap.put("mainFrame", mainFrame);
577         createModel();
578         createBusyBlockLayerUI();
579         createMenu();
580         createMenuFileExit();
581         createMenuChangeLocale();
582         createMenuChangeLocaleUK();
583         createMenuChangeLocaleFR();
584         createMenuChangeLocaleES();
585         createBottomBar();
586         createAuthenticationLabel();
587         // inline creation of $JToolBar$Separator0
588         $objectMap.put("$JToolBar$Separator0", $JToolBar$Separator0 = new Separator());
589         
590         $JToolBar$Separator0.setName("$JToolBar$Separator0");
591         createSynchroWidget();
592         // inline creation of $JToolBar$Separator1
593         $objectMap.put("$JToolBar$Separator1", $JToolBar$Separator1 = new Separator());
594         
595         $JToolBar$Separator1.setName("$JToolBar$Separator1");
596         createValidatorMessageWidget();
597         createShowHelp();
598         createBody();
599         createStatus();
600         // inline creation of mainFrame
601         setName("mainFrame");
602         SwingUtil.setComponentHeight(mainFrame,1024);
603         SwingUtil.setComponentWidth(mainFrame,1280);
604         mainFrame.addWindowListener(JAXXUtil.getEventListener(WindowListener.class, "windowClosing", this, "doWindowClosing__on__mainFrame"));
605         
606         // registers 4 data bindings
607         $registerDefaultBindings();
608         $completeSetup();
609     }
610 
611     private void $registerDefaultBindings() {
612         // register 4 data bindings
613         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BUSY_BLOCK_LAYER_UI_BLOCK, true) {
614         
615             @Override
616             public void applyDataBinding() {
617                 if (getModel() != null) {
618                     getModel().addPropertyChangeListener("busy", this);
619                 }
620             }
621         
622             @Override
623             public void processDataBinding() {
624                 if (getModel() != null) {
625                     busyBlockLayerUI.setBlock(getModel().isBusy());
626                 }
627             }
628         
629             @Override
630             public void removeDataBinding() {
631                 if (getModel() != null) {
632                     getModel().removePropertyChangeListener("busy", this);
633                 }
634             }
635         });
636         registerDataBinding(new DefaultJAXXBinding(this, BINDING_BUSY_BLOCK_LAYER_UI_BLOCKING_COLOR, true) {
637         
638             @Override
639             public void applyDataBinding() {
640                 if (getModel() != null) {
641                     getModel().addPropertyChangeListener("configuration", this);
642                 }
643             }
644         
645             @Override
646             public void processDataBinding() {
647                 if (getModel() != null && getModel().getConfiguration() != null) {
648                     busyBlockLayerUI.setBlockingColor(getModel().getConfiguration().getColorBlockingLayer());
649                 }
650             }
651         
652             @Override
653             public void removeDataBinding() {
654                 if (getModel() != null) {
655                     getModel().removePropertyChangeListener("configuration", this);
656                 }
657             }
658         });
659         registerDataBinding(new DefaultJAXXBinding(this, BINDING_AUTHENTICATION_LABEL_TEXT, true) {
660         
661             @Override
662             public void applyDataBinding() {
663                 if (getModel() != null) {
664                     getModel().addPropertyChangeListener("authenticationLabel", this);
665                 }
666             }
667         
668             @Override
669             public void processDataBinding() {
670                 if (getModel() != null) {
671                     authenticationLabel.setText(t(getModel().getAuthenticationLabel()));
672                 }
673             }
674         
675             @Override
676             public void removeDataBinding() {
677                 if (getModel() != null) {
678                     getModel().removePropertyChangeListener("authenticationLabel", this);
679                 }
680             }
681         });
682         registerDataBinding(new DefaultJAXXBinding(this, BINDING_AUTHENTICATION_LABEL_TOOL_TIP_TEXT, true) {
683         
684             @Override
685             public void applyDataBinding() {
686                 if (getModel() != null) {
687                     getModel().addPropertyChangeListener("authenticationToolTipText", this);
688                 }
689             }
690         
691             @Override
692             public void processDataBinding() {
693                 if (getModel() != null) {
694                     authenticationLabel.setToolTipText(t(getModel().getAuthenticationToolTipText()));
695                 }
696             }
697         
698             @Override
699             public void removeDataBinding() {
700                 if (getModel() != null) {
701                     getModel().removePropertyChangeListener("authenticationToolTipText", this);
702                 }
703             }
704         });
705     }
706 
707 }