View Javadoc
1   package fr.ifremer.reefdb.ui.swing.content.manage.referential.user.local.password;
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.ReefDbUIContext;
30  import java.awt.BorderLayout;
31  import java.awt.Container;
32  import java.awt.Dialog;
33  import java.awt.Dialog.ModalityType;
34  import java.awt.Frame;
35  import java.awt.GraphicsConfiguration;
36  import java.awt.GridBagConstraints;
37  import java.awt.GridLayout;
38  import java.awt.Insets;
39  import java.awt.Window;
40  import java.awt.event.ActionEvent;
41  import java.awt.event.ActionListener;
42  import java.util.ArrayList;
43  import java.util.Arrays;
44  import java.util.HashMap;
45  import java.util.List;
46  import java.util.Map;
47  import java.util.TreeMap;
48  import javax.swing.JButton;
49  import javax.swing.JDialog;
50  import javax.swing.JLabel;
51  import javax.swing.JPanel;
52  import javax.swing.JPasswordField;
53  import javax.swing.event.DocumentEvent;
54  import javax.swing.event.DocumentListener;
55  import javax.swing.text.Document;
56  import jaxx.runtime.JAXXBinding;
57  import jaxx.runtime.JAXXContext;
58  import jaxx.runtime.JAXXObject;
59  import jaxx.runtime.JAXXObjectDescriptor;
60  import jaxx.runtime.JAXXUtil;
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 org.apache.commons.lang3.StringUtils;
66  import org.apache.commons.logging.Log;
67  import org.apache.commons.logging.LogFactory;
68  import static org.nuiton.i18n.I18n.t;
69  
70  public class PasswordUI extends JDialog implements JAXXObject {
71  
72      /*-----------------------------------------------------------------------*/
73      /*------------------ Constants for all public bindings ------------------*/
74      /*-----------------------------------------------------------------------*/
75  
76      public static final String BINDING_ACCEPT_BUTTON_ENABLED = "acceptButton.enabled";
77  
78      /*-----------------------------------------------------------------------*/
79      /*------------------------- Other static fields -------------------------*/
80      /*-----------------------------------------------------------------------*/
81  
82      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKVVz28bRRQeu7ETO2lJGxqVJqih7SGRqjFEHCoF0Z+ySOTQqDFSVV863h0nU83OTGdmm42iIv6E/glw54LErSfEgTMHLoh/ASEOXBFvdte73nhdB9WSV7vzvvfe996+7+33f6Ka0eij5ySKsA6FZQHFO/eePHnUf049+5AaTzNlpUbJr1JF1R6a97NzY9GNXse5t1L31gMZKCmoGPHe6qCmscecmkNKrUUfFj08Y1r7mXkrUqEeRs1IlUX99u+/qq/9b76rIhQpYNeEUtameeWVzHRQlfkWXYJML0mLE3EANDQTB8D3vDt7wIkxX5KAvkBfo9kOqiuiIZhF189echwj9o+URRcUPB1J7T9khMsDi7oDjdlA04BqrCkd+H0cMmyOgAX2pLAQFAdEkAMK5gF16cEThwbwXHpwO4yI99Kbr7aVijPWLWoEhIk9Iii36EqhNUmKLunzuLpG5jLPxEDuUmMgJzTH9SFK0Tsd0qfc4RYy+Plh/sx2cQKgzSiHdl8tRNwbNRYds15tTgqdIzL35SJi7uZOXP3HpyuJT4vYBY8Ij/L7obXQeLRUwCenDrmSOxDPo8rmprXUrtFKodcw4Dgf8HwCKz1U0yEcw8vpjWviMZgSNVw5pQYXMLb+u7z025s/fmwPJTAPuS+XQkcUDKOptFRUW+ZSv5fMf2gZb+0StdVDDUM5yD+W92oJsf3UDOQg30Xnjp07/oKYQwhRm/39p5+Xn/16DlXbqMkl8dvE4bdRwx5q6ILkfqTu3I0ZLRzNwXUR/lWLapZZDi26OtSCm/NswlNjLZA+gYGesTqkEbRntaQ9Gcd+45d/lvZ/uDtsUQUofzARnrep9hTVmeBM0HhPpCugdC/MK0NDX+ZSLxM/GlO/SnW6Hl9vjfWjYlET+sak2HarIFGmDog7iULnsxnX4+4+RUXlTosNvZ7jTlZtqWEETgoifeV6SyM76T0MHKiMQXEZ/D8OiydFNeckViaT2CxjcWpxTKMxA0pmn9wWu4IGUjAPvk9pQk8GcIKTvYCDzF54K/XEnLF9v8wZXo6VkneZ6k4GldVSWErTKqmNVXKtmOcl4cwnlk6sJdloWS3L5e6nq5kIm6XCfWBg63dP7mlNjg2mL0LCzTp8Wwqrf30Djxytb9xaG3ncLIVsvCpt2OhSPoPC6pwcSwCjC58BZ7LWZ8KHjf/5WOyKuzanRnTH8cdAlkdYPQOnGebJt8VYPBOL6C0Rrr1zhOsQ4T/vjcefPwoAAA==";
83      private static final Log log = LogFactory.getLog(PasswordUI.class);
84      private static final long serialVersionUID = 1L;
85  
86      /*-----------------------------------------------------------------------*/
87      /*--------------------------- Internal states ---------------------------*/
88      /*-----------------------------------------------------------------------*/
89  
90      protected List<Object> $activeBindings = new ArrayList<Object>();
91      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
92      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
93      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
94      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
95      private boolean allComponentsCreated;
96      protected final JAXXContext delegateContext = new DefaultJAXXContext();
97  
98      /*-----------------------------------------------------------------------*/
99      /*------------------------ Protected components  ------------------------*/
100     /*-----------------------------------------------------------------------*/
101 
102     protected JButton acceptButton;
103     protected JButton cancelButton;
104     protected final PasswordUIHandler handler = createHandler();
105     protected JLabel infoMessage;
106     protected Table mainPanel;
107     protected JPasswordField password2Field;
108     protected JLabel password2Label;
109     protected PasswordUI passwordDialog = this;
110     protected JPasswordField passwordField;
111     protected JLabel passwordLabel;
112 
113     /*-----------------------------------------------------------------------*/
114     /*------------------------- Private components  -------------------------*/
115     /*-----------------------------------------------------------------------*/
116 
117     private JPanel $JPanel0;
118 
119     /*-----------------------------------------------------------------------*/
120     /*---------------------- Raw body code from script ----------------------*/
121     /*-----------------------------------------------------------------------*/
122 
123     
124     
125         public PasswordUI open(String login) {
126             handler.open(login);
127             return this;
128         }
129     
130         public String getNewPassword() { return handler.getNewPassword(); }
131 
132     /*-----------------------------------------------------------------------*/
133     /*---------------------------- Constructors  ----------------------------*/
134     /*-----------------------------------------------------------------------*/
135 
136     public PasswordUI(ReefDbUIContext context) {
137         super(context.getExistingActionUI());
138                 ApplicationUIUtil.setApplicationContext(this, context);
139             $initialize();
140     }
141 
142     public PasswordUI(Frame param0, String param1, boolean param2) {
143         super(param0 ,param1 ,param2);
144         $initialize();
145     }
146 
147     public PasswordUI(JAXXContext parentContext, Frame param1, String param2, boolean param3) {
148         super(param1 ,param2 ,param3);
149         JAXXUtil.initContext(this, parentContext);
150         $initialize();
151     }
152 
153     public PasswordUI(Frame param0, String param1) {
154         super(param0 ,param1);
155         $initialize();
156     }
157 
158     public PasswordUI(JAXXContext parentContext, Frame param1, String param2) {
159         super(param1 ,param2);
160         JAXXUtil.initContext(this, parentContext);
161         $initialize();
162     }
163 
164     public PasswordUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
165         super(param0 ,param1 ,param2 ,param3);
166         $initialize();
167     }
168 
169     public PasswordUI(JAXXContext parentContext, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
170         super(param1 ,param2 ,param3 ,param4);
171         JAXXUtil.initContext(this, parentContext);
172         $initialize();
173     }
174 
175     public PasswordUI(Dialog param0) {
176         super(param0);
177         $initialize();
178     }
179 
180     public PasswordUI(JAXXContext parentContext, Dialog param1) {
181         super(param1);
182         JAXXUtil.initContext(this, parentContext);
183         $initialize();
184     }
185 
186     public PasswordUI(Frame param0, boolean param1) {
187         super(param0 ,param1);
188         $initialize();
189     }
190 
191     public PasswordUI(JAXXContext parentContext, Frame param1, boolean param2) {
192         super(param1 ,param2);
193         JAXXUtil.initContext(this, parentContext);
194         $initialize();
195     }
196 
197     public PasswordUI() {
198         $initialize();
199     }
200 
201     public PasswordUI(JAXXContext parentContext) {
202         JAXXUtil.initContext(this, parentContext);
203         $initialize();
204     }
205 
206     public PasswordUI(Frame param0) {
207         super(param0);
208         $initialize();
209     }
210 
211     public PasswordUI(JAXXContext parentContext, Frame param1) {
212         super(param1);
213         JAXXUtil.initContext(this, parentContext);
214         $initialize();
215     }
216 
217     public PasswordUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
218         super(param0 ,param1 ,param2 ,param3);
219         $initialize();
220     }
221 
222     public PasswordUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
223         super(param1 ,param2 ,param3 ,param4);
224         JAXXUtil.initContext(this, parentContext);
225         $initialize();
226     }
227 
228     public PasswordUI(Window param0) {
229         super(param0);
230         $initialize();
231     }
232 
233     public PasswordUI(JAXXContext parentContext, Window param1) {
234         super(param1);
235         JAXXUtil.initContext(this, parentContext);
236         $initialize();
237     }
238 
239     public PasswordUI(Window param0, ModalityType param1) {
240         super(param0 ,param1);
241         $initialize();
242     }
243 
244     public PasswordUI(JAXXContext parentContext, Window param1, ModalityType param2) {
245         super(param1 ,param2);
246         JAXXUtil.initContext(this, parentContext);
247         $initialize();
248     }
249 
250     public PasswordUI(Window param0, String param1) {
251         super(param0 ,param1);
252         $initialize();
253     }
254 
255     public PasswordUI(JAXXContext parentContext, Window param1, String param2) {
256         super(param1 ,param2);
257         JAXXUtil.initContext(this, parentContext);
258         $initialize();
259     }
260 
261     public PasswordUI(Window param0, String param1, ModalityType param2) {
262         super(param0 ,param1 ,param2);
263         $initialize();
264     }
265 
266     public PasswordUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3) {
267         super(param1 ,param2 ,param3);
268         JAXXUtil.initContext(this, parentContext);
269         $initialize();
270     }
271 
272     public PasswordUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
273         super(param0 ,param1 ,param2 ,param3);
274         $initialize();
275     }
276 
277     public PasswordUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
278         super(param1 ,param2 ,param3 ,param4);
279         JAXXUtil.initContext(this, parentContext);
280         $initialize();
281     }
282 
283     public PasswordUI(Dialog param0, boolean param1) {
284         super(param0 ,param1);
285         $initialize();
286     }
287 
288     public PasswordUI(JAXXContext parentContext, Dialog param1, boolean param2) {
289         super(param1 ,param2);
290         JAXXUtil.initContext(this, parentContext);
291         $initialize();
292     }
293 
294     public PasswordUI(Dialog param0, String param1) {
295         super(param0 ,param1);
296         $initialize();
297     }
298 
299     public PasswordUI(JAXXContext parentContext, Dialog param1, String param2) {
300         super(param1 ,param2);
301         JAXXUtil.initContext(this, parentContext);
302         $initialize();
303     }
304 
305     public PasswordUI(Dialog param0, String param1, boolean param2) {
306         super(param0 ,param1 ,param2);
307         $initialize();
308     }
309 
310     public PasswordUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3) {
311         super(param1 ,param2 ,param3);
312         JAXXUtil.initContext(this, parentContext);
313         $initialize();
314     }
315 
316     /*-----------------------------------------------------------------------*/
317     /*--------------------------- Statics methods ---------------------------*/
318     /*-----------------------------------------------------------------------*/
319 
320     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
321         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
322     }
323 
324     /*-----------------------------------------------------------------------*/
325     /*---------------------- JAXXObject implementation ----------------------*/
326     /*-----------------------------------------------------------------------*/
327 
328     @Override
329     public void applyDataBinding(String $binding) {
330         if (allComponentsCreated && $bindings.containsKey($binding)) {
331             getDataBinding($binding).applyDataBinding();
332         }
333         processDataBinding($binding);
334     }
335 
336     @Override
337     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
338         super.firePropertyChange(propertyName, oldValue, newValue);
339     }
340 
341     @Override
342     public Map<String, Object> get$objectMap() {
343         return $objectMap;
344     }
345 
346     @Override
347     public JAXXBinding getDataBinding(String bindingId) {
348         return $bindings.get(bindingId);
349     }
350 
351     @Override
352     public JAXXBinding[] getDataBindings() {
353         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
354     }
355 
356     @Override
357     public Object getObjectById(String id) {
358         return $objectMap.get(id);
359     }
360 
361     @Override
362     public void processDataBinding(String $binding, boolean $force) {
363         if (!$force && $activeBindings.contains($binding)) { 
364             return;
365         }
366         $activeBindings.add($binding);
367         try {
368             if (allComponentsCreated && $bindings.containsKey($binding)) {
369                 getDataBinding($binding).processDataBinding();
370             }
371         } finally {
372             $activeBindings.remove($binding);
373         }
374     }
375 
376     @Override
377     public void processDataBinding(String $binding) {
378         processDataBinding($binding, false);
379     }
380 
381     @Override
382     public void registerDataBinding(JAXXBinding binding) {
383         $bindings.put(binding.getId(), binding);
384     }
385 
386     @Override
387     public void removeDataBinding(String $binding) {
388         if (allComponentsCreated && $bindings.containsKey($binding)) {
389             getDataBinding($binding).removeDataBinding();
390         }
391     }
392 
393     /*-----------------------------------------------------------------------*/
394     /*--------------------- JAXXContext implementation  ---------------------*/
395     /*-----------------------------------------------------------------------*/
396 
397     @Override
398     public <T> T getContextValue(Class<T> clazz) {
399         return delegateContext.getContextValue(clazz, null);
400     }
401 
402     @Override
403     public <T> T getContextValue(Class<T> clazz, String name) {
404         return delegateContext.getContextValue(clazz, name);
405     }
406 
407     @Override
408     public JAXXContext getDelegateContext() {
409         return delegateContext;
410     }
411 
412     @Override
413     public <O extends Container> O getParentContainer(Class<O> clazz) {
414         return SwingUtil.getParentContainer(this, clazz);
415     }
416 
417     @Override
418     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
419         return SwingUtil.getParentContainer(source, clazz);
420     }
421 
422     @Override
423     public <T> void removeContextValue(Class<T> clazz) {
424         delegateContext.removeContextValue(clazz, null);
425     }
426 
427     @Override
428     public <T> void removeContextValue(Class<T> clazz, String name) {
429         delegateContext.removeContextValue(clazz, name);
430     }
431 
432     @Override
433     public <T> void setContextValue(T o) {
434         delegateContext.setContextValue(o, null);
435     }
436 
437     @Override
438     public <T> void setContextValue(T o, String name) {
439         delegateContext.setContextValue(o, name);
440     }
441 
442     /*-----------------------------------------------------------------------*/
443     /*---------------------------- Event methods ----------------------------*/
444     /*-----------------------------------------------------------------------*/
445 
446     public void doActionPerformed__on__acceptButton(ActionEvent event) {
447         if (log.isDebugEnabled()) {
448             log.debug(event);
449         }
450         handler.accept();
451     }
452 
453     public void doActionPerformed__on__cancelButton(ActionEvent event) {
454         if (log.isDebugEnabled()) {
455             log.debug(event);
456         }
457         handler.cancel();
458     }
459 
460     /*-----------------------------------------------------------------------*/
461     /*----------------------- Public acessor methods  -----------------------*/
462     /*-----------------------------------------------------------------------*/
463 
464     public JButton getAcceptButton() {
465         return acceptButton;
466     }
467 
468     public JButton getCancelButton() {
469         return cancelButton;
470     }
471 
472     public PasswordUIHandler getHandler() {
473         return handler;
474     }
475 
476     public JLabel getInfoMessage() {
477         return infoMessage;
478     }
479 
480     public Table getMainPanel() {
481         return mainPanel;
482     }
483 
484     public JPasswordField getPassword2Field() {
485         return password2Field;
486     }
487 
488     public JLabel getPassword2Label() {
489         return password2Label;
490     }
491 
492     public JPasswordField getPasswordField() {
493         return passwordField;
494     }
495 
496     public JLabel getPasswordLabel() {
497         return passwordLabel;
498     }
499 
500     /*-----------------------------------------------------------------------*/
501     /*--------------------- Protected acessors methods  ---------------------*/
502     /*-----------------------------------------------------------------------*/
503 
504     protected JPanel get$JPanel0() {
505         return $JPanel0;
506     }
507 
508     /*-----------------------------------------------------------------------*/
509     /*--------------------- Components creation methods ---------------------*/
510     /*-----------------------------------------------------------------------*/
511 
512     protected void addChildrenToMainPanel() {
513         if (!allComponentsCreated) {
514             return;
515         }
516         mainPanel.add(infoMessage, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
517         mainPanel.add(passwordLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
518         mainPanel.add(passwordField, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
519         mainPanel.add(password2Label, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
520         mainPanel.add(password2Field, new GridBagConstraints(1, 2, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
521         mainPanel.add($JPanel0, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
522     }
523 
524     protected void addChildrenToPasswordDialog() {
525         if (!allComponentsCreated) {
526             return;
527         }
528         add(mainPanel);
529     }
530 
531     protected void createAcceptButton() {
532         $objectMap.put("acceptButton", acceptButton = new JButton());
533         
534         acceptButton.setName("acceptButton");
535         acceptButton.setText(t("reefdb.common.validate"));
536         acceptButton.setToolTipText(t("reefdb.common.validate"));
537         acceptButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__acceptButton"));
538     }
539 
540     protected void createCancelButton() {
541         $objectMap.put("cancelButton", cancelButton = new JButton());
542         
543         cancelButton.setName("cancelButton");
544         cancelButton.setText(t("reefdb.common.cancel"));
545         cancelButton.setToolTipText(t("reefdb.common.cancel"));
546         cancelButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__cancelButton"));
547     }
548 
549     protected PasswordUIHandler createHandler() {
550         return new PasswordUIHandler();
551     }
552 
553     protected void createInfoMessage() {
554         $objectMap.put("infoMessage", infoMessage = new JLabel());
555         
556         infoMessage.setName("infoMessage");
557     }
558 
559     protected void createMainPanel() {
560         $objectMap.put("mainPanel", mainPanel = new Table());
561         
562         mainPanel.setName("mainPanel");
563     }
564 
565     protected void createPassword2Field() {
566         $objectMap.put("password2Field", password2Field = new JPasswordField());
567         
568         password2Field.setName("password2Field");
569         password2Field.setColumns(15);
570     }
571 
572     protected void createPassword2Label() {
573         $objectMap.put("password2Label", password2Label = new JLabel());
574         
575         password2Label.setName("password2Label");
576         password2Label.setText(t("reefdb.user.password.field2"));
577     }
578 
579     protected void createPasswordField() {
580         $objectMap.put("passwordField", passwordField = new JPasswordField());
581         
582         passwordField.setName("passwordField");
583         passwordField.setColumns(15);
584     }
585 
586     protected void createPasswordLabel() {
587         $objectMap.put("passwordLabel", passwordLabel = new JLabel());
588         
589         passwordLabel.setName("passwordLabel");
590         passwordLabel.setText(t("reefdb.user.password.field"));
591     }
592 
593     /*-----------------------------------------------------------------------*/
594     /*------------------------ Internal jaxx methods ------------------------*/
595     /*-----------------------------------------------------------------------*/
596 
597     private void $completeSetup() {
598         allComponentsCreated = true;
599         if (log.isDebugEnabled()) {
600             log.debug(this);
601         }
602         addChildrenToPasswordDialog();
603         addChildrenToMainPanel();
604         // inline complete setup of $JPanel0
605         $JPanel0.add(cancelButton);
606         $JPanel0.add(acceptButton);
607         
608         // apply 1 data bindings
609         JAXXUtil.applyDataBinding(this, $bindings.keySet());
610         
611         // apply 9 property setters
612         infoMessage.setIcon(SwingUtil.createActionIcon("information"));
613         passwordLabel.setLabelFor(passwordField);
614         password2Label.setLabelFor(password2Field);
615         cancelButton.setMnemonic(SwingUtil.getFirstCharAt(t("reefdb.common.cancel.mnemonic"),'Z'));
616         cancelButton.setIcon(SwingUtil.createActionIcon("cancel"));
617         acceptButton.setMnemonic(SwingUtil.getFirstCharAt(t("reefdb.common.validate.mnemonic"),'Z'));
618         acceptButton.setIcon(SwingUtil.createActionIcon("accept"));
619         // late initializer
620         passwordDialog.pack();
621     }
622 
623     private void $initialize() {
624         if (allComponentsCreated) {
625             return;
626         }
627         if (log.isDebugEnabled()) {
628             log.debug(this);
629         }
630         handler.beforeInit(this);
631         $objectMap.put("passwordDialog", passwordDialog);
632         createMainPanel();
633         createInfoMessage();
634         createPasswordLabel();
635         createPasswordField();
636         createPassword2Label();
637         createPassword2Field();
638         // inline creation of $JPanel0
639         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
640         
641         $JPanel0.setName("$JPanel0");
642         $JPanel0.setLayout(new GridLayout(1,0));
643         createCancelButton();
644         createAcceptButton();
645         // inline creation of passwordDialog
646         setName("passwordDialog");
647         passwordDialog.getContentPane().setLayout(new BorderLayout());
648         setTitle(t("reefdb.user.password.title"));
649         setModal(true);
650         
651         // registers 1 data bindings
652         $registerDefaultBindings();
653         $completeSetup();
654         handler.afterInit(this);
655     }
656 
657     private void $registerDefaultBindings() {
658         // register 1 data bindings
659         registerDataBinding(new DefaultJAXXBinding(this, BINDING_ACCEPT_BUTTON_ENABLED, true, true) {
660         
661             @Override
662             public void applyDataBinding() {
663                 if (getPasswordField() != null) {
664                     $bindingSources.put("getPasswordField().getDocument()", getPasswordField().getDocument());
665                     getPasswordField().getDocument().addDocumentListener( JAXXUtil.getEventListener(DocumentListener.class, this, "$pr$u0"));
666                     getPasswordField().addPropertyChangeListener("document", JAXXUtil.getDataBindingUpdateListener(fr.ifremer.reefdb.ui.swing.content.manage.referential.user.local.password.PasswordUI.this, BINDING_ACCEPT_BUTTON_ENABLED));
667                 }
668                 if (getPassword2Field() != null) {
669                     $bindingSources.put(" getPassword2Field().getDocument()",  getPassword2Field().getDocument());
670                      getPassword2Field().getDocument().addDocumentListener( JAXXUtil.getEventListener(DocumentListener.class, this, "$pr$u0"));
671                     getPassword2Field().addPropertyChangeListener("document", JAXXUtil.getDataBindingUpdateListener(fr.ifremer.reefdb.ui.swing.content.manage.referential.user.local.password.PasswordUI.this, BINDING_ACCEPT_BUTTON_ENABLED));
672                 }
673             }
674         
675             @Override
676             public void processDataBinding() {
677                 if (getPasswordField() != null && getPassword2Field() != null) {
678                     acceptButton.setEnabled(Arrays.equals(getPasswordField().getPassword(), getPassword2Field().getPassword()));
679                 }
680             }
681         
682             @Override
683             public void removeDataBinding() {
684                 if (getPasswordField() != null) {
685                     Document $target = (Document) $bindingSources.remove("getPasswordField().getDocument()");
686                     if ($target != null) {
687                         $target.removeDocumentListener( JAXXUtil.getEventListener(DocumentListener.class, this, "$pr$u0"));
688                     }
689                     getPasswordField().removePropertyChangeListener("document", JAXXUtil.getDataBindingUpdateListener(fr.ifremer.reefdb.ui.swing.content.manage.referential.user.local.password.PasswordUI.this, BINDING_ACCEPT_BUTTON_ENABLED));
690                 }
691                 if (getPassword2Field() != null) {
692                     Document $target = (Document) $bindingSources.remove(" getPassword2Field().getDocument()");
693                     if ($target != null) {
694                         $target.removeDocumentListener( JAXXUtil.getEventListener(DocumentListener.class, this, "$pr$u0"));
695                     }
696                     getPassword2Field().removePropertyChangeListener("document", JAXXUtil.getDataBindingUpdateListener(fr.ifremer.reefdb.ui.swing.content.manage.referential.user.local.password.PasswordUI.this, BINDING_ACCEPT_BUTTON_ENABLED));
697                 }
698             }
699         
700             public void $pr$u0(DocumentEvent event) {
701                 if (log.isDebugEnabled()) {
702                     log.debug(event);
703                 }
704                 propertyChange(null);
705             }
706         });
707     }
708 
709 }