1 package fr.ifremer.tutti.ui.swing.content.protocol.rtp;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import fr.ifremer.tutti.ui.swing.TuttiHelpBroker;
28 import fr.ifremer.tutti.ui.swing.TuttiUIContext;
29 import fr.ifremer.tutti.ui.swing.content.protocol.EditProtocolSpeciesTableModel;
30 import fr.ifremer.tutti.ui.swing.util.TuttiUI;
31 import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
32 import java.awt.BorderLayout;
33 import java.awt.Container;
34 import java.awt.Dialog;
35 import java.awt.Dialog.ModalityType;
36 import java.awt.Frame;
37 import java.awt.GraphicsConfiguration;
38 import java.awt.GridBagConstraints;
39 import java.awt.GridLayout;
40 import java.awt.Insets;
41 import java.awt.Window;
42 import java.util.ArrayList;
43 import java.util.HashMap;
44 import java.util.List;
45 import java.util.Map;
46 import java.util.TreeMap;
47 import javax.swing.BorderFactory;
48 import javax.swing.JButton;
49 import javax.swing.JComponent;
50 import javax.swing.JDialog;
51 import javax.swing.JLabel;
52 import javax.swing.JPanel;
53 import javax.swing.JToolBar;
54 import javax.swing.RowSorter;
55 import javax.swing.border.TitledBorder;
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.JAXXValidator;
62 import jaxx.runtime.SwingUtil;
63 import jaxx.runtime.binding.DefaultJAXXBinding;
64 import jaxx.runtime.binding.SimpleJAXXObjectBinding;
65 import jaxx.runtime.context.DefaultJAXXContext;
66 import jaxx.runtime.swing.Table;
67 import jaxx.runtime.validator.swing.SwingValidator;
68 import jaxx.runtime.validator.swing.SwingValidatorUtil;
69 import jaxx.runtime.validator.swing.meta.Validator;
70 import jaxx.runtime.validator.swing.meta.ValidatorField;
71 import jaxx.runtime.validator.swing.ui.ImageValidationUI;
72 import org.apache.commons.logging.Log;
73 import org.apache.commons.logging.LogFactory;
74 import org.jdesktop.swingx.JXTitledPanel;
75 import org.nuiton.jaxx.widgets.number.NumberEditor;
76 import static org.nuiton.i18n.I18n.t;
77
78 public class RtpEditorUI extends JDialog implements TuttiUI<RtpEditorUIModel, RtpEditorUIHandler>, JAXXObject, JAXXValidator {
79
80
81
82
83
84 public static final String BINDING_COPY_VALUES_BUTTON_ENABLED = "copyValuesButton.enabled";
85 public static final String BINDING_NEXT_ROW_BUTTON_ENABLED = "nextRowButton.enabled";
86 public static final String BINDING_PREVIOUS_ROW_BUTTON_ENABLED = "previousRowButton.enabled";
87 public static final String BINDING_RTP_FEMALE_AFIELD_NUMBER_PATTERN = "rtpFemaleAField.numberPattern";
88 public static final String BINDING_RTP_FEMALE_AFIELD_NUMBER_VALUE = "rtpFemaleAField.numberValue";
89 public static final String BINDING_RTP_FEMALE_BFIELD_NUMBER_PATTERN = "rtpFemaleBField.numberPattern";
90 public static final String BINDING_RTP_FEMALE_BFIELD_NUMBER_VALUE = "rtpFemaleBField.numberValue";
91 public static final String BINDING_RTP_MALE_AFIELD_NUMBER_PATTERN = "rtpMaleAField.numberPattern";
92 public static final String BINDING_RTP_MALE_AFIELD_NUMBER_VALUE = "rtpMaleAField.numberValue";
93 public static final String BINDING_RTP_MALE_BFIELD_NUMBER_PATTERN = "rtpMaleBField.numberPattern";
94 public static final String BINDING_RTP_MALE_BFIELD_NUMBER_VALUE = "rtpMaleBField.numberValue";
95 public static final String BINDING_RTP_UNDEFINED_AFIELD_NUMBER_PATTERN = "rtpUndefinedAField.numberPattern";
96 public static final String BINDING_RTP_UNDEFINED_AFIELD_NUMBER_VALUE = "rtpUndefinedAField.numberValue";
97 public static final String BINDING_RTP_UNDEFINED_BFIELD_NUMBER_PATTERN = "rtpUndefinedBField.numberPattern";
98 public static final String BINDING_RTP_UNDEFINED_BFIELD_NUMBER_VALUE = "rtpUndefinedBField.numberValue";
99 public static final String BINDING_SAVE_BUTTON_ENABLED = "saveButton.enabled";
100
101
102
103
104
105 private static final String $jaxxObjectDescriptor = "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";
106 private static final Log log = LogFactory.getLog(RtpEditorUI.class);
107 private static final long serialVersionUID = 1L;
108
109
110
111
112
113 protected List<Object> $activeBindings = new ArrayList<Object>();
114 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
115 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
116 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
117 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
118 private boolean allComponentsCreated;
119 protected final JAXXContext delegateContext = new DefaultJAXXContext();
120
121
122
123
124
125 protected JPanel actions;
126 protected JXTitledPanel bodyPanel;
127 protected TuttiHelpBroker broker;
128 protected JButton closeButton;
129 protected JButton copyValuesButton;
130 protected Table femaleAPanel;
131 protected Table femaleBPanel;
132 protected JPanel femalePanel;
133 protected final RtpEditorUIHandler handler = createHandler();
134 protected JToolBar headerToolBar;
135 protected Table maleAPanel;
136 protected Table maleBPanel;
137 protected JPanel malePanel;
138 protected RtpEditorUIModel model;
139 protected JButton nextRowButton;
140 protected JButton previousRowButton;
141 protected RtpEditorUI rtpEditorDialog = this;
142 @ValidatorField( validatorId = "validator", propertyName = "rtpFemaleA", editorName = "rtpFemaleAField")
143 protected NumberEditor rtpFemaleAField;
144 protected JLabel rtpFemaleALabel;
145 @ValidatorField( validatorId = "validator", propertyName = "rtpFemaleB", editorName = "rtpFemaleBField")
146 protected NumberEditor rtpFemaleBField;
147 protected JLabel rtpFemaleBLabel;
148 protected JLabel rtpFormulaLabel;
149 protected JPanel rtpFormulaLabelContainer;
150 @ValidatorField( validatorId = "validator", propertyName = "rtpMaleA", editorName = "rtpMaleAField")
151 protected NumberEditor rtpMaleAField;
152 protected JLabel rtpMaleALabel;
153 @ValidatorField( validatorId = "validator", propertyName = "rtpMaleB", editorName = "rtpMaleBField")
154 protected NumberEditor rtpMaleBField;
155 protected JLabel rtpMaleBLabel;
156 @ValidatorField( validatorId = "validator", propertyName = "rtpUndefinedA", editorName = "rtpUndefinedAField")
157 protected NumberEditor rtpUndefinedAField;
158 protected JLabel rtpUndefinedALabel;
159 @ValidatorField( validatorId = "validator", propertyName = "rtpUndefinedB", editorName = "rtpUndefinedBField")
160 protected NumberEditor rtpUndefinedBField;
161 protected JLabel rtpUndefinedBLabel;
162 protected JButton saveButton;
163 protected Table undefinedAPanel;
164 protected Table undefinedBPanel;
165 protected JPanel undefinedPanel;
166 @Validator( validatorId = "validator")
167 protected SwingValidator<RtpEditorUIModel> validator;
168 protected List<String> validatorIds = new ArrayList<String>();
169
170
171
172
173
174 private JPanel $JPanel0;
175 private JPanel $JPanel1;
176 private JPanel $JPanel2;
177
178
179
180
181
182
183 public void setBean(EditProtocolSpeciesTableModel tableModel, RowSorter rowSorter, int row) {
184 handler.setBean(tableModel, rowSorter, row);
185 }
186
187 public void openEditor() { handler.openEditor(); }
188
189 public void closeEditor() { handler.closeEditor(); }
190
191
192
193
194
195 public RtpEditorUI(TuttiUI parentUI) {
196 super(parentUI.getHandler().getContext().getMainUI());
197 TuttiUIUtil.setParentUI(this, parentUI);
198 $initialize();
199 }
200
201 public RtpEditorUI(Frame param0, String param1, boolean param2, GraphicsConfiguration param3) {
202 super(param0 ,param1 ,param2 ,param3);
203 $initialize();
204 }
205
206 public RtpEditorUI(JAXXContext parentContext, Frame param1, String param2, boolean param3, GraphicsConfiguration param4) {
207 super(param1 ,param2 ,param3 ,param4);
208 JAXXUtil.initContext(this, parentContext);
209 $initialize();
210 }
211
212 public RtpEditorUI(Dialog param0) {
213 super(param0);
214 $initialize();
215 }
216
217 public RtpEditorUI(JAXXContext parentContext, Dialog param1) {
218 super(param1);
219 JAXXUtil.initContext(this, parentContext);
220 $initialize();
221 }
222
223 public RtpEditorUI(Frame param0, String param1, boolean param2) {
224 super(param0 ,param1 ,param2);
225 $initialize();
226 }
227
228 public RtpEditorUI(JAXXContext parentContext, Frame param1, String param2, boolean param3) {
229 super(param1 ,param2 ,param3);
230 JAXXUtil.initContext(this, parentContext);
231 $initialize();
232 }
233
234 public RtpEditorUI() {
235 $initialize();
236 }
237
238 public RtpEditorUI(JAXXContext parentContext) {
239 JAXXUtil.initContext(this, parentContext);
240 $initialize();
241 }
242
243 public RtpEditorUI(Frame param0) {
244 super(param0);
245 $initialize();
246 }
247
248 public RtpEditorUI(JAXXContext parentContext, Frame param1) {
249 super(param1);
250 JAXXUtil.initContext(this, parentContext);
251 $initialize();
252 }
253
254 public RtpEditorUI(Frame param0, boolean param1) {
255 super(param0 ,param1);
256 $initialize();
257 }
258
259 public RtpEditorUI(JAXXContext parentContext, Frame param1, boolean param2) {
260 super(param1 ,param2);
261 JAXXUtil.initContext(this, parentContext);
262 $initialize();
263 }
264
265 public RtpEditorUI(Frame param0, String param1) {
266 super(param0 ,param1);
267 $initialize();
268 }
269
270 public RtpEditorUI(JAXXContext parentContext, Frame param1, String param2) {
271 super(param1 ,param2);
272 JAXXUtil.initContext(this, parentContext);
273 $initialize();
274 }
275
276 public RtpEditorUI(Window param0) {
277 super(param0);
278 $initialize();
279 }
280
281 public RtpEditorUI(JAXXContext parentContext, Window param1) {
282 super(param1);
283 JAXXUtil.initContext(this, parentContext);
284 $initialize();
285 }
286
287 public RtpEditorUI(Window param0, ModalityType param1) {
288 super(param0 ,param1);
289 $initialize();
290 }
291
292 public RtpEditorUI(JAXXContext parentContext, Window param1, ModalityType param2) {
293 super(param1 ,param2);
294 JAXXUtil.initContext(this, parentContext);
295 $initialize();
296 }
297
298 public RtpEditorUI(Window param0, String param1) {
299 super(param0 ,param1);
300 $initialize();
301 }
302
303 public RtpEditorUI(JAXXContext parentContext, Window param1, String param2) {
304 super(param1 ,param2);
305 JAXXUtil.initContext(this, parentContext);
306 $initialize();
307 }
308
309 public RtpEditorUI(Window param0, String param1, ModalityType param2) {
310 super(param0 ,param1 ,param2);
311 $initialize();
312 }
313
314 public RtpEditorUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3) {
315 super(param1 ,param2 ,param3);
316 JAXXUtil.initContext(this, parentContext);
317 $initialize();
318 }
319
320 public RtpEditorUI(Window param0, String param1, ModalityType param2, GraphicsConfiguration param3) {
321 super(param0 ,param1 ,param2 ,param3);
322 $initialize();
323 }
324
325 public RtpEditorUI(JAXXContext parentContext, Window param1, String param2, ModalityType param3, GraphicsConfiguration param4) {
326 super(param1 ,param2 ,param3 ,param4);
327 JAXXUtil.initContext(this, parentContext);
328 $initialize();
329 }
330
331 public RtpEditorUI(Dialog param0, boolean param1) {
332 super(param0 ,param1);
333 $initialize();
334 }
335
336 public RtpEditorUI(JAXXContext parentContext, Dialog param1, boolean param2) {
337 super(param1 ,param2);
338 JAXXUtil.initContext(this, parentContext);
339 $initialize();
340 }
341
342 public RtpEditorUI(Dialog param0, String param1) {
343 super(param0 ,param1);
344 $initialize();
345 }
346
347 public RtpEditorUI(JAXXContext parentContext, Dialog param1, String param2) {
348 super(param1 ,param2);
349 JAXXUtil.initContext(this, parentContext);
350 $initialize();
351 }
352
353 public RtpEditorUI(Dialog param0, String param1, boolean param2) {
354 super(param0 ,param1 ,param2);
355 $initialize();
356 }
357
358 public RtpEditorUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3) {
359 super(param1 ,param2 ,param3);
360 JAXXUtil.initContext(this, parentContext);
361 $initialize();
362 }
363
364 public RtpEditorUI(Dialog param0, String param1, boolean param2, GraphicsConfiguration param3) {
365 super(param0 ,param1 ,param2 ,param3);
366 $initialize();
367 }
368
369 public RtpEditorUI(JAXXContext parentContext, Dialog param1, String param2, boolean param3, GraphicsConfiguration param4) {
370 super(param1 ,param2 ,param3 ,param4);
371 JAXXUtil.initContext(this, parentContext);
372 $initialize();
373 }
374
375
376
377
378
379 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
380 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
381 }
382
383
384
385
386
387 @Override
388 public void applyDataBinding(String $binding) {
389 if (allComponentsCreated && $bindings.containsKey($binding)) {
390 getDataBinding($binding).applyDataBinding();
391 }
392 processDataBinding($binding);
393 }
394
395 @Override
396 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
397 super.firePropertyChange(propertyName, oldValue, newValue);
398 }
399
400 @Override
401 public Map<String, Object> get$objectMap() {
402 return $objectMap;
403 }
404
405 @Override
406 public JAXXBinding getDataBinding(String bindingId) {
407 return $bindings.get(bindingId);
408 }
409
410 @Override
411 public JAXXBinding[] getDataBindings() {
412 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
413 }
414
415 @Override
416 public Object getObjectById(String id) {
417 return $objectMap.get(id);
418 }
419
420 @Override
421 public void processDataBinding(String $binding, boolean $force) {
422 if (!$force && $activeBindings.contains($binding)) {
423 return;
424 }
425 $activeBindings.add($binding);
426 try {
427 if (allComponentsCreated && $bindings.containsKey($binding)) {
428 getDataBinding($binding).processDataBinding();
429 }
430 } finally {
431 $activeBindings.remove($binding);
432 }
433 }
434
435 @Override
436 public void processDataBinding(String $binding) {
437 processDataBinding($binding, false);
438 }
439
440 @Override
441 public void registerDataBinding(JAXXBinding binding) {
442 $bindings.put(binding.getId(), binding);
443 }
444
445 @Override
446 public void removeDataBinding(String $binding) {
447 if (allComponentsCreated && $bindings.containsKey($binding)) {
448 getDataBinding($binding).removeDataBinding();
449 }
450 }
451
452
453
454
455
456 @Override
457 public <T> T getContextValue(Class<T> clazz) {
458 return delegateContext.getContextValue(clazz, null);
459 }
460
461 @Override
462 public <T> T getContextValue(Class<T> clazz, String name) {
463 return delegateContext.getContextValue(clazz, name);
464 }
465
466 @Override
467 public JAXXContext getDelegateContext() {
468 return delegateContext;
469 }
470
471 @Override
472 public <O extends Container> O getParentContainer(Class<O> clazz) {
473 return SwingUtil.getParentContainer(this, clazz);
474 }
475
476 @Override
477 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
478 return SwingUtil.getParentContainer(source, clazz);
479 }
480
481 @Override
482 public <T> void removeContextValue(Class<T> clazz) {
483 delegateContext.removeContextValue(clazz, null);
484 }
485
486 @Override
487 public <T> void removeContextValue(Class<T> clazz, String name) {
488 delegateContext.removeContextValue(clazz, name);
489 }
490
491 @Override
492 public <T> void setContextValue(T o) {
493 delegateContext.setContextValue(o, null);
494 }
495
496 @Override
497 public <T> void setContextValue(T o, String name) {
498 delegateContext.setContextValue(o, name);
499 }
500
501
502
503
504
505 @Override
506 public SwingValidator<?> getValidator(String validatorId) {
507 return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
508 }
509
510 @Override
511 public List<String> getValidatorIds() {
512 return validatorIds;
513 }
514
515 @Override
516 public void registerValidatorFields() {
517 SwingValidatorUtil.detectValidatorFields(this);
518 }
519
520
521
522
523
524 public JPanel getActions() {
525 return actions;
526 }
527
528 public JXTitledPanel getBodyPanel() {
529 return bodyPanel;
530 }
531
532 public TuttiHelpBroker getBroker() {
533 return broker;
534 }
535
536 public JButton getCloseButton() {
537 return closeButton;
538 }
539
540 public JButton getCopyValuesButton() {
541 return copyValuesButton;
542 }
543
544 public Table getFemaleAPanel() {
545 return femaleAPanel;
546 }
547
548 public Table getFemaleBPanel() {
549 return femaleBPanel;
550 }
551
552 public JPanel getFemalePanel() {
553 return femalePanel;
554 }
555
556 public RtpEditorUIHandler getHandler() {
557 return handler;
558 }
559
560 public JToolBar getHeaderToolBar() {
561 return headerToolBar;
562 }
563
564 public Table getMaleAPanel() {
565 return maleAPanel;
566 }
567
568 public Table getMaleBPanel() {
569 return maleBPanel;
570 }
571
572 public JPanel getMalePanel() {
573 return malePanel;
574 }
575
576 public RtpEditorUIModel getModel() {
577 return model;
578 }
579
580 public JButton getNextRowButton() {
581 return nextRowButton;
582 }
583
584 public JButton getPreviousRowButton() {
585 return previousRowButton;
586 }
587
588 public NumberEditor getRtpFemaleAField() {
589 return rtpFemaleAField;
590 }
591
592 public JLabel getRtpFemaleALabel() {
593 return rtpFemaleALabel;
594 }
595
596 public NumberEditor getRtpFemaleBField() {
597 return rtpFemaleBField;
598 }
599
600 public JLabel getRtpFemaleBLabel() {
601 return rtpFemaleBLabel;
602 }
603
604 public JLabel getRtpFormulaLabel() {
605 return rtpFormulaLabel;
606 }
607
608 public JPanel getRtpFormulaLabelContainer() {
609 return rtpFormulaLabelContainer;
610 }
611
612 public NumberEditor getRtpMaleAField() {
613 return rtpMaleAField;
614 }
615
616 public JLabel getRtpMaleALabel() {
617 return rtpMaleALabel;
618 }
619
620 public NumberEditor getRtpMaleBField() {
621 return rtpMaleBField;
622 }
623
624 public JLabel getRtpMaleBLabel() {
625 return rtpMaleBLabel;
626 }
627
628 public NumberEditor getRtpUndefinedAField() {
629 return rtpUndefinedAField;
630 }
631
632 public JLabel getRtpUndefinedALabel() {
633 return rtpUndefinedALabel;
634 }
635
636 public NumberEditor getRtpUndefinedBField() {
637 return rtpUndefinedBField;
638 }
639
640 public JLabel getRtpUndefinedBLabel() {
641 return rtpUndefinedBLabel;
642 }
643
644 public JButton getSaveButton() {
645 return saveButton;
646 }
647
648 public Table getUndefinedAPanel() {
649 return undefinedAPanel;
650 }
651
652 public Table getUndefinedBPanel() {
653 return undefinedBPanel;
654 }
655
656 public JPanel getUndefinedPanel() {
657 return undefinedPanel;
658 }
659
660 public SwingValidator<RtpEditorUIModel> getValidator() {
661 return validator;
662 }
663
664
665
666
667
668 protected JPanel get$JPanel0() {
669 return $JPanel0;
670 }
671
672 protected JPanel get$JPanel1() {
673 return $JPanel1;
674 }
675
676 protected JPanel get$JPanel2() {
677 return $JPanel2;
678 }
679
680
681
682
683
684 protected void addChildrenToActions() {
685 if (!allComponentsCreated) {
686 return;
687 }
688 actions.add(closeButton);
689 actions.add(saveButton);
690 }
691
692 protected void addChildrenToBodyPanel() {
693 if (!allComponentsCreated) {
694 return;
695 }
696 bodyPanel.add($JPanel0);
697 }
698
699 protected void addChildrenToFemaleAPanel() {
700 if (!allComponentsCreated) {
701 return;
702 }
703 femaleAPanel.add(rtpFemaleALabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
704 femaleAPanel.add(SwingUtil.boxComponentWithJxLayer(rtpFemaleAField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
705 }
706
707 protected void addChildrenToFemaleBPanel() {
708 if (!allComponentsCreated) {
709 return;
710 }
711 femaleBPanel.add(rtpFemaleBLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
712 femaleBPanel.add(SwingUtil.boxComponentWithJxLayer(rtpFemaleBField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
713 }
714
715 protected void addChildrenToFemalePanel() {
716 if (!allComponentsCreated) {
717 return;
718 }
719 femalePanel.add(femaleAPanel);
720 femalePanel.add(femaleBPanel);
721 }
722
723 protected void addChildrenToHeaderToolBar() {
724 if (!allComponentsCreated) {
725 return;
726 }
727 headerToolBar.add(previousRowButton);
728 headerToolBar.add(nextRowButton);
729 }
730
731 protected void addChildrenToMaleAPanel() {
732 if (!allComponentsCreated) {
733 return;
734 }
735 maleAPanel.add(rtpMaleALabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
736 maleAPanel.add(SwingUtil.boxComponentWithJxLayer(rtpMaleAField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
737 }
738
739 protected void addChildrenToMaleBPanel() {
740 if (!allComponentsCreated) {
741 return;
742 }
743 maleBPanel.add(rtpMaleBLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
744 maleBPanel.add(SwingUtil.boxComponentWithJxLayer(rtpMaleBField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
745 }
746
747 protected void addChildrenToMalePanel() {
748 if (!allComponentsCreated) {
749 return;
750 }
751 malePanel.add($JPanel2);
752 malePanel.add(copyValuesButton);
753 }
754
755 protected void addChildrenToRtpEditorDialog() {
756 if (!allComponentsCreated) {
757 return;
758 }
759 add(headerToolBar);
760 add(bodyPanel, BorderLayout.CENTER);
761 add(actions, BorderLayout.SOUTH);
762 }
763
764 protected void addChildrenToRtpFormulaLabelContainer() {
765 if (!allComponentsCreated) {
766 return;
767 }
768 rtpFormulaLabelContainer.add(rtpFormulaLabel, BorderLayout.CENTER);
769 }
770
771 protected void addChildrenToUndefinedAPanel() {
772 if (!allComponentsCreated) {
773 return;
774 }
775 undefinedAPanel.add(rtpUndefinedALabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
776 undefinedAPanel.add(SwingUtil.boxComponentWithJxLayer(rtpUndefinedAField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
777 }
778
779 protected void addChildrenToUndefinedBPanel() {
780 if (!allComponentsCreated) {
781 return;
782 }
783 undefinedBPanel.add(rtpUndefinedBLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
784 undefinedBPanel.add(SwingUtil.boxComponentWithJxLayer(rtpUndefinedBField), new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
785 }
786
787 protected void addChildrenToUndefinedPanel() {
788 if (!allComponentsCreated) {
789 return;
790 }
791 undefinedPanel.add(undefinedAPanel);
792 undefinedPanel.add(undefinedBPanel);
793 }
794
795 protected void addChildrenToValidator() {
796 if (!allComponentsCreated) {
797 return;
798 }
799 validator.setUiClass(ImageValidationUI.class);
800 validator.setBean(model);
801 }
802
803 protected void createActions() {
804 $objectMap.put("actions", actions = new JPanel());
805
806 actions.setName("actions");
807 actions.setLayout(new GridLayout(1, 2));
808 }
809
810 protected void createBodyPanel() {
811 $objectMap.put("bodyPanel", bodyPanel = new JXTitledPanel());
812
813 bodyPanel.setName("bodyPanel");
814 }
815
816 protected void createBroker() {
817 $objectMap.put("broker", broker = new TuttiHelpBroker("tutti.editRtp.help"));
818 }
819
820 protected void createCloseButton() {
821 $objectMap.put("closeButton", closeButton = new JButton());
822
823 closeButton.setName("closeButton");
824 closeButton.setText(t("tutti.editRtp.action.close"));
825 closeButton.setToolTipText(t("tutti.editRtp.action.close.tip"));
826 closeButton.putClientProperty("help", "tutti.editRtp.action.close.help");
827 closeButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.protocol.rtp.actions.CloseRtpAction.class);
828 }
829
830 protected void createCopyValuesButton() {
831 $objectMap.put("copyValuesButton", copyValuesButton = new JButton());
832
833 copyValuesButton.setName("copyValuesButton");
834 copyValuesButton.setText(t("tutti.editRtp.action.copyValues"));
835 copyValuesButton.setToolTipText(t("tutti.editRtp.action.copyValues.tip"));
836 copyValuesButton.putClientProperty("help", "tutti.editRtp.action.copyValues.help");
837 copyValuesButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.protocol.rtp.actions.CopyMaleRtpAction.class);
838 }
839
840 protected void createFemaleAPanel() {
841 $objectMap.put("femaleAPanel", femaleAPanel = new Table());
842
843 femaleAPanel.setName("femaleAPanel");
844 }
845
846 protected void createFemaleBPanel() {
847 $objectMap.put("femaleBPanel", femaleBPanel = new Table());
848
849 femaleBPanel.setName("femaleBPanel");
850 }
851
852 protected void createFemalePanel() {
853 $objectMap.put("femalePanel", femalePanel = new JPanel());
854
855 femalePanel.setName("femalePanel");
856 femalePanel.setLayout(new GridLayout(1, 2));
857 }
858
859 protected RtpEditorUIHandler createHandler() {
860 return new RtpEditorUIHandler();
861 }
862
863 protected void createHeaderToolBar() {
864 $objectMap.put("headerToolBar", headerToolBar = new JToolBar());
865
866 headerToolBar.setName("headerToolBar");
867 headerToolBar.setBorderPainted(false);
868 headerToolBar.setOpaque(true);
869 headerToolBar.setFloatable(false);
870 }
871
872 protected void createMaleAPanel() {
873 $objectMap.put("maleAPanel", maleAPanel = new Table());
874
875 maleAPanel.setName("maleAPanel");
876 }
877
878 protected void createMaleBPanel() {
879 $objectMap.put("maleBPanel", maleBPanel = new Table());
880
881 maleBPanel.setName("maleBPanel");
882 }
883
884 protected void createMalePanel() {
885 $objectMap.put("malePanel", malePanel = new JPanel());
886
887 malePanel.setName("malePanel");
888 malePanel.setLayout(new GridLayout(2, 1));
889 }
890
891 protected void createModel() {
892 $objectMap.put("model", model = getContextValue(RtpEditorUIModel.class));
893 }
894
895 protected void createNextRowButton() {
896 $objectMap.put("nextRowButton", nextRowButton = new JButton());
897
898 nextRowButton.setName("nextRowButton");
899 nextRowButton.setToolTipText(t("tutti.editRtp.action.next.tip"));
900 nextRowButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.protocol.rtp.actions.EditNextRowAction.class);
901 }
902
903 protected void createPreviousRowButton() {
904 $objectMap.put("previousRowButton", previousRowButton = new JButton());
905
906 previousRowButton.setName("previousRowButton");
907 previousRowButton.setToolTipText(t("tutti.editRtp.action.previous.tip"));
908 previousRowButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.protocol.rtp.actions.EditPreviousRowAction.class);
909 }
910
911 protected void createRtpFemaleAField() {
912 $objectMap.put("rtpFemaleAField", rtpFemaleAField = new NumberEditor());
913
914 rtpFemaleAField.setName("rtpFemaleAField");
915 rtpFemaleAField.setAutoPopup(false);
916 rtpFemaleAField.setShowPopupButton(false);
917 rtpFemaleAField.setShowReset(true);
918 rtpFemaleAField.putClientProperty("help", "tutti.editRtp.field.rtpFemaleA.help");
919 rtpFemaleAField.putClientProperty("selectOnFocus", true);
920 }
921
922 protected void createRtpFemaleALabel() {
923 $objectMap.put("rtpFemaleALabel", rtpFemaleALabel = new JLabel());
924
925 rtpFemaleALabel.setName("rtpFemaleALabel");
926 rtpFemaleALabel.setText(t("tutti.editRtp.field.rtpFemaleA"));
927 rtpFemaleALabel.setToolTipText(t("tutti.editRtp.field.rtpFemaleA.tip"));
928 rtpFemaleALabel.putClientProperty("help", "tutti.editRtp.field.rtpFemaleA.help");
929 }
930
931 protected void createRtpFemaleBField() {
932 $objectMap.put("rtpFemaleBField", rtpFemaleBField = new NumberEditor());
933
934 rtpFemaleBField.setName("rtpFemaleBField");
935 rtpFemaleBField.setAutoPopup(false);
936 rtpFemaleBField.setShowPopupButton(false);
937 rtpFemaleBField.setShowReset(true);
938 rtpFemaleBField.putClientProperty("help", "tutti.editRtp.field.rtpFemaleB.help");
939 rtpFemaleBField.putClientProperty("selectOnFocus", true);
940 }
941
942 protected void createRtpFemaleBLabel() {
943 $objectMap.put("rtpFemaleBLabel", rtpFemaleBLabel = new JLabel());
944
945 rtpFemaleBLabel.setName("rtpFemaleBLabel");
946 rtpFemaleBLabel.setText(t("tutti.editRtp.field.rtpFemaleB"));
947 rtpFemaleBLabel.setToolTipText(t("tutti.editRtp.field.rtpFemaleB.tip"));
948 rtpFemaleBLabel.putClientProperty("help", "tutti.editRtp.field.rtpFemaleB.help");
949 }
950
951 protected void createRtpFormulaLabel() {
952 $objectMap.put("rtpFormulaLabel", rtpFormulaLabel = new JLabel());
953
954 rtpFormulaLabel.setName("rtpFormulaLabel");
955 rtpFormulaLabel.setHorizontalAlignment(0);
956 rtpFormulaLabel.setText(t("tutti.editRtp.formula"));
957 }
958
959 protected void createRtpFormulaLabelContainer() {
960 $objectMap.put("rtpFormulaLabelContainer", rtpFormulaLabelContainer = new JPanel());
961
962 rtpFormulaLabelContainer.setName("rtpFormulaLabelContainer");
963 rtpFormulaLabelContainer.setLayout(new BorderLayout(10, 10));
964 }
965
966 protected void createRtpMaleAField() {
967 $objectMap.put("rtpMaleAField", rtpMaleAField = new NumberEditor());
968
969 rtpMaleAField.setName("rtpMaleAField");
970 rtpMaleAField.setAutoPopup(false);
971 rtpMaleAField.setShowPopupButton(false);
972 rtpMaleAField.setShowReset(true);
973 rtpMaleAField.putClientProperty("help", "tutti.editRtp.field.rtpMaleA.help");
974 rtpMaleAField.putClientProperty("selectOnFocus", true);
975 }
976
977 protected void createRtpMaleALabel() {
978 $objectMap.put("rtpMaleALabel", rtpMaleALabel = new JLabel());
979
980 rtpMaleALabel.setName("rtpMaleALabel");
981 rtpMaleALabel.setText(t("tutti.editRtp.field.rtpMaleA"));
982 rtpMaleALabel.setToolTipText(t("tutti.editRtp.field.rtpMaleA.tip"));
983 rtpMaleALabel.putClientProperty("help", "tutti.editRtp.field.rtpMaleA.help");
984 }
985
986 protected void createRtpMaleBField() {
987 $objectMap.put("rtpMaleBField", rtpMaleBField = new NumberEditor());
988
989 rtpMaleBField.setName("rtpMaleBField");
990 rtpMaleBField.setAutoPopup(false);
991 rtpMaleBField.setShowPopupButton(false);
992 rtpMaleBField.setShowReset(true);
993 rtpMaleBField.putClientProperty("help", "tutti.editRtp.field.rtpMaleB.help");
994 rtpMaleBField.putClientProperty("selectOnFocus", true);
995 }
996
997 protected void createRtpMaleBLabel() {
998 $objectMap.put("rtpMaleBLabel", rtpMaleBLabel = new JLabel());
999
1000 rtpMaleBLabel.setName("rtpMaleBLabel");
1001 rtpMaleBLabel.setText(t("tutti.editRtp.field.rtpMaleB"));
1002 rtpMaleBLabel.setToolTipText(t("tutti.editRtp.field.rtpMaleB.tip"));
1003 rtpMaleBLabel.putClientProperty("help", "tutti.editRtp.field.rtpMaleB.help");
1004 }
1005
1006 protected void createRtpUndefinedAField() {
1007 $objectMap.put("rtpUndefinedAField", rtpUndefinedAField = new NumberEditor());
1008
1009 rtpUndefinedAField.setName("rtpUndefinedAField");
1010 rtpUndefinedAField.setAutoPopup(false);
1011 rtpUndefinedAField.setShowPopupButton(false);
1012 rtpUndefinedAField.setShowReset(true);
1013 rtpUndefinedAField.putClientProperty("help", "tutti.editRtp.field.rtpUndefinedA.help");
1014 rtpUndefinedAField.putClientProperty("selectOnFocus", true);
1015 }
1016
1017 protected void createRtpUndefinedALabel() {
1018 $objectMap.put("rtpUndefinedALabel", rtpUndefinedALabel = new JLabel());
1019
1020 rtpUndefinedALabel.setName("rtpUndefinedALabel");
1021 rtpUndefinedALabel.setText(t("tutti.editRtp.field.rtpUndefinedA"));
1022 rtpUndefinedALabel.setToolTipText(t("tutti.editRtp.field.rtpUndefinedA.tip"));
1023 rtpUndefinedALabel.putClientProperty("help", "tutti.editRtp.field.rtpUndefinedA.help");
1024 }
1025
1026 protected void createRtpUndefinedBField() {
1027 $objectMap.put("rtpUndefinedBField", rtpUndefinedBField = new NumberEditor());
1028
1029 rtpUndefinedBField.setName("rtpUndefinedBField");
1030 rtpUndefinedBField.setAutoPopup(false);
1031 rtpUndefinedBField.setShowPopupButton(false);
1032 rtpUndefinedBField.setShowReset(true);
1033 rtpUndefinedBField.putClientProperty("help", "tutti.editRtp.field.rtpUndefinedB.help");
1034 rtpUndefinedBField.putClientProperty("selectOnFocus", true);
1035 }
1036
1037 protected void createRtpUndefinedBLabel() {
1038 $objectMap.put("rtpUndefinedBLabel", rtpUndefinedBLabel = new JLabel());
1039
1040 rtpUndefinedBLabel.setName("rtpUndefinedBLabel");
1041 rtpUndefinedBLabel.setText(t("tutti.editRtp.field.rtpUndefinedB"));
1042 rtpUndefinedBLabel.setToolTipText(t("tutti.editRtp.field.rtpUndefinedB.tip"));
1043 rtpUndefinedBLabel.putClientProperty("help", "tutti.editRtp.field.rtpUndefinedB.help");
1044 }
1045
1046 protected void createSaveButton() {
1047 $objectMap.put("saveButton", saveButton = new JButton());
1048
1049 saveButton.setName("saveButton");
1050 saveButton.setText(t("tutti.editRtp.action.save"));
1051 saveButton.setToolTipText(t("tutti.editRtp.action.save.tip"));
1052 saveButton.putClientProperty("help", "tutti.editRtp.action.save.help");
1053 saveButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.protocol.rtp.actions.SaveRtpAction.class);
1054 }
1055
1056 protected void createUndefinedAPanel() {
1057 $objectMap.put("undefinedAPanel", undefinedAPanel = new Table());
1058
1059 undefinedAPanel.setName("undefinedAPanel");
1060 }
1061
1062 protected void createUndefinedBPanel() {
1063 $objectMap.put("undefinedBPanel", undefinedBPanel = new Table());
1064
1065 undefinedBPanel.setName("undefinedBPanel");
1066 }
1067
1068 protected void createUndefinedPanel() {
1069 $objectMap.put("undefinedPanel", undefinedPanel = new JPanel());
1070
1071 undefinedPanel.setName("undefinedPanel");
1072 undefinedPanel.setLayout(new GridLayout(1, 2));
1073 }
1074
1075 protected void createValidator() {
1076 $objectMap.put("validator", validator = SwingValidator.newValidator(RtpEditorUIModel.class, null));
1077 }
1078
1079
1080
1081
1082
1083 private void $completeSetup() {
1084 allComponentsCreated = true;
1085 if (log.isDebugEnabled()) {
1086 log.debug(this);
1087 }
1088 addChildrenToRtpEditorDialog();
1089 addChildrenToValidator();
1090 addChildrenToHeaderToolBar();
1091 addChildrenToBodyPanel();
1092
1093 $JPanel0.add(rtpFormulaLabelContainer, BorderLayout.NORTH);
1094 $JPanel0.add($JPanel1, BorderLayout.CENTER);
1095 addChildrenToRtpFormulaLabelContainer();
1096
1097 $JPanel1.add(malePanel);
1098 $JPanel1.add(femalePanel);
1099 $JPanel1.add(undefinedPanel);
1100 addChildrenToMalePanel();
1101
1102 $JPanel2.add(maleAPanel);
1103 $JPanel2.add(maleBPanel);
1104 addChildrenToMaleAPanel();
1105 addChildrenToMaleBPanel();
1106 addChildrenToFemalePanel();
1107 addChildrenToFemaleAPanel();
1108 addChildrenToFemaleBPanel();
1109 addChildrenToUndefinedPanel();
1110 addChildrenToUndefinedAPanel();
1111 addChildrenToUndefinedBPanel();
1112 addChildrenToActions();
1113
1114
1115 JAXXUtil.applyDataBinding(this, $bindings.keySet());
1116
1117
1118 malePanel.setBorder(new TitledBorder(t("tutti.editRtp.malePanel")));
1119 femalePanel.setBorder(new TitledBorder(t("tutti.editRtp.femalePanel")));
1120 undefinedPanel.setBorder(new TitledBorder(t("tutti.editRtp.undefinedPanel")));
1121 previousRowButton.setIcon(SwingUtil.createActionIcon("previous"));
1122 nextRowButton.setIcon(SwingUtil.createActionIcon("next"));
1123 rtpFormulaLabelContainer.setBackground(new java.awt.Color(245, 218, 88));
1124 rtpFormulaLabel.setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
1125 rtpMaleALabel.setLabelFor(rtpMaleAField);
1126 rtpMaleAField.setNumberType(Double.class);
1127 rtpMaleAField.setProperty(RtpEditorUIModel.PROPERTY_RTP_MALE_A);
1128 rtpMaleAField.setBean(model);
1129 rtpMaleBLabel.setLabelFor(rtpMaleBField);
1130 rtpMaleBField.setNumberType(Float.class);
1131 rtpMaleBField.setProperty(RtpEditorUIModel.PROPERTY_RTP_MALE_B);
1132 rtpMaleBField.setBean(model);
1133 copyValuesButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editRtp.action.copyValues.mnemonic"),'Z'));
1134 copyValuesButton.setIcon(SwingUtil.createActionIcon("copy"));
1135 rtpFemaleALabel.setLabelFor(rtpFemaleAField);
1136 rtpFemaleAField.setNumberType(Double.class);
1137 rtpFemaleAField.setProperty(RtpEditorUIModel.PROPERTY_RTP_FEMALE_A);
1138 rtpFemaleAField.setBean(model);
1139 rtpFemaleBLabel.setLabelFor(rtpFemaleBField);
1140 rtpFemaleBField.setNumberType(Float.class);
1141 rtpFemaleBField.setProperty(RtpEditorUIModel.PROPERTY_RTP_FEMALE_B);
1142 rtpFemaleBField.setBean(model);
1143 rtpUndefinedALabel.setLabelFor(rtpUndefinedAField);
1144 rtpUndefinedAField.setNumberType(Double.class);
1145 rtpUndefinedAField.setProperty(RtpEditorUIModel.PROPERTY_RTP_UNDEFINED_A);
1146 rtpUndefinedAField.setBean(model);
1147 rtpUndefinedBLabel.setLabelFor(rtpUndefinedBField);
1148 rtpUndefinedBField.setNumberType(Float.class);
1149 rtpUndefinedBField.setProperty(RtpEditorUIModel.PROPERTY_RTP_UNDEFINED_B);
1150 rtpUndefinedBField.setBean(model);
1151 closeButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editRtp.action.close.mnemonic"),'Z'));
1152 closeButton.setIcon(SwingUtil.createActionIcon("close"));
1153 saveButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editRtp.action.save.mnemonic"),'Z'));
1154 saveButton.setIcon(SwingUtil.createActionIcon("save"));
1155
1156 rtpEditorDialog.pack();
1157
1158 validatorIds = SwingValidatorUtil.detectValidators(this);
1159 SwingValidatorUtil.installUI(this);
1160 }
1161
1162 private void $initialize() {
1163 if (allComponentsCreated) {
1164 return;
1165 }
1166 if (log.isDebugEnabled()) {
1167 log.debug(this);
1168 }
1169 handler.beforeInit(this);
1170 $objectMap.put("rtpEditorDialog", rtpEditorDialog);
1171 createModel();
1172 createBroker();
1173 createValidator();
1174 createHeaderToolBar();
1175 createPreviousRowButton();
1176 createNextRowButton();
1177 createBodyPanel();
1178
1179 $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
1180
1181 $JPanel0.setName("$JPanel0");
1182 $JPanel0.setLayout(new BorderLayout());
1183 createRtpFormulaLabelContainer();
1184 createRtpFormulaLabel();
1185
1186 $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
1187
1188 $JPanel1.setName("$JPanel1");
1189 $JPanel1.setLayout(new GridLayout(3, 1));
1190 createMalePanel();
1191
1192 $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
1193
1194 $JPanel2.setName("$JPanel2");
1195 $JPanel2.setLayout(new GridLayout(1, 2));
1196 createMaleAPanel();
1197 createRtpMaleALabel();
1198 createRtpMaleAField();
1199 createMaleBPanel();
1200 createRtpMaleBLabel();
1201 createRtpMaleBField();
1202 createCopyValuesButton();
1203 createFemalePanel();
1204 createFemaleAPanel();
1205 createRtpFemaleALabel();
1206 createRtpFemaleAField();
1207 createFemaleBPanel();
1208 createRtpFemaleBLabel();
1209 createRtpFemaleBField();
1210 createUndefinedPanel();
1211 createUndefinedAPanel();
1212 createRtpUndefinedALabel();
1213 createRtpUndefinedAField();
1214 createUndefinedBPanel();
1215 createRtpUndefinedBLabel();
1216 createRtpUndefinedBField();
1217 createActions();
1218 createCloseButton();
1219 createSaveButton();
1220
1221 setName("rtpEditorDialog");
1222 rtpEditorDialog.getContentPane().setLayout(new BorderLayout());
1223 setModal(true);
1224 setUndecorated(true);
1225 setAlwaysOnTop(true);
1226
1227
1228 $registerDefaultBindings();
1229 $completeSetup();
1230 handler.afterInit(this);
1231 }
1232
1233 private void $registerDefaultBindings() {
1234
1235 registerDataBinding(new DefaultJAXXBinding(this, BINDING_PREVIOUS_ROW_BUTTON_ENABLED, true) {
1236
1237 @Override
1238 public void applyDataBinding() {
1239 if (model != null) {
1240 model.addPropertyChangeListener("firstRow", this);
1241 }
1242 }
1243
1244 @Override
1245 public void processDataBinding() {
1246 if (model != null) {
1247 previousRowButton.setEnabled(!model.isFirstRow());
1248 }
1249 }
1250
1251 @Override
1252 public void removeDataBinding() {
1253 if (model != null) {
1254 model.removePropertyChangeListener("firstRow", this);
1255 }
1256 }
1257 });
1258 registerDataBinding(new DefaultJAXXBinding(this, BINDING_NEXT_ROW_BUTTON_ENABLED, true) {
1259
1260 @Override
1261 public void applyDataBinding() {
1262 if (model != null) {
1263 model.addPropertyChangeListener("lastRow", this);
1264 }
1265 }
1266
1267 @Override
1268 public void processDataBinding() {
1269 if (model != null) {
1270 nextRowButton.setEnabled(!model.isLastRow());
1271 }
1272 }
1273
1274 @Override
1275 public void removeDataBinding() {
1276 if (model != null) {
1277 model.removePropertyChangeListener("lastRow", this);
1278 }
1279 }
1280 });
1281 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_MALE_AFIELD_NUMBER_PATTERN, true ,"DECIMAL9_PATTERN") {
1282
1283 @Override
1284 public void processDataBinding() {
1285 rtpMaleAField.setNumberPattern(DECIMAL9_PATTERN);
1286 }
1287 });
1288 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_MALE_AFIELD_NUMBER_VALUE, true) {
1289
1290 @Override
1291 public void applyDataBinding() {
1292 if (model != null) {
1293 model.addPropertyChangeListener("rtpMaleA", this);
1294 }
1295 }
1296
1297 @Override
1298 public void processDataBinding() {
1299 if (model != null) {
1300 rtpMaleAField.setNumberValue(model.getRtpMaleA());
1301 }
1302 }
1303
1304 @Override
1305 public void removeDataBinding() {
1306 if (model != null) {
1307 model.removePropertyChangeListener("rtpMaleA", this);
1308 }
1309 }
1310 });
1311 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_MALE_BFIELD_NUMBER_PATTERN, true ,"DECIMAL4_PATTERN") {
1312
1313 @Override
1314 public void processDataBinding() {
1315 rtpMaleBField.setNumberPattern(DECIMAL4_PATTERN);
1316 }
1317 });
1318 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_MALE_BFIELD_NUMBER_VALUE, true) {
1319
1320 @Override
1321 public void applyDataBinding() {
1322 if (model != null) {
1323 model.addPropertyChangeListener("rtpMaleB", this);
1324 }
1325 }
1326
1327 @Override
1328 public void processDataBinding() {
1329 if (model != null) {
1330 rtpMaleBField.setNumberValue(model.getRtpMaleB());
1331 }
1332 }
1333
1334 @Override
1335 public void removeDataBinding() {
1336 if (model != null) {
1337 model.removePropertyChangeListener("rtpMaleB", this);
1338 }
1339 }
1340 });
1341 registerDataBinding(new DefaultJAXXBinding(this, BINDING_COPY_VALUES_BUTTON_ENABLED, true, true) {
1342
1343 @Override
1344 public void applyDataBinding() {
1345 if (model != null) {
1346 model.addPropertyChangeListener("rtpMaleA", this);
1347 }
1348 if (model != null) {
1349 model.addPropertyChangeListener("rtpMaleB", this);
1350 }
1351 }
1352
1353 @Override
1354 public void processDataBinding() {
1355 if (model != null) {
1356 copyValuesButton.setEnabled(model.getRtpMaleA() != null && model.getRtpMaleB() != null);
1357 }
1358 }
1359
1360 @Override
1361 public void removeDataBinding() {
1362 if (model != null) {
1363 model.removePropertyChangeListener("rtpMaleA", this);
1364 }
1365 if (model != null) {
1366 model.removePropertyChangeListener("rtpMaleB", this);
1367 }
1368 }
1369 });
1370 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_FEMALE_AFIELD_NUMBER_PATTERN, true ,"DECIMAL9_PATTERN") {
1371
1372 @Override
1373 public void processDataBinding() {
1374 rtpFemaleAField.setNumberPattern(DECIMAL9_PATTERN);
1375 }
1376 });
1377 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_FEMALE_AFIELD_NUMBER_VALUE, true) {
1378
1379 @Override
1380 public void applyDataBinding() {
1381 if (model != null) {
1382 model.addPropertyChangeListener("rtpFemaleA", this);
1383 }
1384 }
1385
1386 @Override
1387 public void processDataBinding() {
1388 if (model != null) {
1389 rtpFemaleAField.setNumberValue(model.getRtpFemaleA());
1390 }
1391 }
1392
1393 @Override
1394 public void removeDataBinding() {
1395 if (model != null) {
1396 model.removePropertyChangeListener("rtpFemaleA", this);
1397 }
1398 }
1399 });
1400 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_FEMALE_BFIELD_NUMBER_PATTERN, true ,"DECIMAL4_PATTERN") {
1401
1402 @Override
1403 public void processDataBinding() {
1404 rtpFemaleBField.setNumberPattern(DECIMAL4_PATTERN);
1405 }
1406 });
1407 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_FEMALE_BFIELD_NUMBER_VALUE, true) {
1408
1409 @Override
1410 public void applyDataBinding() {
1411 if (model != null) {
1412 model.addPropertyChangeListener("rtpFemaleB", this);
1413 }
1414 }
1415
1416 @Override
1417 public void processDataBinding() {
1418 if (model != null) {
1419 rtpFemaleBField.setNumberValue(model.getRtpFemaleB());
1420 }
1421 }
1422
1423 @Override
1424 public void removeDataBinding() {
1425 if (model != null) {
1426 model.removePropertyChangeListener("rtpFemaleB", this);
1427 }
1428 }
1429 });
1430 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_UNDEFINED_AFIELD_NUMBER_PATTERN, true ,"DECIMAL9_PATTERN") {
1431
1432 @Override
1433 public void processDataBinding() {
1434 rtpUndefinedAField.setNumberPattern(DECIMAL9_PATTERN);
1435 }
1436 });
1437 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_UNDEFINED_AFIELD_NUMBER_VALUE, true) {
1438
1439 @Override
1440 public void applyDataBinding() {
1441 if (model != null) {
1442 model.addPropertyChangeListener("rtpUndefinedA", this);
1443 }
1444 }
1445
1446 @Override
1447 public void processDataBinding() {
1448 if (model != null) {
1449 rtpUndefinedAField.setNumberValue(model.getRtpUndefinedA());
1450 }
1451 }
1452
1453 @Override
1454 public void removeDataBinding() {
1455 if (model != null) {
1456 model.removePropertyChangeListener("rtpUndefinedA", this);
1457 }
1458 }
1459 });
1460 registerDataBinding(new SimpleJAXXObjectBinding(this, BINDING_RTP_UNDEFINED_BFIELD_NUMBER_PATTERN, true ,"DECIMAL4_PATTERN") {
1461
1462 @Override
1463 public void processDataBinding() {
1464 rtpUndefinedBField.setNumberPattern(DECIMAL4_PATTERN);
1465 }
1466 });
1467 registerDataBinding(new DefaultJAXXBinding(this, BINDING_RTP_UNDEFINED_BFIELD_NUMBER_VALUE, true) {
1468
1469 @Override
1470 public void applyDataBinding() {
1471 if (model != null) {
1472 model.addPropertyChangeListener("rtpUndefinedB", this);
1473 }
1474 }
1475
1476 @Override
1477 public void processDataBinding() {
1478 if (model != null) {
1479 rtpUndefinedBField.setNumberValue(model.getRtpUndefinedB());
1480 }
1481 }
1482
1483 @Override
1484 public void removeDataBinding() {
1485 if (model != null) {
1486 model.removePropertyChangeListener("rtpUndefinedB", this);
1487 }
1488 }
1489 });
1490 registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_BUTTON_ENABLED, true, true) {
1491
1492 @Override
1493 public void applyDataBinding() {
1494 if (model != null) {
1495 model.addPropertyChangeListener("modify", this);
1496 }
1497 if (model != null) {
1498 model.addPropertyChangeListener("valid", this);
1499 }
1500 }
1501
1502 @Override
1503 public void processDataBinding() {
1504 if (model != null) {
1505 saveButton.setEnabled(model.isModify() && model.isValid());
1506 }
1507 }
1508
1509 @Override
1510 public void removeDataBinding() {
1511 if (model != null) {
1512 model.removePropertyChangeListener("modify", this);
1513 }
1514 if (model != null) {
1515 model.removePropertyChangeListener("valid", this);
1516 }
1517 }
1518 });
1519 }
1520
1521 }