View Javadoc
1   package fr.ifremer.dali.ui.swing.content.home.survey.qualify;
2   
3   import fr.ifremer.dali.dto.referential.QualityLevelDTO;
4   import fr.ifremer.dali.ui.swing.DaliHelpBroker;
5   import fr.ifremer.dali.ui.swing.DaliUIContext;
6   import fr.ifremer.dali.ui.swing.util.DaliUI;
7   import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
8   import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
9   import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedComboBox;
10  import java.awt.BorderLayout;
11  import java.awt.Container;
12  import java.awt.Dialog;
13  import java.awt.Dialog.ModalityType;
14  import java.awt.Frame;
15  import java.awt.GraphicsConfiguration;
16  import java.awt.GridBagConstraints;
17  import java.awt.GridLayout;
18  import java.awt.Insets;
19  import java.awt.Window;
20  import java.awt.event.ActionEvent;
21  import java.awt.event.ActionListener;
22  import java.awt.event.KeyEvent;
23  import java.awt.event.KeyListener;
24  import java.util.ArrayList;
25  import java.util.HashMap;
26  import java.util.List;
27  import java.util.Map;
28  import java.util.TreeMap;
29  import javax.swing.JButton;
30  import javax.swing.JDialog;
31  import javax.swing.JLabel;
32  import javax.swing.JPanel;
33  import javax.swing.JScrollPane;
34  import javax.swing.JTextArea;
35  import jaxx.runtime.JAXXBinding;
36  import jaxx.runtime.JAXXContext;
37  import jaxx.runtime.JAXXObject;
38  import jaxx.runtime.JAXXObjectDescriptor;
39  import jaxx.runtime.JAXXUtil;
40  import jaxx.runtime.JAXXValidator;
41  import jaxx.runtime.SwingUtil;
42  import jaxx.runtime.binding.DefaultJAXXBinding;
43  import jaxx.runtime.context.DefaultJAXXContext;
44  import jaxx.runtime.swing.Table;
45  import jaxx.runtime.validator.swing.SwingValidator;
46  import jaxx.runtime.validator.swing.SwingValidatorUtil;
47  import jaxx.runtime.validator.swing.meta.Validator;
48  import jaxx.runtime.validator.swing.meta.ValidatorField;
49  import jaxx.runtime.validator.swing.ui.ImageValidationUI;
50  import org.apache.commons.logging.Log;
51  import org.apache.commons.logging.LogFactory;
52  import static org.nuiton.i18n.I18n.t;
53  
54  public class QualifySurveyUI extends JDialog implements DaliUI<QualifySurveyUIModel, QualifySurveyUIHandler>, JAXXObject, JAXXValidator {
55  
56      /*-----------------------------------------------------------------------*/
57      /*------------------ Constants for all public bindings ------------------*/
58      /*-----------------------------------------------------------------------*/
59  
60      public static final String BINDING_COMMENT_EDITOR_TEXT = "commentEditor.text";
61      public static final String BINDING_QUALIFY_BUTTON_ENABLED = "qualifyButton.enabled";
62      public static final String BINDING_QUALITY_LEVEL_COMBO_SELECTED_ITEM = "qualityLevelCombo.selectedItem";
63  
64      /*-----------------------------------------------------------------------*/
65      /*------------------------- Other static fields -------------------------*/
66      /*-----------------------------------------------------------------------*/
67  
68      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAK1WS28cRRDu3XjX3rUdY5skjmIkJwSUABoHkBCSQ3Bix2KtNXnsgiJ8oXemd92hZ3rS02PPYgXxExD8AThx4YLEjRPiwJkDF8RfQBEHrojqntl57Mw+kLCUcTxV9dVX1VVfz3d/ooon0OXHOAgM4TuS2sTYv/3o0b3OY2LKXeKZgrqSCxT+lMqofIjmrfi9J9GLh00VvhmFb+5w2+UOcVLRW01U92SfEe+IECnRC9kI0/M2W7F5K3B9MUCNSRWhfv3Xs/IX1ufflBEKXGC3CKVsTIpKKplpojK1JFqBTMd4k2GnBzQEdXrAd1G922HY897HNnmCPkOzTVR1sQAwia5MX7LG0PGBK9HSEx8z2u23fHFM+h80JNrtCoN2BbGJMCywGT41vBMgYZjckYBpHHGoxNMBRhRuPMjCuK5OUZWoYnOLMIka/wfsgcJKsGvHYLUwVCfRq5k+x4YoR0s9Pxy8TBBmr7Zxh5EbEq1l4sMobVOetThgweS2DWybuKOqWlGnEkTu+/qlclyJ/Zcj/5YpOGP3sUMkupAJSizZyMUo8q5FdYHnMlFtEsjbgmDlvJZk032T/SY5Jixmc2GIUtoJJqXDJXondTpgtgTtkTfTRxTNk9Eh2DHuBnBgFrF08B0e5Ep2ulTYWFLujCIxd3VflcxuDPdQvx3uOXZMwu74UsKooNWMf/hWeb6UtC4an8T2SuQg0KXMOcOmG8mmJ6tYOkQV4cNrGIzDvDg8BFMoC2tDsqAAtfWf86u//fjHD3sDLTgLuc8VuqakDHbUFdwlQlKVeikUAl9StnmA3a1DVPMIAx3UOrdeQKwVmYEc5FtW4YYKN97D3hFAVGZ//+nn8x//egaV91CdcWztYeXfQDV5JKALnFmB++62ZrRwMgfP5+DfGdg1sNJP1ULATncx89RvSaX6e0MvNADBgcerG21y5KJkAMPCzEjhkwAat17QuJh9p/bL36ut77cHzStBMRdHuicNrHyEqtRh1CFaSiOVLJTOedcjvsUTNSzSR5QXSDcSjzf0861cq8ow20wN/Z5a2qXTzBY/VQ2AzZXo2piWYe8TCN4JAwNf5bmlm6D+t42GRGgSoVKc8/lTrcVGj8gI/Nr1p0X4Wen5bxWvnubkJan6oq46GvFI5WV/j+FeEY28mk2iArtf71ImiQgHVU8b1ANzfbJLTC7Cu2IwvwvhNhGrIYkN7JL+PEhlhiZBhQPSEJWmBYuhwB8ST31HDIBnlEzC7RICFvY4r8LTH+SVMcNjE8/DPVKYMifMk1JWoFr6+tvOgUNs7lATREenVvORSm3H5npIqqHudFTFpklcGdNeLYiVaF5yztrUbY/xmSWOOlD4NlqOzoh6+jYfNcCZC2BSlTO5Ki+lWYS3z8giQ3Nc5Eo+dLjGApfiLU9de1MMR5XhPgdndPYmfOXgjQ51LLgib+WwS+pZn2bcBD+Bi2blZqipG1jC12jHl2QE5voUmHNqNdp9V+vwV8U4lyfiqNdfjkF4eZrqqBl+HIzAuD4Vi2/HILwGCP8CjHYLHdIMAAA=";
69      private static final Log log = LogFactory.getLog(QualifySurveyUI.class);
70      private static final long serialVersionUID = 1L;
71  
72      /*-----------------------------------------------------------------------*/
73      /*--------------------------- Internal states ---------------------------*/
74      /*-----------------------------------------------------------------------*/
75  
76      protected List<Object> $activeBindings = new ArrayList<Object>();
77      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
78      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
79      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
80      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
81      private boolean allComponentsCreated;
82      protected final JAXXContext delegateContext = new DefaultJAXXContext();
83  
84      /*-----------------------------------------------------------------------*/
85      /*------------------------ Protected components  ------------------------*/
86      /*-----------------------------------------------------------------------*/
87  
88      protected JButton cancelButton;
89      protected JTextArea commentEditor;
90      protected JLabel commentLabel;
91      @ValidatorField( validatorId = "validator",  propertyName = "comment",  editorName = "commentScrollPane")
92      protected JScrollPane commentScrollPane;
93      protected JLabel confirmationLabel;
94      protected final QualifySurveyUIHandler handler = createHandler();
95      protected QualifySurveyUIModel model;
96      protected JButton qualifyButton;
97      protected QualifySurveyUI qualifySurveyUI = this;
98      @ValidatorField( validatorId = "validator",  propertyName = "qualityLevel",  editorName = "qualityLevelCombo")
99      protected ExtendedComboBox<QualityLevelDTO> qualityLevelCombo;
100     protected JLabel qualityLevelLabel;
101     @Validator( validatorId = "validator")
102     protected SwingValidator<QualifySurveyUIModel> validator;
103     protected List<String> validatorIds = new ArrayList<String>();
104 
105     /*-----------------------------------------------------------------------*/
106     /*------------------------- Private components  -------------------------*/
107     /*-----------------------------------------------------------------------*/
108 
109     private JPanel $JPanel0;
110     private Table $Table0;
111 
112     /*-----------------------------------------------------------------------*/
113     /*---------------------------- Constructors  ----------------------------*/
114     /*-----------------------------------------------------------------------*/
115 
116     public QualifySurveyUI(DaliUIContext context) {
117         super(context.getMainUI());
118         			ApplicationUIUtil.setApplicationContext(this, context);
119             $initialize();
120     }
121 
122     public QualifySurveyUI(Window param0) {
123         super(param0);
124         $initialize();
125     }
126 
127     public QualifySurveyUI(JAXXContext parentContext, Window param1) {
128         super(param1);
129         JAXXUtil.initContext(this, parentContext);
130         $initialize();
131     }
132 
133     public QualifySurveyUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
134         super(param0 ,param1 ,param2 ,param3);
135         $initialize();
136     }
137 
138     public QualifySurveyUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
139         super(param1 ,param2 ,param3 ,param4);
140         JAXXUtil.initContext(this, parentContext);
141         $initialize();
142     }
143 
144     public QualifySurveyUI(Dialog param0, String param1, boolean param2) {
145         super(param0 ,param1 ,param2);
146         $initialize();
147     }
148 
149     public QualifySurveyUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3) {
150         super(param1 ,param2 ,param3);
151         JAXXUtil.initContext(this, parentContext);
152         $initialize();
153     }
154 
155     public QualifySurveyUI(Dialog param0, String param1) {
156         super(param0 ,param1);
157         $initialize();
158     }
159 
160     public QualifySurveyUI(JAXXContext parentContext, Dialog param1, String param2) {
161         super(param1 ,param2);
162         JAXXUtil.initContext(this, parentContext);
163         $initialize();
164     }
165 
166     public QualifySurveyUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
167         super(param0 ,param1 ,param2 ,param3);
168         $initialize();
169     }
170 
171     public QualifySurveyUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
172         super(param1 ,param2 ,param3 ,param4);
173         JAXXUtil.initContext(this, parentContext);
174         $initialize();
175     }
176 
177     public QualifySurveyUI(Window param0, String param1, ModalityType param2) {
178         super(param0 ,param1 ,param2);
179         $initialize();
180     }
181 
182     public QualifySurveyUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3) {
183         super(param1 ,param2 ,param3);
184         JAXXUtil.initContext(this, parentContext);
185         $initialize();
186     }
187 
188     public QualifySurveyUI(Window param0, String param1) {
189         super(param0 ,param1);
190         $initialize();
191     }
192 
193     public QualifySurveyUI(JAXXContext parentContext, Window param1, String param2) {
194         super(param1 ,param2);
195         JAXXUtil.initContext(this, parentContext);
196         $initialize();
197     }
198 
199     public QualifySurveyUI(Window param0, ModalityType param1) {
200         super(param0 ,param1);
201         $initialize();
202     }
203 
204     public QualifySurveyUI(JAXXContext parentContext, Window param1, ModalityType param2) {
205         super(param1 ,param2);
206         JAXXUtil.initContext(this, parentContext);
207         $initialize();
208     }
209 
210     public QualifySurveyUI(Frame param0, String param1) {
211         super(param0 ,param1);
212         $initialize();
213     }
214 
215     public QualifySurveyUI(JAXXContext parentContext, Frame param1, String param2) {
216         super(param1 ,param2);
217         JAXXUtil.initContext(this, parentContext);
218         $initialize();
219     }
220 
221     public QualifySurveyUI(Frame param0, boolean param1) {
222         super(param0 ,param1);
223         $initialize();
224     }
225 
226     public QualifySurveyUI(JAXXContext parentContext, Frame param1, boolean param2) {
227         super(param1 ,param2);
228         JAXXUtil.initContext(this, parentContext);
229         $initialize();
230     }
231 
232     public QualifySurveyUI(Frame param0) {
233         super(param0);
234         $initialize();
235     }
236 
237     public QualifySurveyUI(JAXXContext parentContext, Frame param1) {
238         super(param1);
239         JAXXUtil.initContext(this, parentContext);
240         $initialize();
241     }
242 
243     public QualifySurveyUI() {
244         $initialize();
245     }
246 
247     public QualifySurveyUI(JAXXContext parentContext) {
248         JAXXUtil.initContext(this, parentContext);
249         $initialize();
250     }
251 
252     public QualifySurveyUI(Dialog param0, boolean param1) {
253         super(param0 ,param1);
254         $initialize();
255     }
256 
257     public QualifySurveyUI(JAXXContext parentContext, Dialog param1, boolean param2) {
258         super(param1 ,param2);
259         JAXXUtil.initContext(this, parentContext);
260         $initialize();
261     }
262 
263     public QualifySurveyUI(Dialog param0) {
264         super(param0);
265         $initialize();
266     }
267 
268     public QualifySurveyUI(JAXXContext parentContext, Dialog param1) {
269         super(param1);
270         JAXXUtil.initContext(this, parentContext);
271         $initialize();
272     }
273 
274     public QualifySurveyUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
275         super(param0 ,param1 ,param2 ,param3);
276         $initialize();
277     }
278 
279     public QualifySurveyUI(JAXXContext parentContext, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
280         super(param1 ,param2 ,param3 ,param4);
281         JAXXUtil.initContext(this, parentContext);
282         $initialize();
283     }
284 
285     public QualifySurveyUI(Frame param0, String param1, boolean param2) {
286         super(param0 ,param1 ,param2);
287         $initialize();
288     }
289 
290     public QualifySurveyUI(JAXXContext parentContext, Frame param1, String param2, boolean param3) {
291         super(param1 ,param2 ,param3);
292         JAXXUtil.initContext(this, parentContext);
293         $initialize();
294     }
295 
296     /*-----------------------------------------------------------------------*/
297     /*--------------------------- Statics methods ---------------------------*/
298     /*-----------------------------------------------------------------------*/
299 
300     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
301         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
302     }
303 
304     /*-----------------------------------------------------------------------*/
305     /*---------------------- JAXXObject implementation ----------------------*/
306     /*-----------------------------------------------------------------------*/
307 
308     @Override
309     public void applyDataBinding(String $binding) {
310         if (allComponentsCreated && $bindings.containsKey($binding)) {
311             getDataBinding($binding).applyDataBinding();
312         }
313         processDataBinding($binding);
314     }
315 
316     @Override
317     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
318         super.firePropertyChange(propertyName, oldValue, newValue);
319     }
320 
321     @Override
322     public Map<String, Object> get$objectMap() {
323         return $objectMap;
324     }
325 
326     @Override
327     public JAXXBinding getDataBinding(String bindingId) {
328         return $bindings.get(bindingId);
329     }
330 
331     @Override
332     public JAXXBinding[] getDataBindings() {
333         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
334     }
335 
336     @Override
337     public Object getObjectById(String id) {
338         return $objectMap.get(id);
339     }
340 
341     @Override
342     public void processDataBinding(String $binding, boolean $force) {
343         if (!$force && $activeBindings.contains($binding)) { 
344             return;
345         }
346         $activeBindings.add($binding);
347         try {
348             if (allComponentsCreated && $bindings.containsKey($binding)) {
349                 getDataBinding($binding).processDataBinding();
350             }
351         } finally {
352             $activeBindings.remove($binding);
353         }
354     }
355 
356     @Override
357     public void processDataBinding(String $binding) {
358         processDataBinding($binding, false);
359     }
360 
361     @Override
362     public void registerDataBinding(JAXXBinding binding) {
363         $bindings.put(binding.getId(), binding);
364     }
365 
366     @Override
367     public void removeDataBinding(String $binding) {
368         if (allComponentsCreated && $bindings.containsKey($binding)) {
369             getDataBinding($binding).removeDataBinding();
370         }
371     }
372 
373     /*-----------------------------------------------------------------------*/
374     /*--------------------- JAXXContext implementation  ---------------------*/
375     /*-----------------------------------------------------------------------*/
376 
377     @Override
378     public <T> T getContextValue(Class<T> clazz) {
379         return delegateContext.getContextValue(clazz, null);
380     }
381 
382     @Override
383     public <T> T getContextValue(Class<T> clazz, String name) {
384         return delegateContext.getContextValue(clazz, name);
385     }
386 
387     @Override
388     public JAXXContext getDelegateContext() {
389         return delegateContext;
390     }
391 
392     @Override
393     public <O extends Container> O getParentContainer(Class<O> clazz) {
394         return SwingUtil.getParentContainer(this, clazz);
395     }
396 
397     @Override
398     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
399         return SwingUtil.getParentContainer(source, clazz);
400     }
401 
402     @Override
403     public <T> void removeContextValue(Class<T> clazz) {
404         delegateContext.removeContextValue(clazz, null);
405     }
406 
407     @Override
408     public <T> void removeContextValue(Class<T> clazz, String name) {
409         delegateContext.removeContextValue(clazz, name);
410     }
411 
412     @Override
413     public <T> void setContextValue(T o) {
414         delegateContext.setContextValue(o, null);
415     }
416 
417     @Override
418     public <T> void setContextValue(T o, String name) {
419         delegateContext.setContextValue(o, name);
420     }
421 
422     /*-----------------------------------------------------------------------*/
423     /*-------------------- JAXXValidator implementation  --------------------*/
424     /*-----------------------------------------------------------------------*/
425 
426     @Override
427     public SwingValidator<?> getValidator(String validatorId) {
428         return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
429     }
430 
431     @Override
432     public List<String> getValidatorIds() {
433         return validatorIds;
434     }
435 
436     @Override
437     public void registerValidatorFields() {
438         SwingValidatorUtil.detectValidatorFields(this);
439     }
440 
441     /*-----------------------------------------------------------------------*/
442     /*---------------------------- Event methods ----------------------------*/
443     /*-----------------------------------------------------------------------*/
444 
445     public void doActionPerformed__on__cancelButton(ActionEvent event) {
446         if (log.isDebugEnabled()) {
447             log.debug(event);
448         }
449         handler.cancel();
450     }
451 
452     public void doActionPerformed__on__qualifyButton(ActionEvent event) {
453         if (log.isDebugEnabled()) {
454             log.debug(event);
455         }
456         handler.qualify();
457     }
458 
459     public void doKeyReleased__on__commentEditor(KeyEvent event) {
460         if (log.isDebugEnabled()) {
461             log.debug(event);
462         }
463         handler.setText(event, "comment");
464     }
465 
466     /*-----------------------------------------------------------------------*/
467     /*----------------------- Public acessor methods  -----------------------*/
468     /*-----------------------------------------------------------------------*/
469 
470     public JButton getCancelButton() {
471         return cancelButton;
472     }
473 
474     public JTextArea getCommentEditor() {
475         return commentEditor;
476     }
477 
478     public JLabel getCommentLabel() {
479         return commentLabel;
480     }
481 
482     public JScrollPane getCommentScrollPane() {
483         return commentScrollPane;
484     }
485 
486     public JLabel getConfirmationLabel() {
487         return confirmationLabel;
488     }
489 
490     public QualifySurveyUIHandler getHandler() {
491         return handler;
492     }
493 
494     public QualifySurveyUIModel getModel() {
495         return model;
496     }
497 
498     public JButton getQualifyButton() {
499         return qualifyButton;
500     }
501 
502     public ExtendedComboBox<QualityLevelDTO> getQualityLevelCombo() {
503         return qualityLevelCombo;
504     }
505 
506     public JLabel getQualityLevelLabel() {
507         return qualityLevelLabel;
508     }
509 
510     public SwingValidator<QualifySurveyUIModel> getValidator() {
511         return validator;
512     }
513 
514     /*-----------------------------------------------------------------------*/
515     /*--------------------- Protected acessors methods  ---------------------*/
516     /*-----------------------------------------------------------------------*/
517 
518     protected JPanel get$JPanel0() {
519         return $JPanel0;
520     }
521 
522     protected Table get$Table0() {
523         return $Table0;
524     }
525 
526     /*-----------------------------------------------------------------------*/
527     /*--------------------- Components creation methods ---------------------*/
528     /*-----------------------------------------------------------------------*/
529 
530     protected void addChildrenToCommentScrollPane() {
531         if (!allComponentsCreated) {
532             return;
533         }
534         commentScrollPane.getViewport().add(commentEditor);
535     }
536 
537     protected void addChildrenToQualifySurveyUI() {
538         if (!allComponentsCreated) {
539             return;
540         }
541         add($Table0);
542         add($JPanel0, BorderLayout.PAGE_END);
543     }
544 
545     protected void addChildrenToValidator() {
546         if (!allComponentsCreated) {
547             return;
548         }
549         validator.setUiClass(ImageValidationUI.class);
550         validator.setBean(model);
551     }
552 
553     protected void createCancelButton() {
554         $objectMap.put("cancelButton", cancelButton = new JButton());
555         
556         cancelButton.setName("cancelButton");
557         cancelButton.setText(t("dali.common.cancel"));
558         cancelButton.setToolTipText(t("dali.common.cancel"));
559         cancelButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__cancelButton"));
560     }
561 
562     protected void createCommentEditor() {
563         $objectMap.put("commentEditor", commentEditor = new JTextArea());
564         
565         commentEditor.setName("commentEditor");
566         commentEditor.setColumns(15);
567         commentEditor.setLineWrap(true);
568         commentEditor.setWrapStyleWord(true);
569         commentEditor.setRows(4);
570         commentEditor.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__commentEditor"));
571     }
572 
573     protected void createCommentLabel() {
574         $objectMap.put("commentLabel", commentLabel = new JLabel());
575         
576         commentLabel.setName("commentLabel");
577         commentLabel.setText(t("dali.action.qualify.survey.askForComment"));
578     }
579 
580     protected void createCommentScrollPane() {
581         $objectMap.put("commentScrollPane", commentScrollPane = new JScrollPane());
582         
583         commentScrollPane.setName("commentScrollPane");
584     }
585 
586     protected void createConfirmationLabel() {
587         $objectMap.put("confirmationLabel", confirmationLabel = new JLabel());
588         
589         confirmationLabel.setName("confirmationLabel");
590         confirmationLabel.setText(t("dali.action.qualify.survey.message"));
591     }
592 
593     protected QualifySurveyUIHandler createHandler() {
594         return new QualifySurveyUIHandler();
595     }
596 
597     protected void createModel() {
598         $objectMap.put("model", model = getContextValue(QualifySurveyUIModel.class));
599     }
600 
601     protected void createQualifyButton() {
602         $objectMap.put("qualifyButton", qualifyButton = new JButton());
603         
604         qualifyButton.setName("qualifyButton");
605         qualifyButton.setText(t("dali.common.qualify"));
606         qualifyButton.setToolTipText(t("dali.common.qualify"));
607         qualifyButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__qualifyButton"));
608     }
609 
610     protected void createQualityLevelCombo() {
611         $objectMap.put("qualityLevelCombo", qualityLevelCombo = new ExtendedComboBox<QualityLevelDTO>(this));
612         
613         qualityLevelCombo.setName("qualityLevelCombo");
614         qualityLevelCombo.setFilterable(true);
615         qualityLevelCombo.setShowDecorator(false);
616         qualityLevelCombo.setProperty("qualityLevel");
617         qualityLevelCombo.setShowReset(false);
618     }
619 
620     protected void createQualityLevelLabel() {
621         $objectMap.put("qualityLevelLabel", qualityLevelLabel = new JLabel());
622         
623         qualityLevelLabel.setName("qualityLevelLabel");
624         qualityLevelLabel.setText(t("dali.property.qualityFlag"));
625     }
626 
627     protected void createValidator() {
628         $objectMap.put("validator", validator = SwingValidator.newValidator(QualifySurveyUIModel.class, null));
629     }
630 
631     /*-----------------------------------------------------------------------*/
632     /*------------------------ Internal jaxx methods ------------------------*/
633     /*-----------------------------------------------------------------------*/
634 
635     private void $completeSetup() {
636         allComponentsCreated = true;
637         if (log.isDebugEnabled()) {
638             log.debug(this);
639         }
640         addChildrenToQualifySurveyUI();
641         addChildrenToValidator();
642         // inline complete setup of $Table0
643         $Table0.add(commentLabel, new GridBagConstraints(0, 0, 2, 1, 0.0, 0.0, 10, 1, new Insets(5, 5, 5, 5), 0, 0));
644         $Table0.add(SwingUtil.boxComponentWithJxLayer(commentScrollPane), new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, 10, 1, new Insets(5, 5, 5, 5), 0, 0));
645         $Table0.add(qualityLevelLabel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 10, 1, new Insets(5, 5, 5, 5), 0, 0));
646         $Table0.add(SwingUtil.boxComponentWithJxLayer(qualityLevelCombo), new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, 10, 1, new Insets(5, 5, 5, 5), 0, 0));
647         $Table0.add(confirmationLabel, new GridBagConstraints(0, 3, 2, 1, 0.0, 0.0, 10, 1, new Insets(5, 5, 5, 5), 0, 0));
648         addChildrenToCommentScrollPane();
649         // inline complete setup of $JPanel0
650         $JPanel0.add(cancelButton);
651         $JPanel0.add(qualifyButton);
652         
653         // apply 3 data bindings
654         JAXXUtil.applyDataBinding(this, $bindings.keySet());
655         
656         // apply 10 property setters
657         qualityLevelCombo.setBeanType(QualityLevelDTO.class);
658         commentLabel.setLabelFor(commentEditor);
659         qualityLevelLabel.setLabelFor(qualityLevelCombo);
660         qualityLevelCombo.setBean(model);
661         cancelButton.setMnemonic(SwingUtil.getFirstCharAt(t("dali.common.cancel.mnemonic"),'Z'));
662         cancelButton.setIcon(SwingUtil.createActionIcon("cancel"));
663         qualifyButton.setMnemonic(SwingUtil.getFirstCharAt(t("dali.common.qualify.mnemonic"),'Z'));
664         qualifyButton.setIcon(SwingUtil.createActionIcon("accept"));
665         // late initializer
666         qualifySurveyUI.pack();
667         // register 1 validator(s)
668         validatorIds = SwingValidatorUtil.detectValidators(this);
669         SwingValidatorUtil.installUI(this);
670     }
671 
672     private void $initialize() {
673         if (allComponentsCreated) {
674             return;
675         }
676         if (log.isDebugEnabled()) {
677             log.debug(this);
678         }
679         handler.beforeInit(this);
680         $objectMap.put("qualifySurveyUI", qualifySurveyUI);
681         createModel();
682         createValidator();
683         // inline creation of $Table0
684         $objectMap.put("$Table0", $Table0 = new Table());
685         
686         $Table0.setName("$Table0");
687         createCommentLabel();
688         createCommentScrollPane();
689         createCommentEditor();
690         createQualityLevelLabel();
691         createQualityLevelCombo();
692         createConfirmationLabel();
693         // inline creation of $JPanel0
694         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
695         
696         $JPanel0.setName("$JPanel0");
697         $JPanel0.setLayout(new GridLayout(1,0));
698         createCancelButton();
699         createQualifyButton();
700         // inline creation of qualifySurveyUI
701         setName("qualifySurveyUI");
702         qualifySurveyUI.getContentPane().setLayout(new BorderLayout());
703         setResizable(false);
704         setTitle(t("dali.action.qualify.survey.title"));
705         setModal(true);
706         
707         // registers 3 data bindings
708         $registerDefaultBindings();
709         $completeSetup();
710         handler.afterInit(this);
711     }
712 
713     private void $registerDefaultBindings() {
714         // register 3 data bindings
715         registerDataBinding(new DefaultJAXXBinding(this, BINDING_COMMENT_EDITOR_TEXT, true) {
716         
717             @Override
718             public void applyDataBinding() {
719                 if (model != null) {
720                     model.addPropertyChangeListener("comment", this);
721                 }
722             }
723         
724             @Override
725             public void processDataBinding() {
726                 if (model != null) {
727                     SwingUtil.setText(commentEditor, model.getComment());
728                 }
729             }
730         
731             @Override
732             public void removeDataBinding() {
733                 if (model != null) {
734                     model.removePropertyChangeListener("comment", this);
735                 }
736             }
737         });
738         registerDataBinding(new DefaultJAXXBinding(this, BINDING_QUALITY_LEVEL_COMBO_SELECTED_ITEM, true) {
739         
740             @Override
741             public void applyDataBinding() {
742                 if (model != null) {
743                     model.addPropertyChangeListener("qualityLevel", this);
744                 }
745             }
746         
747             @Override
748             public void processDataBinding() {
749                 if (model != null) {
750                     qualityLevelCombo.setSelectedItem(model.getQualityLevel());
751                 }
752             }
753         
754             @Override
755             public void removeDataBinding() {
756                 if (model != null) {
757                     model.removePropertyChangeListener("qualityLevel", this);
758                 }
759             }
760         });
761         registerDataBinding(new DefaultJAXXBinding(this, BINDING_QUALIFY_BUTTON_ENABLED, true) {
762         
763             @Override
764             public void applyDataBinding() {
765                 if (model != null) {
766                     model.addPropertyChangeListener("valid", this);
767                 }
768             }
769         
770             @Override
771             public void processDataBinding() {
772                 if (model != null) {
773                     qualifyButton.setEnabled(model.isValid());
774                 }
775             }
776         
777             @Override
778             public void removeDataBinding() {
779                 if (model != null) {
780                     model.removePropertyChangeListener("valid", this);
781                 }
782             }
783         });
784     }
785 
786 }