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