1 package fr.ifremer.dali.ui.swing.content.home;
2
3 import fr.ifremer.dali.dto.SearchDateDTO;
4 import fr.ifremer.dali.dto.StateDTO;
5 import fr.ifremer.dali.dto.SynchronizationStatusDTO;
6 import fr.ifremer.dali.dto.configuration.context.ContextDTO;
7 import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
8 import fr.ifremer.dali.dto.data.survey.CampaignDTO;
9 import fr.ifremer.dali.dto.referential.LocationDTO;
10 import fr.ifremer.dali.ui.swing.DaliHelpBroker;
11 import fr.ifremer.dali.ui.swing.DaliUIContext;
12 import fr.ifremer.dali.ui.swing.content.home.map.SurveysMapUI;
13 import fr.ifremer.dali.ui.swing.content.home.operation.OperationsTableUI;
14 import fr.ifremer.dali.ui.swing.content.home.survey.SurveysTableUI;
15 import fr.ifremer.dali.ui.swing.util.DaliUI;
16 import fr.ifremer.dali.ui.swing.util.image.BackgroundPanel;
17 import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
18 import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
19 import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedComboBox;
20 import fr.ifremer.quadrige3.ui.swing.component.date.JLocalDatePicker;
21 import java.awt.BorderLayout;
22 import java.awt.Component;
23 import java.awt.Container;
24 import java.awt.GridBagConstraints;
25 import java.awt.GridLayout;
26 import java.awt.Insets;
27 import java.awt.LayoutManager;
28 import java.awt.event.ActionEvent;
29 import java.awt.event.ActionListener;
30 import java.awt.event.KeyEvent;
31 import java.awt.event.KeyListener;
32 import java.util.ArrayList;
33 import java.util.HashMap;
34 import java.util.List;
35 import java.util.Map;
36 import java.util.TreeMap;
37 import javax.swing.BorderFactory;
38 import javax.swing.Box;
39 import javax.swing.BoxLayout;
40 import javax.swing.JButton;
41 import javax.swing.JLabel;
42 import javax.swing.JPanel;
43 import javax.swing.JTextField;
44 import jaxx.runtime.JAXXBinding;
45 import jaxx.runtime.JAXXContext;
46 import jaxx.runtime.JAXXObject;
47 import jaxx.runtime.JAXXObjectDescriptor;
48 import jaxx.runtime.JAXXUtil;
49 import jaxx.runtime.JAXXValidator;
50 import jaxx.runtime.SwingUtil;
51 import jaxx.runtime.binding.DefaultJAXXBinding;
52 import jaxx.runtime.context.DefaultJAXXContext;
53 import jaxx.runtime.swing.CardLayout2Ext;
54 import jaxx.runtime.swing.Table;
55 import jaxx.runtime.swing.help.JAXXHelpUI;
56 import jaxx.runtime.validator.swing.SwingValidator;
57 import jaxx.runtime.validator.swing.SwingValidatorUtil;
58 import jaxx.runtime.validator.swing.meta.Validator;
59 import jaxx.runtime.validator.swing.meta.ValidatorField;
60 import jaxx.runtime.validator.swing.ui.ImageValidationUI;
61 import org.apache.commons.logging.Log;
62 import org.apache.commons.logging.LogFactory;
63 import static org.nuiton.i18n.I18n.t;
64
65 public class HomeUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, DaliUI<HomeUIModel, HomeUIHandler>, JAXXObject, JAXXValidator {
66
67
68
69
70
71 public static final String BINDING_CAMPAIGN_COMBO_ACTION_ENABLED = "campaignCombo.actionEnabled";
72 public static final String BINDING_CAMPAIGN_COMBO_SELECTED_ITEM = "campaignCombo.selectedItem";
73 public static final String BINDING_COMMENT_EDITOR_TEXT = "commentEditor.text";
74 public static final String BINDING_CONTEXT_COMBOBOX_SELECTED_ITEM = "contextCombobox.selectedItem";
75 public static final String BINDING_END_DATE_EDITOR_LOCAL_DATE = "endDateEditor.localDate";
76 public static final String BINDING_LOCATION_COMBO_ACTION_ENABLED = "locationCombo.actionEnabled";
77 public static final String BINDING_LOCATION_COMBO_SELECTED_ITEM = "locationCombo.selectedItem";
78 public static final String BINDING_MNEMONIC_EDITOR_TEXT = "mnemonicEditor.text";
79 public static final String BINDING_PROGRAM_COMBO_ACTION_ENABLED = "programCombo.actionEnabled";
80 public static final String BINDING_PROGRAM_COMBO_SELECTED_ITEM = "programCombo.selectedItem";
81 public static final String BINDING_SAVE_BUTTON_ENABLED = "saveButton.enabled";
82 public static final String BINDING_SEARCH_DATE_COMBO_SELECTED_ITEM = "searchDateCombo.selectedItem";
83 public static final String BINDING_START_DATE_EDITOR_LOCAL_DATE = "startDateEditor.localDate";
84 public static final String BINDING_STATE_COMBO_SELECTED_ITEM = "stateCombo.selectedItem";
85 public static final String BINDING_SYNCHRONIZATION_STATUS_COMBO_SELECTED_ITEM = "synchronizationStatusCombo.selectedItem";
86
87
88
89
90
91 private static final String $jaxxObjectDescriptor = "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";
92 private static final Log log = LogFactory.getLog(HomeUI.class);
93 private static final long serialVersionUID = 1L;
94
95
96
97
98
99 protected List<Object> $activeBindings = new ArrayList<Object>();
100 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
101 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
102 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
103 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
104 private boolean allComponentsCreated;
105 protected final JAXXContext delegateContext = new DefaultJAXXContext();
106
107
108
109
110
111 protected JLabel andLabel;
112 protected JPanel bottomPanel;
113 protected CardLayout2Ext bottomPanelLayout;
114 protected DaliHelpBroker broker;
115 protected ExtendedComboBox<CampaignDTO> campaignCombo;
116 protected JLabel campaignLabel;
117 protected JPanel campaignPanel;
118 protected JButton clearButton;
119 protected JButton closeButton;
120 protected JTextField commentEditor;
121 protected JLabel commentLabel;
122 protected JPanel commentPanel;
123 protected ExtendedComboBox<ContextDTO> contextCombobox;
124 protected JLocalDatePicker endDateEditor;
125 protected final HomeUIHandler handler = createHandler();
126 protected JPanel homeMain;
127 protected JPanel homeMenu;
128 protected HomeUI homeUI = this;
129 protected BackgroundPanel leftImage;
130 protected ExtendedComboBox<LocationDTO> locationCombo;
131 protected JLabel locationLabel;
132 protected JPanel locationPanel;
133 protected JPanel menuContextPanel;
134 protected Table menuSelectionPanel;
135 protected JTextField mnemonicEditor;
136 protected JLabel mnemonicLabel;
137 protected JPanel mnemonicPanel;
138 protected HomeUIModel model;
139 @ValidatorField( validatorId = "validator", propertyName = "operationsTableUIModel", editorName = "operationsTableUI")
140 protected OperationsTableUI operationsTableUI;
141 protected ExtendedComboBox<ProgramDTO> programCombo;
142 protected JLabel programLabel;
143 protected JPanel programPanel;
144 protected JButton saveButton;
145 protected JButton searchButton;
146 protected ExtendedComboBox<SearchDateDTO> searchDateCombo;
147 protected JPanel selectionButtonsPanel;
148 protected JPanel separatorPanel;
149 protected JLocalDatePicker startDateEditor;
150 protected JLabel startDateLabel;
151 protected ExtendedComboBox<StateDTO> stateCombo;
152 protected JLabel stateLabel;
153 protected JPanel statePanel;
154 protected SurveysMapUI surveysMapUI;
155 @ValidatorField( validatorId = "validator", propertyName = "surveysTableUIModel", editorName = "surveysTableUI")
156 protected SurveysTableUI surveysTableUI;
157 protected ExtendedComboBox<SynchronizationStatusDTO> synchronizationStatusCombo;
158 protected JLabel synchronizationStatusLabel;
159 protected JPanel synchronizationStatusPanel;
160 @Validator( validatorId = "validator")
161 protected SwingValidator<HomeUIModel> validator;
162 protected List<String> validatorIds = new ArrayList<String>();
163
164
165
166
167
168 private JPanel $JPanel0;
169 private JPanel $JPanel1;
170 private JPanel $JPanel2;
171 private JPanel $JPanel3;
172 private Table $Table0;
173
174
175
176
177
178 public HomeUI(ApplicationUI parentUI) {
179 ApplicationUIUtil.setParentUI(this, parentUI);
180 $initialize();
181 }
182
183 public HomeUI() {
184 $initialize();
185 }
186
187 public HomeUI(JAXXContext parentContext) {
188 JAXXUtil.initContext(this, parentContext);
189 $initialize();
190 }
191
192 public HomeUI(boolean param0) {
193 super(param0);
194 $initialize();
195 }
196
197 public HomeUI(JAXXContext parentContext, boolean param1) {
198 super(param1);
199 JAXXUtil.initContext(this, parentContext);
200 $initialize();
201 }
202
203 public HomeUI(LayoutManager param0) {
204 super(param0);
205 $initialize();
206 }
207
208 public HomeUI(JAXXContext parentContext, LayoutManager param1) {
209 super(param1);
210 JAXXUtil.initContext(this, parentContext);
211 $initialize();
212 }
213
214 public HomeUI(LayoutManager param0, boolean param1) {
215 super(param0 ,param1);
216 $initialize();
217 }
218
219 public HomeUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
220 super(param1 ,param2);
221 JAXXUtil.initContext(this, parentContext);
222 $initialize();
223 }
224
225
226
227
228
229 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
230 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
231 }
232
233
234
235
236
237 @Override
238 public void applyDataBinding(String $binding) {
239 if (allComponentsCreated && $bindings.containsKey($binding)) {
240 getDataBinding($binding).applyDataBinding();
241 }
242 processDataBinding($binding);
243 }
244
245 @Override
246 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
247 super.firePropertyChange(propertyName, oldValue, newValue);
248 }
249
250 @Override
251 public Map<String, Object> get$objectMap() {
252 return $objectMap;
253 }
254
255 @Override
256 public JAXXBinding getDataBinding(String bindingId) {
257 return $bindings.get(bindingId);
258 }
259
260 @Override
261 public JAXXBinding[] getDataBindings() {
262 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
263 }
264
265 @Override
266 public Object getObjectById(String id) {
267 return $objectMap.get(id);
268 }
269
270 @Override
271 public void processDataBinding(String $binding, boolean $force) {
272 if (!$force && $activeBindings.contains($binding)) {
273 return;
274 }
275 $activeBindings.add($binding);
276 try {
277 if (allComponentsCreated && $bindings.containsKey($binding)) {
278 getDataBinding($binding).processDataBinding();
279 }
280 } finally {
281 $activeBindings.remove($binding);
282 }
283 }
284
285 @Override
286 public void processDataBinding(String $binding) {
287 processDataBinding($binding, false);
288 }
289
290 @Override
291 public void registerDataBinding(JAXXBinding binding) {
292 $bindings.put(binding.getId(), binding);
293 }
294
295 @Override
296 public void removeDataBinding(String $binding) {
297 if (allComponentsCreated && $bindings.containsKey($binding)) {
298 getDataBinding($binding).removeDataBinding();
299 }
300 }
301
302
303
304
305
306 @Override
307 public <T> T getContextValue(Class<T> clazz) {
308 return delegateContext.getContextValue(clazz, null);
309 }
310
311 @Override
312 public <T> T getContextValue(Class<T> clazz, String name) {
313 return delegateContext.getContextValue(clazz, name);
314 }
315
316 @Override
317 public JAXXContext getDelegateContext() {
318 return delegateContext;
319 }
320
321 @Override
322 public <O extends Container> O getParentContainer(Class<O> clazz) {
323 return SwingUtil.getParentContainer(this, clazz);
324 }
325
326 @Override
327 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
328 return SwingUtil.getParentContainer(source, clazz);
329 }
330
331 @Override
332 public <T> void removeContextValue(Class<T> clazz) {
333 delegateContext.removeContextValue(clazz, null);
334 }
335
336 @Override
337 public <T> void removeContextValue(Class<T> clazz, String name) {
338 delegateContext.removeContextValue(clazz, name);
339 }
340
341 @Override
342 public <T> void setContextValue(T o) {
343 delegateContext.setContextValue(o, null);
344 }
345
346 @Override
347 public <T> void setContextValue(T o, String name) {
348 delegateContext.setContextValue(o, name);
349 }
350
351
352
353
354
355 @Override
356 public SwingValidator<?> getValidator(String validatorId) {
357 return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
358 }
359
360 @Override
361 public List<String> getValidatorIds() {
362 return validatorIds;
363 }
364
365 @Override
366 public void registerValidatorFields() {
367 SwingValidatorUtil.detectValidatorFields(this);
368 }
369
370
371
372
373
374 public void doActionPerformed__on__endDateEditor(ActionEvent event) {
375 if (log.isDebugEnabled()) {
376 log.debug(event);
377 }
378 handler.setLocalDate(event, "endDate");
379 }
380
381 public void doActionPerformed__on__startDateEditor(ActionEvent event) {
382 if (log.isDebugEnabled()) {
383 log.debug(event);
384 }
385 handler.setLocalDate(event, "startDate");
386 }
387
388 public void doKeyReleased__on__commentEditor(KeyEvent event) {
389 if (log.isDebugEnabled()) {
390 log.debug(event);
391 }
392 handler.setText(event, "comment");
393 }
394
395 public void doKeyReleased__on__mnemonicEditor(KeyEvent event) {
396 if (log.isDebugEnabled()) {
397 log.debug(event);
398 }
399 handler.setText(event, "name");
400 }
401
402
403
404
405
406 public JLabel getAndLabel() {
407 return andLabel;
408 }
409
410 public JPanel getBottomPanel() {
411 return bottomPanel;
412 }
413
414 public CardLayout2Ext getBottomPanelLayout() {
415 return bottomPanelLayout;
416 }
417
418 public DaliHelpBroker getBroker() {
419 return broker;
420 }
421
422 public ExtendedComboBox<CampaignDTO> getCampaignCombo() {
423 return campaignCombo;
424 }
425
426 public JLabel getCampaignLabel() {
427 return campaignLabel;
428 }
429
430 public JPanel getCampaignPanel() {
431 return campaignPanel;
432 }
433
434 public JButton getClearButton() {
435 return clearButton;
436 }
437
438 public JButton getCloseButton() {
439 return closeButton;
440 }
441
442 public JTextField getCommentEditor() {
443 return commentEditor;
444 }
445
446 public JLabel getCommentLabel() {
447 return commentLabel;
448 }
449
450 public JPanel getCommentPanel() {
451 return commentPanel;
452 }
453
454 public ExtendedComboBox<ContextDTO> getContextCombobox() {
455 return contextCombobox;
456 }
457
458 public JLocalDatePicker getEndDateEditor() {
459 return endDateEditor;
460 }
461
462 public HomeUIHandler getHandler() {
463 return handler;
464 }
465
466 public JPanel getHomeMain() {
467 return homeMain;
468 }
469
470 public JPanel getHomeMenu() {
471 return homeMenu;
472 }
473
474 public BackgroundPanel getLeftImage() {
475 return leftImage;
476 }
477
478 public ExtendedComboBox<LocationDTO> getLocationCombo() {
479 return locationCombo;
480 }
481
482 public JLabel getLocationLabel() {
483 return locationLabel;
484 }
485
486 public JPanel getLocationPanel() {
487 return locationPanel;
488 }
489
490 public JPanel getMenuContextPanel() {
491 return menuContextPanel;
492 }
493
494 public Table getMenuSelectionPanel() {
495 return menuSelectionPanel;
496 }
497
498 public JTextField getMnemonicEditor() {
499 return mnemonicEditor;
500 }
501
502 public JLabel getMnemonicLabel() {
503 return mnemonicLabel;
504 }
505
506 public JPanel getMnemonicPanel() {
507 return mnemonicPanel;
508 }
509
510 public HomeUIModel getModel() {
511 return model;
512 }
513
514 public OperationsTableUI getOperationsTableUI() {
515 return operationsTableUI;
516 }
517
518 public ExtendedComboBox<ProgramDTO> getProgramCombo() {
519 return programCombo;
520 }
521
522 public JLabel getProgramLabel() {
523 return programLabel;
524 }
525
526 public JPanel getProgramPanel() {
527 return programPanel;
528 }
529
530 public JButton getSaveButton() {
531 return saveButton;
532 }
533
534 public JButton getSearchButton() {
535 return searchButton;
536 }
537
538 public ExtendedComboBox<SearchDateDTO> getSearchDateCombo() {
539 return searchDateCombo;
540 }
541
542 public JPanel getSelectionButtonsPanel() {
543 return selectionButtonsPanel;
544 }
545
546 public JPanel getSeparatorPanel() {
547 return separatorPanel;
548 }
549
550 public JLocalDatePicker getStartDateEditor() {
551 return startDateEditor;
552 }
553
554 public JLabel getStartDateLabel() {
555 return startDateLabel;
556 }
557
558 public ExtendedComboBox<StateDTO> getStateCombo() {
559 return stateCombo;
560 }
561
562 public JLabel getStateLabel() {
563 return stateLabel;
564 }
565
566 public JPanel getStatePanel() {
567 return statePanel;
568 }
569
570 public SurveysMapUI getSurveysMapUI() {
571 return surveysMapUI;
572 }
573
574 public SurveysTableUI getSurveysTableUI() {
575 return surveysTableUI;
576 }
577
578 public ExtendedComboBox<SynchronizationStatusDTO> getSynchronizationStatusCombo() {
579 return synchronizationStatusCombo;
580 }
581
582 public JLabel getSynchronizationStatusLabel() {
583 return synchronizationStatusLabel;
584 }
585
586 public JPanel getSynchronizationStatusPanel() {
587 return synchronizationStatusPanel;
588 }
589
590 public SwingValidator<HomeUIModel> getValidator() {
591 return validator;
592 }
593
594
595
596
597
598 @Override
599 public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
600 broker.installUI(component, helpId);
601 }
602
603 @Override
604 public void showHelp(String helpId) {
605 getBroker().showHelp(this, helpId);
606 }
607
608
609
610
611
612 protected JPanel get$JPanel0() {
613 return $JPanel0;
614 }
615
616 protected JPanel get$JPanel1() {
617 return $JPanel1;
618 }
619
620 protected JPanel get$JPanel2() {
621 return $JPanel2;
622 }
623
624 protected JPanel get$JPanel3() {
625 return $JPanel3;
626 }
627
628 protected Table get$Table0() {
629 return $Table0;
630 }
631
632
633
634
635
636 protected void addChildrenToBottomPanel() {
637 if (!allComponentsCreated) {
638 return;
639 }
640 bottomPanel.add(SwingUtil.boxComponentWithJxLayer(operationsTableUI), HomeUIHandler.SAMPLING_OPERATIONS_CARD);
641 bottomPanel.add(surveysMapUI, HomeUIHandler.SURVEYS_MAP_CARD);
642 }
643
644 protected void addChildrenToCampaignPanel() {
645 if (!allComponentsCreated) {
646 return;
647 }
648 campaignPanel.add(campaignLabel, BorderLayout.PAGE_START);
649 campaignPanel.add(campaignCombo);
650 }
651
652 protected void addChildrenToCommentPanel() {
653 if (!allComponentsCreated) {
654 return;
655 }
656 commentPanel.add(commentLabel, BorderLayout.PAGE_START);
657 commentPanel.add(commentEditor);
658 }
659
660 protected void addChildrenToHomeMain() {
661 if (!allComponentsCreated) {
662 return;
663 }
664 homeMain.add($Table0);
665 homeMain.add($JPanel3, BorderLayout.PAGE_END);
666 }
667
668 protected void addChildrenToHomeMenu() {
669 if (!allComponentsCreated) {
670 return;
671 }
672 homeMenu.add(menuContextPanel);
673 homeMenu.add(separatorPanel);
674 homeMenu.add(menuSelectionPanel);
675 homeMenu.add(selectionButtonsPanel);
676 }
677
678 protected void addChildrenToHomeUI() {
679 if (!allComponentsCreated) {
680 return;
681 }
682 add($JPanel0, BorderLayout.LINE_START);
683 add(homeMain, BorderLayout.CENTER);
684 }
685
686 protected void addChildrenToLocationPanel() {
687 if (!allComponentsCreated) {
688 return;
689 }
690 locationPanel.add(locationLabel, BorderLayout.PAGE_START);
691 locationPanel.add(locationCombo);
692 }
693
694 protected void addChildrenToMenuContextPanel() {
695 if (!allComponentsCreated) {
696 return;
697 }
698 menuContextPanel.add(contextCombobox);
699 }
700
701 protected void addChildrenToMenuSelectionPanel() {
702 if (!allComponentsCreated) {
703 return;
704 }
705 menuSelectionPanel.add(campaignPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
706 menuSelectionPanel.add(programPanel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
707 menuSelectionPanel.add(locationPanel, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
708 menuSelectionPanel.add($JPanel1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
709 menuSelectionPanel.add($JPanel2, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
710 menuSelectionPanel.add(mnemonicPanel, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, 10, 2, new Insets(3, 3, 3, 3), 0, 0));
711 menuSelectionPanel.add(commentPanel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, 10, 2, new Insets(3, 3, 3, 3), 0, 0));
712 menuSelectionPanel.add(statePanel, new GridBagConstraints(0, 7, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
713 menuSelectionPanel.add(synchronizationStatusPanel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
714 }
715
716 protected void addChildrenToMnemonicPanel() {
717 if (!allComponentsCreated) {
718 return;
719 }
720 mnemonicPanel.add(mnemonicLabel, BorderLayout.PAGE_START);
721 mnemonicPanel.add(mnemonicEditor);
722 }
723
724 protected void addChildrenToProgramPanel() {
725 if (!allComponentsCreated) {
726 return;
727 }
728 programPanel.add(programLabel, BorderLayout.PAGE_START);
729 programPanel.add(programCombo);
730 }
731
732 protected void addChildrenToSelectionButtonsPanel() {
733 if (!allComponentsCreated) {
734 return;
735 }
736 selectionButtonsPanel.add(clearButton);
737 selectionButtonsPanel.add(searchButton);
738 }
739
740 protected void addChildrenToStatePanel() {
741 if (!allComponentsCreated) {
742 return;
743 }
744 statePanel.add(stateLabel, BorderLayout.PAGE_START);
745 statePanel.add(stateCombo);
746 }
747
748 protected void addChildrenToSynchronizationStatusPanel() {
749 if (!allComponentsCreated) {
750 return;
751 }
752 synchronizationStatusPanel.add(synchronizationStatusLabel, BorderLayout.PAGE_START);
753 synchronizationStatusPanel.add(synchronizationStatusCombo);
754 }
755
756 protected void addChildrenToValidator() {
757 if (!allComponentsCreated) {
758 return;
759 }
760 validator.setUiClass(ImageValidationUI.class);
761 validator.setBean(model);
762 }
763
764 protected void createAndLabel() {
765 $objectMap.put("andLabel", andLabel = new JLabel());
766
767 andLabel.setName("andLabel");
768 andLabel.setText(t("dali.property.and"));
769 }
770
771 protected void createBottomPanel() {
772 $objectMap.put("bottomPanel", bottomPanel = new JPanel());
773
774 bottomPanel.setName("bottomPanel");
775 bottomPanel.setLayout(bottomPanelLayout);
776 }
777
778 protected void createBottomPanelLayout() {
779 $objectMap.put("bottomPanelLayout", bottomPanelLayout = new CardLayout2Ext(this, "bottomPanel"));
780 }
781
782 protected void createBroker() {
783 $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
784 }
785
786 protected void createCampaignCombo() {
787 $objectMap.put("campaignCombo", campaignCombo = new ExtendedComboBox<CampaignDTO>(this));
788
789 campaignCombo.setName("campaignCombo");
790 campaignCombo.setFilterable(true);
791 campaignCombo.setShowDecorator(false);
792 campaignCombo.setProperty("campaign");
793 campaignCombo.setActionToolTipI18n("dali.common.unfilter");
794 campaignCombo.setShowReset(true);
795 campaignCombo.setShowActionButton(true);
796 }
797
798 protected void createCampaignLabel() {
799 $objectMap.put("campaignLabel", campaignLabel = new JLabel());
800
801 campaignLabel.setName("campaignLabel");
802 campaignLabel.setText(t("dali.property.campaign"));
803 }
804
805 protected void createCampaignPanel() {
806 $objectMap.put("campaignPanel", campaignPanel = new JPanel());
807
808 campaignPanel.setName("campaignPanel");
809 campaignPanel.setLayout(new BorderLayout());
810 }
811
812 protected void createClearButton() {
813 $objectMap.put("clearButton", clearButton = new JButton());
814
815 clearButton.setName("clearButton");
816 clearButton.setText(t("dali.action.search.clear.label"));
817 clearButton.setToolTipText(t("dali.action.search.clear.tip"));
818 clearButton.putClientProperty("applicationAction", ClearAction.class);
819 }
820
821 protected void createCloseButton() {
822 $objectMap.put("closeButton", closeButton = new JButton());
823
824 closeButton.setName("closeButton");
825 closeButton.setText(t("dali.common.close"));
826 closeButton.putClientProperty("applicationActionKey", fr.ifremer.dali.ui.swing.util.DaliKeyStrokes.CANCEL);
827 closeButton.putClientProperty("applicationAction", CloseAction.class);
828 }
829
830 protected void createCommentEditor() {
831 $objectMap.put("commentEditor", commentEditor = new JTextField());
832
833 commentEditor.setName("commentEditor");
834 commentEditor.setColumns(15);
835 commentEditor.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__commentEditor"));
836 }
837
838 protected void createCommentLabel() {
839 $objectMap.put("commentLabel", commentLabel = new JLabel());
840
841 commentLabel.setName("commentLabel");
842 commentLabel.setText(t("dali.property.comment"));
843 }
844
845 protected void createCommentPanel() {
846 $objectMap.put("commentPanel", commentPanel = new JPanel());
847
848 commentPanel.setName("commentPanel");
849 commentPanel.setLayout(new BorderLayout());
850 }
851
852 protected void createContextCombobox() {
853 $objectMap.put("contextCombobox", contextCombobox = new ExtendedComboBox<ContextDTO>(this));
854
855 contextCombobox.setName("contextCombobox");
856 contextCombobox.setFilterable(true);
857 contextCombobox.setShowDecorator(false);
858 contextCombobox.setProperty("context");
859 contextCombobox.setShowReset(true);
860 }
861
862 protected void createEndDateEditor() {
863 $objectMap.put("endDateEditor", endDateEditor = new JLocalDatePicker());
864
865 endDateEditor.setName("endDateEditor");
866 endDateEditor.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__endDateEditor"));
867 endDateEditor.putClientProperty("selectOnFocus", true);
868 }
869
870 protected HomeUIHandler createHandler() {
871 return new HomeUIHandler();
872 }
873
874 protected void createHomeMain() {
875 $objectMap.put("homeMain", homeMain = new JPanel());
876
877 homeMain.setName("homeMain");
878 homeMain.setLayout(new BorderLayout());
879 }
880
881 protected void createHomeMenu() {
882 $objectMap.put("homeMenu", homeMenu = new JPanel());
883
884 homeMenu.setName("homeMenu");
885 homeMenu.setLayout(new BoxLayout(homeMenu, BoxLayout.PAGE_AXIS));
886 }
887
888 protected void createLeftImage() {
889 $objectMap.put("leftImage", leftImage = new BackgroundPanel());
890
891 leftImage.setName("leftImage");
892 }
893
894 protected void createLocationCombo() {
895 $objectMap.put("locationCombo", locationCombo = new ExtendedComboBox<LocationDTO>(this));
896
897 locationCombo.setName("locationCombo");
898 locationCombo.setFilterable(true);
899 locationCombo.setShowDecorator(false);
900 locationCombo.setProperty("location");
901 locationCombo.setActionToolTipI18n("dali.common.unfilter");
902 locationCombo.setShowReset(true);
903 locationCombo.setShowActionButton(true);
904 }
905
906 protected void createLocationLabel() {
907 $objectMap.put("locationLabel", locationLabel = new JLabel());
908
909 locationLabel.setName("locationLabel");
910 locationLabel.setText(t("dali.property.location"));
911 }
912
913 protected void createLocationPanel() {
914 $objectMap.put("locationPanel", locationPanel = new JPanel());
915
916 locationPanel.setName("locationPanel");
917 locationPanel.setLayout(new BorderLayout());
918 }
919
920 protected void createMenuContextPanel() {
921 $objectMap.put("menuContextPanel", menuContextPanel = new JPanel());
922
923 menuContextPanel.setName("menuContextPanel");
924 menuContextPanel.putClientProperty("panelType", DaliUI.CONTEXT_PANEL_TYPE);
925 }
926
927 protected void createMenuSelectionPanel() {
928 $objectMap.put("menuSelectionPanel", menuSelectionPanel = new Table());
929
930 menuSelectionPanel.setName("menuSelectionPanel");
931 menuSelectionPanel.putClientProperty("panelType", DaliUI.SELECTION_PANEL_TYPE);
932 }
933
934 protected void createMnemonicEditor() {
935 $objectMap.put("mnemonicEditor", mnemonicEditor = new JTextField());
936
937 mnemonicEditor.setName("mnemonicEditor");
938 mnemonicEditor.setColumns(15);
939 mnemonicEditor.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__mnemonicEditor"));
940 }
941
942 protected void createMnemonicLabel() {
943 $objectMap.put("mnemonicLabel", mnemonicLabel = new JLabel());
944
945 mnemonicLabel.setName("mnemonicLabel");
946 mnemonicLabel.setText(t("dali.property.mnemonic"));
947 }
948
949 protected void createMnemonicPanel() {
950 $objectMap.put("mnemonicPanel", mnemonicPanel = new JPanel());
951
952 mnemonicPanel.setName("mnemonicPanel");
953 mnemonicPanel.setLayout(new BorderLayout());
954 }
955
956 protected void createModel() {
957 $objectMap.put("model", model = getContextValue(HomeUIModel.class));
958 }
959
960 protected void createOperationsTableUI() {
961 $objectMap.put("operationsTableUI", operationsTableUI = new OperationsTableUI(this));
962
963 operationsTableUI.setName("operationsTableUI");
964 operationsTableUI.putClientProperty("validatorLabel", t("dali.home.samplingOperation.title"));
965 }
966
967 protected void createProgramCombo() {
968 $objectMap.put("programCombo", programCombo = new ExtendedComboBox<ProgramDTO>(this));
969
970 programCombo.setName("programCombo");
971 programCombo.setFilterable(true);
972 programCombo.setShowDecorator(false);
973 programCombo.setProperty("program");
974 programCombo.setActionToolTipI18n("dali.common.unfilter");
975 programCombo.setShowReset(true);
976 programCombo.setShowActionButton(true);
977 }
978
979 protected void createProgramLabel() {
980 $objectMap.put("programLabel", programLabel = new JLabel());
981
982 programLabel.setName("programLabel");
983 programLabel.setText(t("dali.property.program"));
984 }
985
986 protected void createProgramPanel() {
987 $objectMap.put("programPanel", programPanel = new JPanel());
988
989 programPanel.setName("programPanel");
990 programPanel.setLayout(new BorderLayout());
991 }
992
993 protected void createSaveButton() {
994 $objectMap.put("saveButton", saveButton = new JButton());
995
996 saveButton.setName("saveButton");
997 saveButton.setText(t("dali.common.save"));
998 saveButton.setToolTipText(t("dali.action.save.observations"));
999 saveButton.putClientProperty("applicationActionKey", fr.ifremer.dali.ui.swing.util.DaliKeyStrokes.SAVE);
1000 saveButton.putClientProperty("applicationAction", SaveAction.class);
1001 }
1002
1003 protected void createSearchButton() {
1004 $objectMap.put("searchButton", searchButton = new JButton());
1005
1006 searchButton.setName("searchButton");
1007 searchButton.setText(t("dali.action.search.label"));
1008 searchButton.setToolTipText(t("dali.action.search.tip"));
1009 searchButton.putClientProperty("applicationAction", SearchAction.class);
1010 }
1011
1012 protected void createSearchDateCombo() {
1013 $objectMap.put("searchDateCombo", searchDateCombo = new ExtendedComboBox<SearchDateDTO>(this));
1014
1015 searchDateCombo.setName("searchDateCombo");
1016 searchDateCombo.setFilterable(true);
1017 searchDateCombo.setShowDecorator(false);
1018 searchDateCombo.setProperty("searchDate");
1019 searchDateCombo.setShowReset(true);
1020 }
1021
1022 protected void createSelectionButtonsPanel() {
1023 $objectMap.put("selectionButtonsPanel", selectionButtonsPanel = new JPanel());
1024
1025 selectionButtonsPanel.setName("selectionButtonsPanel");
1026 selectionButtonsPanel.setLayout(new GridLayout(1,0));
1027 }
1028
1029 protected void createSeparatorPanel() {
1030 $objectMap.put("separatorPanel", separatorPanel = new JPanel());
1031
1032 separatorPanel.setName("separatorPanel");
1033 }
1034
1035 protected void createStartDateEditor() {
1036 $objectMap.put("startDateEditor", startDateEditor = new JLocalDatePicker());
1037
1038 startDateEditor.setName("startDateEditor");
1039 startDateEditor.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__startDateEditor"));
1040 startDateEditor.putClientProperty("selectOnFocus", true);
1041 }
1042
1043 protected void createStartDateLabel() {
1044 $objectMap.put("startDateLabel", startDateLabel = new JLabel());
1045
1046 startDateLabel.setName("startDateLabel");
1047 startDateLabel.setText(t("dali.property.date.start"));
1048 }
1049
1050 protected void createStateCombo() {
1051 $objectMap.put("stateCombo", stateCombo = new ExtendedComboBox<StateDTO>(this));
1052
1053 stateCombo.setName("stateCombo");
1054 stateCombo.setFilterable(true);
1055 stateCombo.setShowDecorator(false);
1056 stateCombo.setProperty("state");
1057 stateCombo.setShowReset(true);
1058 }
1059
1060 protected void createStateLabel() {
1061 $objectMap.put("stateLabel", stateLabel = new JLabel());
1062
1063 stateLabel.setName("stateLabel");
1064 stateLabel.setText(t("dali.property.status"));
1065 }
1066
1067 protected void createStatePanel() {
1068 $objectMap.put("statePanel", statePanel = new JPanel());
1069
1070 statePanel.setName("statePanel");
1071 statePanel.setLayout(new BorderLayout());
1072 }
1073
1074 protected void createSurveysMapUI() {
1075 $objectMap.put("surveysMapUI", surveysMapUI = new SurveysMapUI(this));
1076
1077 surveysMapUI.setName("surveysMapUI");
1078 }
1079
1080 protected void createSurveysTableUI() {
1081 $objectMap.put("surveysTableUI", surveysTableUI = new SurveysTableUI(this));
1082
1083 surveysTableUI.setName("surveysTableUI");
1084 surveysTableUI.putClientProperty("validatorLabel", t("dali.home.survey.title"));
1085 }
1086
1087 protected void createSynchronizationStatusCombo() {
1088 $objectMap.put("synchronizationStatusCombo", synchronizationStatusCombo = new ExtendedComboBox<SynchronizationStatusDTO>(this));
1089
1090 synchronizationStatusCombo.setName("synchronizationStatusCombo");
1091 synchronizationStatusCombo.setFilterable(true);
1092 synchronizationStatusCombo.setShowDecorator(false);
1093 synchronizationStatusCombo.setProperty("synchronizationStatus");
1094 synchronizationStatusCombo.setShowReset(true);
1095 }
1096
1097 protected void createSynchronizationStatusLabel() {
1098 $objectMap.put("synchronizationStatusLabel", synchronizationStatusLabel = new JLabel());
1099
1100 synchronizationStatusLabel.setName("synchronizationStatusLabel");
1101 synchronizationStatusLabel.setText(t("dali.property.synchronizationStatus"));
1102 }
1103
1104 protected void createSynchronizationStatusPanel() {
1105 $objectMap.put("synchronizationStatusPanel", synchronizationStatusPanel = new JPanel());
1106
1107 synchronizationStatusPanel.setName("synchronizationStatusPanel");
1108 synchronizationStatusPanel.setLayout(new BorderLayout());
1109 }
1110
1111 protected void createValidator() {
1112 $objectMap.put("validator", validator = SwingValidator.newValidator(HomeUIModel.class, null));
1113 }
1114
1115
1116
1117
1118
1119 private void $completeSetup() {
1120 allComponentsCreated = true;
1121 if (log.isDebugEnabled()) {
1122 log.debug(this);
1123 }
1124 addChildrenToHomeUI();
1125 addChildrenToValidator();
1126
1127 $JPanel0.add(homeMenu, BorderLayout.PAGE_START);
1128 $JPanel0.add(leftImage, BorderLayout.PAGE_END);
1129 addChildrenToHomeMenu();
1130 addChildrenToMenuContextPanel();
1131 addChildrenToMenuSelectionPanel();
1132 addChildrenToCampaignPanel();
1133 addChildrenToProgramPanel();
1134 addChildrenToLocationPanel();
1135
1136 $JPanel1.add(startDateLabel, BorderLayout.PAGE_START);
1137 $JPanel1.add(searchDateCombo, BorderLayout.LINE_START);
1138 $JPanel1.add(startDateEditor);
1139
1140 $JPanel2.add(andLabel);
1141 $JPanel2.add(endDateEditor, BorderLayout.LINE_END);
1142 addChildrenToMnemonicPanel();
1143 addChildrenToCommentPanel();
1144 addChildrenToStatePanel();
1145 addChildrenToSynchronizationStatusPanel();
1146 addChildrenToSelectionButtonsPanel();
1147 addChildrenToHomeMain();
1148
1149 $Table0.add(SwingUtil.boxComponentWithJxLayer(surveysTableUI), new GridBagConstraints(0, 0, 1, 1, 1.0, 0.8, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
1150 $Table0.add(bottomPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.2, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
1151 addChildrenToBottomPanel();
1152
1153 $JPanel3.add(closeButton);
1154 $JPanel3.add(saveButton);
1155
1156
1157 JAXXUtil.applyDataBinding(this, $bindings.keySet());
1158
1159
1160 contextCombobox.setBeanType(ContextDTO.class);
1161 campaignCombo.setBeanType(CampaignDTO.class);
1162 programCombo.setBeanType(ProgramDTO.class);
1163 locationCombo.setBeanType(LocationDTO.class);
1164 searchDateCombo.setBeanType(SearchDateDTO.class);
1165 andLabel.setHorizontalAlignment(JLabel.RIGHT);
1166 stateCombo.setBeanType(StateDTO.class);
1167 synchronizationStatusCombo.setBeanType(SynchronizationStatusDTO.class);
1168 clearButton.setAlignmentX(Component.CENTER_ALIGNMENT);
1169 searchButton.setAlignmentX(Component.CENTER_ALIGNMENT);
1170 closeButton.setAlignmentX(Component.CENTER_ALIGNMENT);
1171 saveButton.setAlignmentX(Component.CENTER_ALIGNMENT);
1172 menuContextPanel.setBorder(BorderFactory.createTitledBorder(t("dali.home.context.title")));
1173 contextCombobox.setBean(model);
1174 separatorPanel.setBorder(BorderFactory.createEmptyBorder(20,0,0,0));
1175 menuSelectionPanel.setBorder(BorderFactory.createTitledBorder(t("dali.common.selection")));
1176 campaignLabel.setLabelFor(campaignCombo);
1177 campaignCombo.setIcon(SwingUtil.createActionIcon("unfilter"));
1178 campaignCombo.setBean(model);
1179 programLabel.setLabelFor(programCombo);
1180 programCombo.setIcon(SwingUtil.createActionIcon("unfilter"));
1181 programCombo.setBean(model);
1182 locationLabel.setLabelFor(locationCombo);
1183 locationCombo.setIcon(SwingUtil.createActionIcon("unfilter"));
1184 locationCombo.setBean(model);
1185 searchDateCombo.setBean(model);
1186 andLabel.setBorder(BorderFactory.createEmptyBorder(0,0,0,5));
1187 mnemonicLabel.setLabelFor(mnemonicEditor);
1188 commentLabel.setLabelFor(commentEditor);
1189 stateLabel.setLabelFor(stateCombo);
1190 stateCombo.setBean(model);
1191 synchronizationStatusLabel.setLabelFor(synchronizationStatusCombo);
1192 synchronizationStatusCombo.setBean(model);
1193 clearButton.setIcon(SwingUtil.createActionIcon("reset"));
1194 searchButton.setIcon(SwingUtil.createActionIcon("find"));
1195 leftImage.setImage(handler.getResourceImage("saisie","jpg").getImage());
1196 closeButton.setIcon(SwingUtil.createActionIcon("cancel"));
1197 saveButton.setIcon(SwingUtil.createActionIcon("save"));
1198
1199
1200 validatorIds = SwingValidatorUtil.detectValidators(this);
1201 SwingValidatorUtil.installUI(this);
1202 }
1203
1204 private void $initialize() {
1205 if (allComponentsCreated) {
1206 return;
1207 }
1208 if (log.isDebugEnabled()) {
1209 log.debug(this);
1210 }
1211 handler.beforeInit(this);
1212 $objectMap.put("homeUI", homeUI);
1213 createModel();
1214 createBottomPanelLayout();
1215 createBroker();
1216 createValidator();
1217
1218 $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
1219
1220 $JPanel0.setName("$JPanel0");
1221 $JPanel0.setLayout(new BorderLayout());
1222 createHomeMenu();
1223 createMenuContextPanel();
1224 createContextCombobox();
1225 createSeparatorPanel();
1226 createMenuSelectionPanel();
1227 createCampaignPanel();
1228 createCampaignLabel();
1229 createCampaignCombo();
1230 createProgramPanel();
1231 createProgramLabel();
1232 createProgramCombo();
1233 createLocationPanel();
1234 createLocationLabel();
1235 createLocationCombo();
1236
1237 $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
1238
1239 $JPanel1.setName("$JPanel1");
1240 $JPanel1.setLayout(new BorderLayout());
1241 createStartDateLabel();
1242 createSearchDateCombo();
1243 createStartDateEditor();
1244
1245 $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
1246
1247 $JPanel2.setName("$JPanel2");
1248 $JPanel2.setLayout(new BorderLayout());
1249 createAndLabel();
1250 createEndDateEditor();
1251 createMnemonicPanel();
1252 createMnemonicLabel();
1253 createMnemonicEditor();
1254 createCommentPanel();
1255 createCommentLabel();
1256 createCommentEditor();
1257 createStatePanel();
1258 createStateLabel();
1259 createStateCombo();
1260 createSynchronizationStatusPanel();
1261 createSynchronizationStatusLabel();
1262 createSynchronizationStatusCombo();
1263 createSelectionButtonsPanel();
1264 createClearButton();
1265 createSearchButton();
1266 createLeftImage();
1267 createHomeMain();
1268
1269 $objectMap.put("$Table0", $Table0 = new Table());
1270
1271 $Table0.setName("$Table0");
1272 createSurveysTableUI();
1273 createBottomPanel();
1274 createOperationsTableUI();
1275 createSurveysMapUI();
1276
1277 $objectMap.put("$JPanel3", $JPanel3 = new JPanel());
1278
1279 $JPanel3.setName("$JPanel3");
1280 $JPanel3.setLayout(new GridLayout(1,0));
1281 createCloseButton();
1282 createSaveButton();
1283
1284 setName("homeUI");
1285 setLayout(new BorderLayout());
1286
1287
1288 $registerDefaultBindings();
1289 $completeSetup();
1290 handler.afterInit(this);
1291 }
1292
1293 private void $registerDefaultBindings() {
1294
1295 registerDataBinding(new DefaultJAXXBinding(this, BINDING_CONTEXT_COMBOBOX_SELECTED_ITEM, true) {
1296
1297 @Override
1298 public void applyDataBinding() {
1299 if (model != null) {
1300 model.addPropertyChangeListener("context", this);
1301 }
1302 }
1303
1304 @Override
1305 public void processDataBinding() {
1306 if (model != null) {
1307 contextCombobox.setSelectedItem(model.getContext());
1308 }
1309 }
1310
1311 @Override
1312 public void removeDataBinding() {
1313 if (model != null) {
1314 model.removePropertyChangeListener("context", this);
1315 }
1316 }
1317 });
1318 registerDataBinding(new DefaultJAXXBinding(this, BINDING_CAMPAIGN_COMBO_ACTION_ENABLED, true) {
1319
1320 @Override
1321 public void applyDataBinding() {
1322 if (model != null) {
1323 model.addPropertyChangeListener("campaignsFiltered", this);
1324 }
1325 }
1326
1327 @Override
1328 public void processDataBinding() {
1329 if (model != null) {
1330 campaignCombo.setActionEnabled(model.isCampaignsFiltered());
1331 }
1332 }
1333
1334 @Override
1335 public void removeDataBinding() {
1336 if (model != null) {
1337 model.removePropertyChangeListener("campaignsFiltered", this);
1338 }
1339 }
1340 });
1341 registerDataBinding(new DefaultJAXXBinding(this, BINDING_CAMPAIGN_COMBO_SELECTED_ITEM, true) {
1342
1343 @Override
1344 public void applyDataBinding() {
1345 if (model != null) {
1346 model.addPropertyChangeListener("campaign", this);
1347 }
1348 }
1349
1350 @Override
1351 public void processDataBinding() {
1352 if (model != null) {
1353 campaignCombo.setSelectedItem(model.getCampaign());
1354 }
1355 }
1356
1357 @Override
1358 public void removeDataBinding() {
1359 if (model != null) {
1360 model.removePropertyChangeListener("campaign", this);
1361 }
1362 }
1363 });
1364 registerDataBinding(new DefaultJAXXBinding(this, BINDING_PROGRAM_COMBO_ACTION_ENABLED, true) {
1365
1366 @Override
1367 public void applyDataBinding() {
1368 if (model != null) {
1369 model.addPropertyChangeListener("programsFiltered", this);
1370 }
1371 }
1372
1373 @Override
1374 public void processDataBinding() {
1375 if (model != null) {
1376 programCombo.setActionEnabled(model.isProgramsFiltered());
1377 }
1378 }
1379
1380 @Override
1381 public void removeDataBinding() {
1382 if (model != null) {
1383 model.removePropertyChangeListener("programsFiltered", this);
1384 }
1385 }
1386 });
1387 registerDataBinding(new DefaultJAXXBinding(this, BINDING_PROGRAM_COMBO_SELECTED_ITEM, true) {
1388
1389 @Override
1390 public void applyDataBinding() {
1391 if (model != null) {
1392 model.addPropertyChangeListener("program", this);
1393 }
1394 }
1395
1396 @Override
1397 public void processDataBinding() {
1398 if (model != null) {
1399 programCombo.setSelectedItem(model.getProgram());
1400 }
1401 }
1402
1403 @Override
1404 public void removeDataBinding() {
1405 if (model != null) {
1406 model.removePropertyChangeListener("program", this);
1407 }
1408 }
1409 });
1410 registerDataBinding(new DefaultJAXXBinding(this, BINDING_LOCATION_COMBO_ACTION_ENABLED, true) {
1411
1412 @Override
1413 public void applyDataBinding() {
1414 if (model != null) {
1415 model.addPropertyChangeListener("locationsFiltered", this);
1416 }
1417 }
1418
1419 @Override
1420 public void processDataBinding() {
1421 if (model != null) {
1422 locationCombo.setActionEnabled(model.isLocationsFiltered());
1423 }
1424 }
1425
1426 @Override
1427 public void removeDataBinding() {
1428 if (model != null) {
1429 model.removePropertyChangeListener("locationsFiltered", this);
1430 }
1431 }
1432 });
1433 registerDataBinding(new DefaultJAXXBinding(this, BINDING_LOCATION_COMBO_SELECTED_ITEM, true) {
1434
1435 @Override
1436 public void applyDataBinding() {
1437 if (model != null) {
1438 model.addPropertyChangeListener("location", this);
1439 }
1440 }
1441
1442 @Override
1443 public void processDataBinding() {
1444 if (model != null) {
1445 locationCombo.setSelectedItem(model.getLocation());
1446 }
1447 }
1448
1449 @Override
1450 public void removeDataBinding() {
1451 if (model != null) {
1452 model.removePropertyChangeListener("location", this);
1453 }
1454 }
1455 });
1456 registerDataBinding(new DefaultJAXXBinding(this, BINDING_SEARCH_DATE_COMBO_SELECTED_ITEM, true) {
1457
1458 @Override
1459 public void applyDataBinding() {
1460 if (model != null) {
1461 model.addPropertyChangeListener("searchDate", this);
1462 }
1463 }
1464
1465 @Override
1466 public void processDataBinding() {
1467 if (model != null) {
1468 searchDateCombo.setSelectedItem(model.getSearchDate());
1469 }
1470 }
1471
1472 @Override
1473 public void removeDataBinding() {
1474 if (model != null) {
1475 model.removePropertyChangeListener("searchDate", this);
1476 }
1477 }
1478 });
1479 registerDataBinding(new DefaultJAXXBinding(this, BINDING_START_DATE_EDITOR_LOCAL_DATE, true) {
1480
1481 @Override
1482 public void applyDataBinding() {
1483 if (model != null) {
1484 model.addPropertyChangeListener("startDate", this);
1485 }
1486 }
1487
1488 @Override
1489 public void processDataBinding() {
1490 if (model != null) {
1491 startDateEditor.setLocalDate(model.getStartDate());
1492 }
1493 }
1494
1495 @Override
1496 public void removeDataBinding() {
1497 if (model != null) {
1498 model.removePropertyChangeListener("startDate", this);
1499 }
1500 }
1501 });
1502 registerDataBinding(new DefaultJAXXBinding(this, BINDING_END_DATE_EDITOR_LOCAL_DATE, true) {
1503
1504 @Override
1505 public void applyDataBinding() {
1506 if (model != null) {
1507 model.addPropertyChangeListener("endDate", this);
1508 }
1509 }
1510
1511 @Override
1512 public void processDataBinding() {
1513 if (model != null) {
1514 endDateEditor.setLocalDate(model.getEndDate());
1515 }
1516 }
1517
1518 @Override
1519 public void removeDataBinding() {
1520 if (model != null) {
1521 model.removePropertyChangeListener("endDate", this);
1522 }
1523 }
1524 });
1525 registerDataBinding(new DefaultJAXXBinding(this, BINDING_MNEMONIC_EDITOR_TEXT, true) {
1526
1527 @Override
1528 public void applyDataBinding() {
1529 if (model != null) {
1530 model.addPropertyChangeListener("name", this);
1531 }
1532 }
1533
1534 @Override
1535 public void processDataBinding() {
1536 if (model != null) {
1537 SwingUtil.setText(mnemonicEditor, model.getName());
1538 }
1539 }
1540
1541 @Override
1542 public void removeDataBinding() {
1543 if (model != null) {
1544 model.removePropertyChangeListener("name", this);
1545 }
1546 }
1547 });
1548 registerDataBinding(new DefaultJAXXBinding(this, BINDING_COMMENT_EDITOR_TEXT, true) {
1549
1550 @Override
1551 public void applyDataBinding() {
1552 if (model != null) {
1553 model.addPropertyChangeListener("comment", this);
1554 }
1555 }
1556
1557 @Override
1558 public void processDataBinding() {
1559 if (model != null) {
1560 SwingUtil.setText(commentEditor, model.getComment());
1561 }
1562 }
1563
1564 @Override
1565 public void removeDataBinding() {
1566 if (model != null) {
1567 model.removePropertyChangeListener("comment", this);
1568 }
1569 }
1570 });
1571 registerDataBinding(new DefaultJAXXBinding(this, BINDING_STATE_COMBO_SELECTED_ITEM, true) {
1572
1573 @Override
1574 public void applyDataBinding() {
1575 if (model != null) {
1576 model.addPropertyChangeListener("state", this);
1577 }
1578 }
1579
1580 @Override
1581 public void processDataBinding() {
1582 if (model != null) {
1583 stateCombo.setSelectedItem(model.getState());
1584 }
1585 }
1586
1587 @Override
1588 public void removeDataBinding() {
1589 if (model != null) {
1590 model.removePropertyChangeListener("state", this);
1591 }
1592 }
1593 });
1594 registerDataBinding(new DefaultJAXXBinding(this, BINDING_SYNCHRONIZATION_STATUS_COMBO_SELECTED_ITEM, true) {
1595
1596 @Override
1597 public void applyDataBinding() {
1598 if (model != null) {
1599 model.addPropertyChangeListener("synchronizationStatus", this);
1600 }
1601 }
1602
1603 @Override
1604 public void processDataBinding() {
1605 if (model != null) {
1606 synchronizationStatusCombo.setSelectedItem(model.getSynchronizationStatus());
1607 }
1608 }
1609
1610 @Override
1611 public void removeDataBinding() {
1612 if (model != null) {
1613 model.removePropertyChangeListener("synchronizationStatus", this);
1614 }
1615 }
1616 });
1617 registerDataBinding(new DefaultJAXXBinding(this, BINDING_SAVE_BUTTON_ENABLED, true, true) {
1618
1619 @Override
1620 public void applyDataBinding() {
1621 if (model != null) {
1622 model.addPropertyChangeListener("valid", this);
1623 }
1624 if (model != null) {
1625 model.addPropertyChangeListener("modify", this);
1626 }
1627 }
1628
1629 @Override
1630 public void processDataBinding() {
1631 if (model != null) {
1632 saveButton.setEnabled(model.isValid() && model.isModify());
1633 }
1634 }
1635
1636 @Override
1637 public void removeDataBinding() {
1638 if (model != null) {
1639 model.removePropertyChangeListener("valid", this);
1640 }
1641 if (model != null) {
1642 model.removePropertyChangeListener("modify", this);
1643 }
1644 }
1645 });
1646 }
1647
1648 }