View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.program.strategies.duplicate;
2   
3   import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
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.Component;
12  import java.awt.Container;
13  import java.awt.Dialog;
14  import java.awt.Dialog.ModalityType;
15  import java.awt.Frame;
16  import java.awt.GraphicsConfiguration;
17  import java.awt.GridLayout;
18  import java.awt.Window;
19  import java.awt.event.ActionEvent;
20  import java.awt.event.ActionListener;
21  import java.util.ArrayList;
22  import java.util.HashMap;
23  import java.util.List;
24  import java.util.Map;
25  import java.util.TreeMap;
26  import javax.swing.BorderFactory;
27  import javax.swing.Box;
28  import javax.swing.BoxLayout;
29  import javax.swing.JButton;
30  import javax.swing.JDialog;
31  import javax.swing.JLabel;
32  import javax.swing.JPanel;
33  import jaxx.runtime.JAXXBinding;
34  import jaxx.runtime.JAXXContext;
35  import jaxx.runtime.JAXXObject;
36  import jaxx.runtime.JAXXObjectDescriptor;
37  import jaxx.runtime.JAXXUtil;
38  import jaxx.runtime.SwingUtil;
39  import jaxx.runtime.binding.DefaultJAXXBinding;
40  import jaxx.runtime.context.DefaultJAXXContext;
41  import org.apache.commons.logging.Log;
42  import org.apache.commons.logging.LogFactory;
43  import static org.nuiton.i18n.I18n.t;
44  
45  public class SelectProgramUI extends JDialog implements DaliUI<SelectProgramUIModel, SelectProgramUIHandler>, JAXXObject {
46  
47      /*-----------------------------------------------------------------------*/
48      /*------------------ Constants for all public bindings ------------------*/
49      /*-----------------------------------------------------------------------*/
50  
51      public static final String BINDING_PROGRAM_COMBO_SELECTED_ITEM = "programCombo.selectedItem";
52      public static final String BINDING_VALID_BUTTON_ENABLED = "validButton.enabled";
53  
54      /*-----------------------------------------------------------------------*/
55      /*------------------------- Other static fields -------------------------*/
56      /*-----------------------------------------------------------------------*/
57  
58      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAALVVQW8bRRR+dmMndtyWNqWk0Ag3LQKENKblACgUShqipnKgalKp4Avj3YkzZXZmOzPbrEFF/ALET4A7FyRunBAHzhy4IP4CQhy4It7srtd2vYmNIix5k5333ve+9958z9/+ARWj4dIDGsdER9LygJHb796//0H3AfPsBjOe5qFVGtJPqQzlDiz6+bmxcLnTduGtLLx1UwWhkkyORK+1oW5sXzCzz5i1sDIe4RnT2snNa3EY6QFqTqoI9eu//ix/5X/xTRkgDpHdIpbSnBY1rGSuDWXuWziLmR7RlqCyhzQ0lz3ke9Kd3RTUmPdpwB7C5zDfhmpINYJZWJ295AQjiY9DC6cNE9jYO1r1NA3ubVnY3dOE72kWME18KjiJODEHSIJ4SlrEJAGVtMdImMYQYzW1rMeZIX4UCu7hG9kZhw3DJGXVQiVQPhMWPvw/0mw77GGualerT5i28OKhyTbw7RbGrCeew9CFK7fvUMnEqzgO1/k4809PnVMt920EzBik2qZdV9m4f3LoHM9OYF917+fGbY2s3DzsGfdYnrDjhLvKwvWRwh5G1Ne8x14bbWV2D0iXUUnei7GxPvOT4HUVj0MPaF0rouVR6TGxHlmL04GlsRLTU+f5fB6w+Agb6w8tlzOzhufGBIFSI0OpDbVQ6kBFR3hsYbkzqc67aEp1ufyELh1gYv3n/NKvP/z+/eZAjKcw99OFriO7BEWCDQ7xznCX+nSqxMhy0dqm4VoHaqlekkVzsYDYTmZGcpjvjAsnLpzcomYfISrzv/340/mPfzkB5U2oC0X9Ter8t6Bm9zV2QQk/Dt+5kTBqHCzg8yn8nrBQQyv/lHYFtqmyR4Vxfy237v1acqkRiCs5oo5MMn0yJnKSBTklUryvc1ZHLMZWXixoZV5Pt/bz30s7390YtLOE5V041H3Y0spHUOVScMmS7ZYtrsJtthgaFvlquKCKVhZM7qwwk+0rybM10bySq5HF9r/2STgNxpEDfT2p2P33Jjwh0mnZUQz1PS4s0+nsknZbOImjPthgnsLUSg9H2kg5MH/LssDCs58l+5L0mN2lGp8ZuZdefoyKze5qH+HsqBVvi4O/y4z7dRtAz7klYGE+hXx8VGXJhphWGV7KBr/6htyWLFCSe8g26S9uHXwnnlCGkSA31tO+b7n9DtV0oeSTOTMRWUhvdA1Nozc3QW9lNEmyoNz0D2G4MHDIOZ4rCsd+Mukmiz/cq4cOq3npelNGorjpo7tyhrtcFbSv0BlOvYUEaLPLpY97+O0J6JJ71mdB7CrtM+3sqhhlaSqKO5bHRrBHIFw4NofpCDh2J5LdfsiOwFk5NpPmLDuLe+oojNWZWHx5BMILiPAvF8bfB3ILAAA=";
59      private static final Log log = LogFactory.getLog(SelectProgramUI.class);
60      private static final long serialVersionUID = 1L;
61  
62      /*-----------------------------------------------------------------------*/
63      /*--------------------------- Internal states ---------------------------*/
64      /*-----------------------------------------------------------------------*/
65  
66      protected List<Object> $activeBindings = new ArrayList<Object>();
67      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
68      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
69      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
70      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
71      private boolean allComponentsCreated;
72      protected final JAXXContext delegateContext = new DefaultJAXXContext();
73  
74      /*-----------------------------------------------------------------------*/
75      /*------------------------ Protected components  ------------------------*/
76      /*-----------------------------------------------------------------------*/
77  
78      protected DaliHelpBroker broker;
79      protected JButton cancelButton;
80      protected final SelectProgramUIHandler handler = createHandler();
81      protected JLabel messageLabel;
82      protected SelectProgramUIModel model;
83      protected ExtendedComboBox<ProgramDTO> programCombo;
84      protected JLabel programLabel;
85      protected SelectProgramUI selectProgramUI = this;
86      protected JButton validButton;
87  
88      /*-----------------------------------------------------------------------*/
89      /*------------------------- Private components  -------------------------*/
90      /*-----------------------------------------------------------------------*/
91  
92      private JPanel $JPanel0;
93      private JPanel $JPanel1;
94      private JPanel $JPanel2;
95  
96      /*-----------------------------------------------------------------------*/
97      /*---------------------------- Constructors  ----------------------------*/
98      /*-----------------------------------------------------------------------*/
99  
100     public SelectProgramUI(DaliUIContext context) {
101         super(context.getMainUI());
102         			ApplicationUIUtil.setApplicationContext(this, context);
103             $initialize();
104     }
105 
106     public SelectProgramUI(Window param0) {
107         super(param0);
108         $initialize();
109     }
110 
111     public SelectProgramUI(JAXXContext parentContext, Window param1) {
112         super(param1);
113         JAXXUtil.initContext(this, parentContext);
114         $initialize();
115     }
116 
117     public SelectProgramUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
118         super(param0 ,param1 ,param2 ,param3);
119         $initialize();
120     }
121 
122     public SelectProgramUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
123         super(param1 ,param2 ,param3 ,param4);
124         JAXXUtil.initContext(this, parentContext);
125         $initialize();
126     }
127 
128     public SelectProgramUI(Dialog param0, String param1, boolean param2) {
129         super(param0 ,param1 ,param2);
130         $initialize();
131     }
132 
133     public SelectProgramUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3) {
134         super(param1 ,param2 ,param3);
135         JAXXUtil.initContext(this, parentContext);
136         $initialize();
137     }
138 
139     public SelectProgramUI(Dialog param0, String param1) {
140         super(param0 ,param1);
141         $initialize();
142     }
143 
144     public SelectProgramUI(JAXXContext parentContext, Dialog param1, String param2) {
145         super(param1 ,param2);
146         JAXXUtil.initContext(this, parentContext);
147         $initialize();
148     }
149 
150     public SelectProgramUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
151         super(param0 ,param1 ,param2 ,param3);
152         $initialize();
153     }
154 
155     public SelectProgramUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
156         super(param1 ,param2 ,param3 ,param4);
157         JAXXUtil.initContext(this, parentContext);
158         $initialize();
159     }
160 
161     public SelectProgramUI(Window param0, String param1, ModalityType param2) {
162         super(param0 ,param1 ,param2);
163         $initialize();
164     }
165 
166     public SelectProgramUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3) {
167         super(param1 ,param2 ,param3);
168         JAXXUtil.initContext(this, parentContext);
169         $initialize();
170     }
171 
172     public SelectProgramUI(Window param0, String param1) {
173         super(param0 ,param1);
174         $initialize();
175     }
176 
177     public SelectProgramUI(JAXXContext parentContext, Window param1, String param2) {
178         super(param1 ,param2);
179         JAXXUtil.initContext(this, parentContext);
180         $initialize();
181     }
182 
183     public SelectProgramUI(Window param0, ModalityType param1) {
184         super(param0 ,param1);
185         $initialize();
186     }
187 
188     public SelectProgramUI(JAXXContext parentContext, Window param1, ModalityType param2) {
189         super(param1 ,param2);
190         JAXXUtil.initContext(this, parentContext);
191         $initialize();
192     }
193 
194     public SelectProgramUI(Frame param0, String param1) {
195         super(param0 ,param1);
196         $initialize();
197     }
198 
199     public SelectProgramUI(JAXXContext parentContext, Frame param1, String param2) {
200         super(param1 ,param2);
201         JAXXUtil.initContext(this, parentContext);
202         $initialize();
203     }
204 
205     public SelectProgramUI(Frame param0, boolean param1) {
206         super(param0 ,param1);
207         $initialize();
208     }
209 
210     public SelectProgramUI(JAXXContext parentContext, Frame param1, boolean param2) {
211         super(param1 ,param2);
212         JAXXUtil.initContext(this, parentContext);
213         $initialize();
214     }
215 
216     public SelectProgramUI(Frame param0) {
217         super(param0);
218         $initialize();
219     }
220 
221     public SelectProgramUI(JAXXContext parentContext, Frame param1) {
222         super(param1);
223         JAXXUtil.initContext(this, parentContext);
224         $initialize();
225     }
226 
227     public SelectProgramUI() {
228         $initialize();
229     }
230 
231     public SelectProgramUI(JAXXContext parentContext) {
232         JAXXUtil.initContext(this, parentContext);
233         $initialize();
234     }
235 
236     public SelectProgramUI(Dialog param0, boolean param1) {
237         super(param0 ,param1);
238         $initialize();
239     }
240 
241     public SelectProgramUI(JAXXContext parentContext, Dialog param1, boolean param2) {
242         super(param1 ,param2);
243         JAXXUtil.initContext(this, parentContext);
244         $initialize();
245     }
246 
247     public SelectProgramUI(Dialog param0) {
248         super(param0);
249         $initialize();
250     }
251 
252     public SelectProgramUI(JAXXContext parentContext, Dialog param1) {
253         super(param1);
254         JAXXUtil.initContext(this, parentContext);
255         $initialize();
256     }
257 
258     public SelectProgramUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
259         super(param0 ,param1 ,param2 ,param3);
260         $initialize();
261     }
262 
263     public SelectProgramUI(JAXXContext parentContext, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
264         super(param1 ,param2 ,param3 ,param4);
265         JAXXUtil.initContext(this, parentContext);
266         $initialize();
267     }
268 
269     public SelectProgramUI(Frame param0, String param1, boolean param2) {
270         super(param0 ,param1 ,param2);
271         $initialize();
272     }
273 
274     public SelectProgramUI(JAXXContext parentContext, Frame param1, String param2, boolean param3) {
275         super(param1 ,param2 ,param3);
276         JAXXUtil.initContext(this, parentContext);
277         $initialize();
278     }
279 
280     /*-----------------------------------------------------------------------*/
281     /*--------------------------- Statics methods ---------------------------*/
282     /*-----------------------------------------------------------------------*/
283 
284     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
285         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
286     }
287 
288     /*-----------------------------------------------------------------------*/
289     /*---------------------- JAXXObject implementation ----------------------*/
290     /*-----------------------------------------------------------------------*/
291 
292     @Override
293     public void applyDataBinding(String $binding) {
294         if (allComponentsCreated && $bindings.containsKey($binding)) {
295             getDataBinding($binding).applyDataBinding();
296         }
297         processDataBinding($binding);
298     }
299 
300     @Override
301     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
302         super.firePropertyChange(propertyName, oldValue, newValue);
303     }
304 
305     @Override
306     public Map<String, Object> get$objectMap() {
307         return $objectMap;
308     }
309 
310     @Override
311     public JAXXBinding getDataBinding(String bindingId) {
312         return $bindings.get(bindingId);
313     }
314 
315     @Override
316     public JAXXBinding[] getDataBindings() {
317         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
318     }
319 
320     @Override
321     public Object getObjectById(String id) {
322         return $objectMap.get(id);
323     }
324 
325     @Override
326     public void processDataBinding(String $binding, boolean $force) {
327         if (!$force && $activeBindings.contains($binding)) { 
328             return;
329         }
330         $activeBindings.add($binding);
331         try {
332             if (allComponentsCreated && $bindings.containsKey($binding)) {
333                 getDataBinding($binding).processDataBinding();
334             }
335         } finally {
336             $activeBindings.remove($binding);
337         }
338     }
339 
340     @Override
341     public void processDataBinding(String $binding) {
342         processDataBinding($binding, false);
343     }
344 
345     @Override
346     public void registerDataBinding(JAXXBinding binding) {
347         $bindings.put(binding.getId(), binding);
348     }
349 
350     @Override
351     public void removeDataBinding(String $binding) {
352         if (allComponentsCreated && $bindings.containsKey($binding)) {
353             getDataBinding($binding).removeDataBinding();
354         }
355     }
356 
357     /*-----------------------------------------------------------------------*/
358     /*--------------------- JAXXContext implementation  ---------------------*/
359     /*-----------------------------------------------------------------------*/
360 
361     @Override
362     public <T> T getContextValue(Class<T> clazz) {
363         return delegateContext.getContextValue(clazz, null);
364     }
365 
366     @Override
367     public <T> T getContextValue(Class<T> clazz, String name) {
368         return delegateContext.getContextValue(clazz, name);
369     }
370 
371     @Override
372     public JAXXContext getDelegateContext() {
373         return delegateContext;
374     }
375 
376     @Override
377     public <O extends Container> O getParentContainer(Class<O> clazz) {
378         return SwingUtil.getParentContainer(this, clazz);
379     }
380 
381     @Override
382     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
383         return SwingUtil.getParentContainer(source, clazz);
384     }
385 
386     @Override
387     public <T> void removeContextValue(Class<T> clazz) {
388         delegateContext.removeContextValue(clazz, null);
389     }
390 
391     @Override
392     public <T> void removeContextValue(Class<T> clazz, String name) {
393         delegateContext.removeContextValue(clazz, name);
394     }
395 
396     @Override
397     public <T> void setContextValue(T o) {
398         delegateContext.setContextValue(o, null);
399     }
400 
401     @Override
402     public <T> void setContextValue(T o, String name) {
403         delegateContext.setContextValue(o, name);
404     }
405 
406     /*-----------------------------------------------------------------------*/
407     /*---------------------------- Event methods ----------------------------*/
408     /*-----------------------------------------------------------------------*/
409 
410     public void doActionPerformed__on__cancelButton(ActionEvent event) {
411         if (log.isDebugEnabled()) {
412             log.debug(event);
413         }
414         handler.cancel();
415     }
416 
417     public void doActionPerformed__on__validButton(ActionEvent event) {
418         if (log.isDebugEnabled()) {
419             log.debug(event);
420         }
421         handler.valid();
422     }
423 
424     /*-----------------------------------------------------------------------*/
425     /*----------------------- Public acessor methods  -----------------------*/
426     /*-----------------------------------------------------------------------*/
427 
428     public DaliHelpBroker getBroker() {
429         return broker;
430     }
431 
432     public JButton getCancelButton() {
433         return cancelButton;
434     }
435 
436     public SelectProgramUIHandler getHandler() {
437         return handler;
438     }
439 
440     public JLabel getMessageLabel() {
441         return messageLabel;
442     }
443 
444     public SelectProgramUIModel getModel() {
445         return model;
446     }
447 
448     public ExtendedComboBox<ProgramDTO> getProgramCombo() {
449         return programCombo;
450     }
451 
452     public JLabel getProgramLabel() {
453         return programLabel;
454     }
455 
456     public JButton getValidButton() {
457         return validButton;
458     }
459 
460     /*-----------------------------------------------------------------------*/
461     /*--------------------- Protected acessors methods  ---------------------*/
462     /*-----------------------------------------------------------------------*/
463 
464     protected JPanel get$JPanel0() {
465         return $JPanel0;
466     }
467 
468     protected JPanel get$JPanel1() {
469         return $JPanel1;
470     }
471 
472     protected JPanel get$JPanel2() {
473         return $JPanel2;
474     }
475 
476     /*-----------------------------------------------------------------------*/
477     /*--------------------- Components creation methods ---------------------*/
478     /*-----------------------------------------------------------------------*/
479 
480     protected void addChildrenToSelectProgramUI() {
481         if (!allComponentsCreated) {
482             return;
483         }
484         add($JPanel0);
485     }
486 
487     protected void createBroker() {
488         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
489     }
490 
491     protected void createCancelButton() {
492         $objectMap.put("cancelButton", cancelButton = new JButton());
493         
494         cancelButton.setName("cancelButton");
495         cancelButton.setText(t("dali.common.close"));
496         cancelButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__cancelButton"));
497     }
498 
499     protected SelectProgramUIHandler createHandler() {
500         return new SelectProgramUIHandler();
501     }
502 
503     protected void createMessageLabel() {
504         $objectMap.put("messageLabel", messageLabel = new JLabel());
505         
506         messageLabel.setName("messageLabel");
507     }
508 
509     protected void createModel() {
510         $objectMap.put("model", model = getContextValue(SelectProgramUIModel.class));
511     }
512 
513     protected void createProgramCombo() {
514         $objectMap.put("programCombo", programCombo = new ExtendedComboBox<ProgramDTO>(this));
515         
516         programCombo.setName("programCombo");
517         programCombo.setFilterable(true);
518         programCombo.setShowDecorator(false);
519         programCombo.setProperty("targetProgram");
520         programCombo.setShowReset(false);
521     }
522 
523     protected void createProgramLabel() {
524         $objectMap.put("programLabel", programLabel = new JLabel());
525         
526         programLabel.setName("programLabel");
527         programLabel.setText(t("dali.action.duplicate.strategy.selectProgram.label"));
528     }
529 
530     protected void createValidButton() {
531         $objectMap.put("validButton", validButton = new JButton());
532         
533         validButton.setName("validButton");
534         validButton.setText(t("dali.common.validate"));
535         validButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__validButton"));
536     }
537 
538     /*-----------------------------------------------------------------------*/
539     /*------------------------ Internal jaxx methods ------------------------*/
540     /*-----------------------------------------------------------------------*/
541 
542     private void $completeSetup() {
543         allComponentsCreated = true;
544         if (log.isDebugEnabled()) {
545             log.debug(this);
546         }
547         addChildrenToSelectProgramUI();
548         // inline complete setup of $JPanel0
549         $JPanel0.add(messageLabel, BorderLayout.PAGE_START);
550         $JPanel0.add($JPanel1, BorderLayout.CENTER);
551         $JPanel0.add($JPanel2, BorderLayout.PAGE_END);
552         // inline complete setup of $JPanel1
553         $JPanel1.add(programLabel);
554         $JPanel1.add(programCombo);
555         // inline complete setup of $JPanel2
556         $JPanel2.add(cancelButton);
557         $JPanel2.add(validButton);
558         
559         // apply 2 data bindings
560         JAXXUtil.applyDataBinding(this, $bindings.keySet());
561         
562         // apply 12 property setters
563         $JPanel0.setBorder(BorderFactory.createEmptyBorder(10,10,10,10));
564         $JPanel1.setBorder(BorderFactory.createEmptyBorder(10,0,10,0));
565         programCombo.setBeanType(ProgramDTO.class);
566         programCombo.setBean(model);
567         cancelButton.setMnemonic(SwingUtil.getFirstCharAt(t("dali.common.close.mnemonic"),'Z'));
568         cancelButton.setIcon(SwingUtil.createActionIcon("cancel"));
569         validButton.setMnemonic(SwingUtil.getFirstCharAt(t("dali.common.validate.mnemonic"),'Z'));
570         validButton.setIcon(SwingUtil.createActionIcon("validate"));
571         // late initializer
572         selectProgramUI.pack();
573     }
574 
575     private void $initialize() {
576         if (allComponentsCreated) {
577             return;
578         }
579         if (log.isDebugEnabled()) {
580             log.debug(this);
581         }
582         handler.beforeInit(this);
583         $objectMap.put("selectProgramUI", selectProgramUI);
584         createModel();
585         createBroker();
586         // inline creation of $JPanel0
587         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
588         
589         $JPanel0.setName("$JPanel0");
590         $JPanel0.setLayout(new BorderLayout());
591         createMessageLabel();
592         // inline creation of $JPanel1
593         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
594         
595         $JPanel1.setName("$JPanel1");
596         $JPanel1.setLayout(new GridLayout(0,1));
597         createProgramLabel();
598         createProgramCombo();
599         // inline creation of $JPanel2
600         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
601         
602         $JPanel2.setName("$JPanel2");
603         $JPanel2.setLayout(new GridLayout(1,0));
604         createCancelButton();
605         createValidButton();
606         // inline creation of selectProgramUI
607         setName("selectProgramUI");
608         selectProgramUI.getContentPane().setLayout(new BorderLayout());
609         setResizable(false);
610         setTitle(t("dali.action.duplicate.strategy.selectProgram.title"));
611         setModal(true);
612         
613         // registers 2 data bindings
614         $registerDefaultBindings();
615         $completeSetup();
616         handler.afterInit(this);
617     }
618 
619     private void $registerDefaultBindings() {
620         // register 2 data bindings
621         registerDataBinding(new DefaultJAXXBinding(this, BINDING_PROGRAM_COMBO_SELECTED_ITEM, true) {
622         
623             @Override
624             public void applyDataBinding() {
625                 if (model != null) {
626                     model.addPropertyChangeListener("targetProgram", this);
627                 }
628             }
629         
630             @Override
631             public void processDataBinding() {
632                 if (model != null) {
633                     programCombo.setSelectedItem(model.getTargetProgram());
634                 }
635             }
636         
637             @Override
638             public void removeDataBinding() {
639                 if (model != null) {
640                     model.removePropertyChangeListener("targetProgram", this);
641                 }
642             }
643         });
644         registerDataBinding(new DefaultJAXXBinding(this, BINDING_VALID_BUTTON_ENABLED, true) {
645         
646             @Override
647             public void applyDataBinding() {
648                 if (model != null) {
649                     model.addPropertyChangeListener("targetProgram", this);
650                 }
651             }
652         
653             @Override
654             public void processDataBinding() {
655                 if (model != null) {
656                     validButton.setEnabled(model.getTargetProgram() != null);
657                 }
658             }
659         
660             @Override
661             public void removeDataBinding() {
662                 if (model != null) {
663                     model.removePropertyChangeListener("targetProgram", this);
664                 }
665             }
666         });
667     }
668 
669 }