1 package fr.ifremer.tutti.ui.swing.content.operation;
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.persistence.entities.data.FishingOperation;
28 import fr.ifremer.tutti.ui.swing.TuttiHelpBroker;
29 import fr.ifremer.tutti.ui.swing.TuttiUIContext;
30 import fr.ifremer.tutti.ui.swing.content.operation.catches.EditCatchesUI;
31 import fr.ifremer.tutti.ui.swing.util.TuttiUI;
32 import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
33 import java.awt.BorderLayout;
34 import java.awt.Component;
35 import java.awt.Container;
36 import java.awt.Dimension;
37 import java.awt.GridBagConstraints;
38 import java.awt.GridLayout;
39 import java.awt.Insets;
40 import java.awt.LayoutManager;
41 import java.util.ArrayList;
42 import java.util.HashMap;
43 import java.util.List;
44 import java.util.Map;
45 import java.util.TreeMap;
46 import javax.swing.JButton;
47 import javax.swing.JLabel;
48 import javax.swing.JPanel;
49 import javax.swing.JTabbedPane;
50 import jaxx.runtime.JAXXBinding;
51 import jaxx.runtime.JAXXContext;
52 import jaxx.runtime.JAXXObject;
53 import jaxx.runtime.JAXXObjectDescriptor;
54 import jaxx.runtime.JAXXUtil;
55 import jaxx.runtime.SwingUtil;
56 import jaxx.runtime.binding.DefaultJAXXBinding;
57 import jaxx.runtime.context.DefaultJAXXContext;
58 import jaxx.runtime.swing.TabInfo;
59 import jaxx.runtime.swing.TabInfoPropertyChangeListener;
60 import jaxx.runtime.swing.Table;
61 import jaxx.runtime.swing.editor.bean.BeanFilterableComboBox;
62 import jaxx.runtime.swing.help.JAXXHelpUI;
63 import org.apache.commons.logging.Log;
64 import org.apache.commons.logging.LogFactory;
65 import static org.nuiton.i18n.I18n.t;
66
67 public class FishingOperationsUI extends JPanel implements JAXXHelpUI<TuttiHelpBroker>, TuttiUI<FishingOperationsUIModel, FishingOperationsUIHandler>, JAXXObject {
68
69
70
71
72
73 public static final String BINDING_CATCHES_TAB_ENABLED = "catchesTab.enabled";
74 public static final String BINDING_DELETE_FISHING_OPERATION_BUTTON_ENABLED = "deleteFishingOperationButton.enabled";
75 public static final String BINDING_FISHING_OPERATION_COMBO_BOX_SELECTED_ITEM = "fishingOperationComboBox.selectedItem";
76 public static final String BINDING_WARNING_CONTAINER_VISIBLE = "warningContainer.visible";
77 public static final String BINDING_WARNING_LABEL_TEXT = "warningLabel.text";
78
79
80
81
82
83 private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAKVXW08bRxQeDJhbrqASSIlqIIlAoktApaGlTcK1IQJSBdNERRWZ9Q72JOuZ7cw4mCCq/oT+hPa9L6n61qeqlfLch75U/QtV1Ye+Vj0zu97F9q5tAhJmmT3nO9f5zvH3f6FOKdDoM1wuW6LEFC0S68HikycP7Wckp1aIzAnqKS6Q/9OWQqld1OeE51Kh8d0NrT4dqE8v86LHGWEntBc2UK9Uhy6RBUKUQteqNXJSTm+HrxfKXklUUEOn4lC//efv1DfO19+lECp74N0lCCXTTCuKpGMDpaijUD9YeoGnXczy4IagLA/+ntdnyy6WcgsXyZfoK9S1gdIeFgCm0FjrIRsMo1/2FBrep7IAFh56RGBFOZNZ7n2KGXEVursvLLovSJEIS5WUolaJWvIApK0cZwrgLV5Rs9ZqcXbWPc/YSSvUWeSORlw5I+Kmholg07bgz4lQaDIZN6v/vQ9aS0Y2Uu5WYaBDVTUK9LDtmjT3hBpDtbmCNNt8iZcVmotBIA6FvFs2wcxago816ipQBNiKnsbtjxy6/sD4cws6QBe7HOD4p9Wyw4wc1OZnCSKFJKKBKmX/VKsNhdojkEWiSDyAlrlWLX/pAAsGkssAjykjQp9frfboXCCzgW2d0uoIzKEWzITyXQrbOjCFrlSJQt5t4ug31cm/Wpt8EFz2e0ahpdP01SrUpTb0nXVt5kZo7XIOq1yByJNGFk9jJNA3xpb951obfYxnBaaqEuv16oAHYgKGNMS36jrb51Fr90be65NZeCPQ21WaQHFWRHERB7Xtok5RgmNo9916VnwEr3w+HKrhQw1o3v43OPD7T3/+uFYhwX6w/Vas6AkOB3LyhM6eotr0RZ8BS4q605vYW9hFPRJaNucT/EiMY9vBa3AO7F3W6pZWt+5jWQCIzq4/fv5l8Olv7Si1hnpdjp01rOXXUY8qCMgCd52yd/ee8ejcQbdmb/hNKbBc4AePiNRzokOJEmSrQ99paOEjQ2vHZUjHSEw6Qp/sntf/Dmy/uldJSRu4OJwoHqWl83OUpsyFG2cmQ0D6sZOgz5Ok5PCI3OPoHgHhD8ZTUdA8H5rPO3V5aFPowh52nMeE5gtqh1FIxhU/fCtPVHQ8MQnp0BgrJk79tIY8DwyfdzUJPKaqoOWaWUsXDKRCqblbCYB9tuErw47N4Dr3CjACFMocjflXt27sWVpgLMb5RjPSa5I2zYt0Zp5tMlLkjOYUWkgyD92oeSOG161iqN2/hz3PpTlzvmg0FPri6DTEFFgO7Elrq96gD2zldOccA5v4ousaC7VDE0AtPUH2iRDE2aYv4UIMHoHfmRXoZCZBdOL23NTM7ORxlPeF5Lw3CNwvCVRace5mqZclZeiI998ASVEvtrKJY7SFysYW4+mZirESO5cb1SPtj/I3KMmdpiWJ3xLCqnQRphkE2uHdiAl8EiNOrdbEZGb04wwruW5dPT94MzcSStpwt2lW1Xa4rzKIYF2RokI3WgkNQuoOxtchzE2ZIBjl/nZy7vcpcZ268wbslLiVNgsWZlvXCyop1BBuwtGoHyiVZl1Z9WtrYuu1ce55XvASg1qPmb4y8xUfKPhC43IxMfve3FRmdmZ+KjM/HzcAYlbIFkqRtrlw9Ho/G9qsrIn+G2u16KnDJfM8AR7M3JrKmD+TtdekKzCvR7hpuvGorp9hlzomc6tCcLFJpMR5EjvIatbcZjG0nbwkn5zmkmRu3swk1CPOqxMLXwtVHyhwQV/qQriLLs2zollvLx75a7q1vLqVXX10HKYq8X5SWDotxuubtXIB4lw9ufW2kL+0iw852EcXPoIa4YxNmQO27tRBt+nP3hYQu/Xylj30zOb0QzzOYFMcffyqAcLwmRFGW4ilg+b8L2wJGCMtefFrA4R3zowwDgj/A0J1qO7XEQAA";
84 private static final Log log = LogFactory.getLog(FishingOperationsUI.class);
85 private static final long serialVersionUID = 1L;
86
87
88
89
90
91 protected List<Object> $activeBindings = new ArrayList<Object>();
92 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
93 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
94 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
95 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
96 private boolean allComponentsCreated;
97 protected final JAXXContext delegateContext = new DefaultJAXXContext();
98
99
100
101
102
103 protected TuttiHelpBroker broker;
104 protected TabInfo catchesTab;
105 protected EditCatchesUI catchesTabContent;
106 protected JButton deleteFishingOperationButton;
107 protected BeanFilterableComboBox<FishingOperation> fishingOperationComboBox;
108 protected TabInfo fishingOperationTab;
109 protected EditFishingOperationUI fishingOperationTabContent;
110 protected FishingOperationsUI fishingOperationsTopPanel = this;
111 protected final FishingOperationsUIHandler handler = createHandler();
112 protected FishingOperationsUIModel model;
113 protected JButton newFishingOperationButton;
114 protected JLabel noTraitPane;
115 protected JTabbedPane tabPane;
116 protected Table topPanel;
117 protected JPanel warningContainer;
118 protected JLabel warningLabel;
119
120
121
122
123
124 private JPanel $JPanel0;
125
126
127
128
129
130 public FishingOperationsUI(TuttiUI parentUI) {
131 TuttiUIUtil.setParentUI(this, parentUI);
132 $initialize();
133 }
134
135 public FishingOperationsUI(LayoutManager param0, boolean param1) {
136 super(param0 ,param1);
137 $initialize();
138 }
139
140 public FishingOperationsUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
141 super(param1 ,param2);
142 JAXXUtil.initContext(this, parentContext);
143 $initialize();
144 }
145
146 public FishingOperationsUI(LayoutManager param0) {
147 super(param0);
148 $initialize();
149 }
150
151 public FishingOperationsUI(JAXXContext parentContext, LayoutManager param1) {
152 super(param1);
153 JAXXUtil.initContext(this, parentContext);
154 $initialize();
155 }
156
157 public FishingOperationsUI() {
158 $initialize();
159 }
160
161 public FishingOperationsUI(JAXXContext parentContext) {
162 JAXXUtil.initContext(this, parentContext);
163 $initialize();
164 }
165
166 public FishingOperationsUI(boolean param0) {
167 super(param0);
168 $initialize();
169 }
170
171 public FishingOperationsUI(JAXXContext parentContext, boolean param1) {
172 super(param1);
173 JAXXUtil.initContext(this, parentContext);
174 $initialize();
175 }
176
177
178
179
180
181 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
182 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
183 }
184
185
186
187
188
189 @Override
190 public void applyDataBinding(String $binding) {
191 if (allComponentsCreated && $bindings.containsKey($binding)) {
192 getDataBinding($binding).applyDataBinding();
193 }
194 processDataBinding($binding);
195 }
196
197 @Override
198 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
199 super.firePropertyChange(propertyName, oldValue, newValue);
200 }
201
202 @Override
203 public Map<String, Object> get$objectMap() {
204 return $objectMap;
205 }
206
207 @Override
208 public JAXXBinding getDataBinding(String bindingId) {
209 return $bindings.get(bindingId);
210 }
211
212 @Override
213 public JAXXBinding[] getDataBindings() {
214 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
215 }
216
217 @Override
218 public Object getObjectById(String id) {
219 return $objectMap.get(id);
220 }
221
222 @Override
223 public void processDataBinding(String $binding, boolean $force) {
224 if (!$force && $activeBindings.contains($binding)) {
225 return;
226 }
227 $activeBindings.add($binding);
228 try {
229 if (allComponentsCreated && $bindings.containsKey($binding)) {
230 getDataBinding($binding).processDataBinding();
231 }
232 } finally {
233 $activeBindings.remove($binding);
234 }
235 }
236
237 @Override
238 public void processDataBinding(String $binding) {
239 processDataBinding($binding, false);
240 }
241
242 @Override
243 public void registerDataBinding(JAXXBinding binding) {
244 $bindings.put(binding.getId(), binding);
245 }
246
247 @Override
248 public void removeDataBinding(String $binding) {
249 if (allComponentsCreated && $bindings.containsKey($binding)) {
250 getDataBinding($binding).removeDataBinding();
251 }
252 }
253
254
255
256
257
258 @Override
259 public <T> T getContextValue(Class<T> clazz) {
260 return delegateContext.getContextValue(clazz, null);
261 }
262
263 @Override
264 public <T> T getContextValue(Class<T> clazz, String name) {
265 return delegateContext.getContextValue(clazz, name);
266 }
267
268 @Override
269 public JAXXContext getDelegateContext() {
270 return delegateContext;
271 }
272
273 @Override
274 public <O extends Container> O getParentContainer(Class<O> clazz) {
275 return SwingUtil.getParentContainer(this, clazz);
276 }
277
278 @Override
279 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
280 return SwingUtil.getParentContainer(source, clazz);
281 }
282
283 @Override
284 public <T> void removeContextValue(Class<T> clazz) {
285 delegateContext.removeContextValue(clazz, null);
286 }
287
288 @Override
289 public <T> void removeContextValue(Class<T> clazz, String name) {
290 delegateContext.removeContextValue(clazz, name);
291 }
292
293 @Override
294 public <T> void setContextValue(T o) {
295 delegateContext.setContextValue(o, null);
296 }
297
298 @Override
299 public <T> void setContextValue(T o, String name) {
300 delegateContext.setContextValue(o, name);
301 }
302
303
304
305
306
307 public TuttiHelpBroker getBroker() {
308 return broker;
309 }
310
311 public TabInfo getCatchesTab() {
312 return catchesTab;
313 }
314
315 public EditCatchesUI getCatchesTabContent() {
316 return catchesTabContent;
317 }
318
319 public JButton getDeleteFishingOperationButton() {
320 return deleteFishingOperationButton;
321 }
322
323 public BeanFilterableComboBox<FishingOperation> getFishingOperationComboBox() {
324 return fishingOperationComboBox;
325 }
326
327 public TabInfo getFishingOperationTab() {
328 return fishingOperationTab;
329 }
330
331 public EditFishingOperationUI getFishingOperationTabContent() {
332 return fishingOperationTabContent;
333 }
334
335 public FishingOperationsUIHandler getHandler() {
336 return handler;
337 }
338
339 public FishingOperationsUIModel getModel() {
340 return model;
341 }
342
343 public JButton getNewFishingOperationButton() {
344 return newFishingOperationButton;
345 }
346
347 public JLabel getNoTraitPane() {
348 return noTraitPane;
349 }
350
351 public JTabbedPane getTabPane() {
352 return tabPane;
353 }
354
355 public Table getTopPanel() {
356 return topPanel;
357 }
358
359 public JPanel getWarningContainer() {
360 return warningContainer;
361 }
362
363 public JLabel getWarningLabel() {
364 return warningLabel;
365 }
366
367
368
369
370
371 @Override
372 public void registerHelpId(TuttiHelpBroker broker, Component component, String helpId) {
373 broker.installUI(component, helpId);
374 }
375
376 @Override
377 public void showHelp(String helpId) {
378 getBroker().showHelp(this, helpId);
379 }
380
381
382
383
384
385 protected JPanel get$JPanel0() {
386 return $JPanel0;
387 }
388
389
390
391
392
393 protected void addChildrenToFishingOperationsTopPanel() {
394 if (!allComponentsCreated) {
395 return;
396 }
397 add(topPanel, BorderLayout.NORTH);
398 add(tabPane);
399 add(noTraitPane, BorderLayout.CENTER);
400 }
401
402 protected void addChildrenToTabPane() {
403 if (!allComponentsCreated) {
404 return;
405 }
406 tabPane.add(fishingOperationTabContent);
407 tabPane.add(catchesTabContent);
408 fishingOperationTab.addPropertyChangeListener(new TabInfoPropertyChangeListener(tabPane, 0));
409 tabPane.setTitleAt(0, t("tutti.label.tab.fishingOperation"));
410 catchesTab.addPropertyChangeListener(new TabInfoPropertyChangeListener(tabPane, 1));
411 tabPane.setTitleAt(1, t("tutti.label.tab.catches"));
412 }
413
414 protected void addChildrenToTopPanel() {
415 if (!allComponentsCreated) {
416 return;
417 }
418 topPanel.add(fishingOperationComboBox, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, 17, 1, new Insets(3, 3, 3, 3), 0, 0));
419 topPanel.add($JPanel0, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, 13, 1, new Insets(3, 3, 3, 3), 0, 0));
420 topPanel.add(warningContainer, new GridBagConstraints(0, 1, 2, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
421 }
422
423 protected void addChildrenToWarningContainer() {
424 if (!allComponentsCreated) {
425 return;
426 }
427 warningContainer.add(warningLabel, BorderLayout.CENTER);
428 }
429
430 protected void createBroker() {
431 $objectMap.put("broker", broker = new TuttiHelpBroker("tutti.fishingOperations.help"));
432 }
433
434 protected void createCatchesTab() {
435 $objectMap.put("catchesTab", catchesTab = new TabInfo());
436
437 catchesTab.setTitle(t("tutti.label.tab.catches"));
438 }
439
440 protected void createCatchesTabContent() {
441 $objectMap.put("catchesTabContent", catchesTabContent = new EditCatchesUI(this));
442
443 catchesTabContent.setName("catchesTabContent");
444 }
445
446 protected void createDeleteFishingOperationButton() {
447 $objectMap.put("deleteFishingOperationButton", deleteFishingOperationButton = new JButton());
448
449 deleteFishingOperationButton.setName("deleteFishingOperationButton");
450 deleteFishingOperationButton.setToolTipText(t("tutti.fishingOperations.action.deleteFishingOperation.tip"));
451 deleteFishingOperationButton.putClientProperty("help", "tutti.fishingOperations.action.deleteFishingOperation.help");
452 deleteFishingOperationButton.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.fishing.actions.DeleteFishingOperationAction.class);
453 }
454
455 protected void createFishingOperationComboBox() {
456 $objectMap.put("fishingOperationComboBox", fishingOperationComboBox = new BeanFilterableComboBox<FishingOperation>(this));
457
458 fishingOperationComboBox.setName("fishingOperationComboBox");
459 fishingOperationComboBox.setProperty("selectedFishingOperation");
460 fishingOperationComboBox.setShowReset(true);
461 fishingOperationComboBox.putClientProperty("help", "tutti.fishingOperations.field.fishingOperation.help");
462 }
463
464 protected void createFishingOperationTab() {
465 $objectMap.put("fishingOperationTab", fishingOperationTab = new TabInfo());
466
467 fishingOperationTab.setTitle(t("tutti.label.tab.fishingOperation"));
468 }
469
470 protected void createFishingOperationTabContent() {
471 $objectMap.put("fishingOperationTabContent", fishingOperationTabContent = new EditFishingOperationUI(this));
472
473 fishingOperationTabContent.setName("fishingOperationTabContent");
474 }
475
476 protected FishingOperationsUIHandler createHandler() {
477 return new FishingOperationsUIHandler();
478 }
479
480 protected void createModel() {
481 $objectMap.put("model", model = getContextValue(FishingOperationsUIModel.class));
482 }
483
484 protected void createNewFishingOperationButton() {
485 $objectMap.put("newFishingOperationButton", newFishingOperationButton = new JButton());
486
487 newFishingOperationButton.setName("newFishingOperationButton");
488 newFishingOperationButton.setToolTipText(t("tutti.fishingOperations.action.newFishingOperation.tip"));
489 newFishingOperationButton.putClientProperty("help", "tutti.fishingOperations.action.newFishingOperation.help");
490 newFishingOperationButton.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.fishing.actions.NewFishingOperationAction.class);
491 }
492
493 protected void createNoTraitPane() {
494 $objectMap.put("noTraitPane", noTraitPane = new JLabel());
495
496 noTraitPane.setName("noTraitPane");
497 noTraitPane.setText(t("tutti.fishingOperations.info.no.fishingOperation.selected"));
498 }
499
500 protected void createTabPane() {
501 $objectMap.put("tabPane", tabPane = new JTabbedPane());
502
503 tabPane.setName("tabPane");
504 }
505
506 protected void createTopPanel() {
507 $objectMap.put("topPanel", topPanel = new Table());
508
509 topPanel.setName("topPanel");
510 }
511
512 protected void createWarningContainer() {
513 $objectMap.put("warningContainer", warningContainer = new JPanel());
514
515 warningContainer.setName("warningContainer");
516 warningContainer.setLayout(new BorderLayout(10, 10));
517 }
518
519 protected void createWarningLabel() {
520 $objectMap.put("warningLabel", warningLabel = new JLabel());
521
522 warningLabel.setName("warningLabel");
523 }
524
525
526
527
528
529 private void $completeSetup() {
530 allComponentsCreated = true;
531 if (log.isDebugEnabled()) {
532 log.debug(this);
533 }
534 addChildrenToFishingOperationsTopPanel();
535 addChildrenToTopPanel();
536
537 $JPanel0.add(newFishingOperationButton);
538 $JPanel0.add(deleteFishingOperationButton);
539 addChildrenToWarningContainer();
540 addChildrenToTabPane();
541
542
543 JAXXUtil.applyDataBinding(this, $bindings.keySet());
544
545
546 fishingOperationComboBox.setBeanType(FishingOperation.class);
547 fishingOperationComboBox.setBean(model);
548 newFishingOperationButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.fishingOperations.action.newFishingOperation.mnemonic"),'Z'));
549 newFishingOperationButton.setIcon(SwingUtil.createActionIcon("add"));
550 newFishingOperationButton.setPreferredSize(new Dimension(75,12));
551 deleteFishingOperationButton.setIcon(SwingUtil.createActionIcon("delete"));
552 deleteFishingOperationButton.setPreferredSize(new Dimension(75,12));
553 warningContainer.setBackground(new java.awt.Color(245, 218, 88));
554 warningLabel.setBorder(new javax.swing.border.EmptyBorder(5, 10, 5, 10));
555 warningLabel.setIcon(SwingUtil.createActionIcon("warning"));
556 noTraitPane.setHorizontalAlignment(JLabel.CENTER);
557
558
559 TuttiHelpBroker _broker = getBroker();
560 registerHelpId(_broker, fishingOperationsTopPanel, "tutti.fishingOperations.help");
561 registerHelpId(_broker, fishingOperationComboBox, "tutti.fishingOperations.field.fishingOperation.help");
562 registerHelpId(_broker, newFishingOperationButton, "tutti.fishingOperations.action.newFishingOperation.help");
563 registerHelpId(_broker, deleteFishingOperationButton, "tutti.fishingOperations.action.deleteFishingOperation.help");
564 _broker.prepareUI(this);
565 }
566
567 private void $initialize() {
568 if (allComponentsCreated) {
569 return;
570 }
571 if (log.isDebugEnabled()) {
572 log.debug(this);
573 }
574 handler.beforeInit(this);
575 $objectMap.put("fishingOperationsTopPanel", fishingOperationsTopPanel);
576 createModel();
577 createBroker();
578 createTopPanel();
579 createFishingOperationComboBox();
580
581 $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
582
583 $JPanel0.setName("$JPanel0");
584 $JPanel0.setLayout(new GridLayout());
585 createNewFishingOperationButton();
586 createDeleteFishingOperationButton();
587 createWarningContainer();
588 createWarningLabel();
589 createTabPane();
590 createFishingOperationTabContent();
591 createCatchesTabContent();
592 createNoTraitPane();
593 createFishingOperationTab();
594 createCatchesTab();
595
596 setName("fishingOperationsTopPanel");
597 setLayout(new BorderLayout());
598 fishingOperationsTopPanel.putClientProperty("help", "tutti.fishingOperations.help");
599
600
601 $registerDefaultBindings();
602 $completeSetup();
603 handler.afterInit(this);
604 }
605
606 private void $registerDefaultBindings() {
607
608 registerDataBinding(new DefaultJAXXBinding(this, BINDING_FISHING_OPERATION_COMBO_BOX_SELECTED_ITEM, true) {
609
610 @Override
611 public void applyDataBinding() {
612 if (model != null) {
613 model.addPropertyChangeListener("selectedFishingOperation", this);
614 }
615 }
616
617 @Override
618 public void processDataBinding() {
619 if (model != null) {
620 fishingOperationComboBox.setSelectedItem(model.getSelectedFishingOperation());
621 }
622 }
623
624 @Override
625 public void removeDataBinding() {
626 if (model != null) {
627 model.removePropertyChangeListener("selectedFishingOperation", this);
628 }
629 }
630 });
631 registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_FISHING_OPERATION_BUTTON_ENABLED, true) {
632
633 @Override
634 public void applyDataBinding() {
635 if (model != null) {
636 model.addPropertyChangeListener("selectedFishingOperation", this);
637 }
638 }
639
640 @Override
641 public void processDataBinding() {
642 if (model != null) {
643 deleteFishingOperationButton.setEnabled(model.getSelectedFishingOperation() != null);
644 }
645 }
646
647 @Override
648 public void removeDataBinding() {
649 if (model != null) {
650 model.removePropertyChangeListener("selectedFishingOperation", this);
651 }
652 }
653 });
654 registerDataBinding(new DefaultJAXXBinding(this, BINDING_WARNING_CONTAINER_VISIBLE, true) {
655
656 @Override
657 public void applyDataBinding() {
658 if (model != null) {
659 model.addPropertyChangeListener("catchEnabled", this);
660 }
661 }
662
663 @Override
664 public void processDataBinding() {
665 if (model != null) {
666 warningContainer.setVisible(!model.isCatchEnabled());
667 }
668 }
669
670 @Override
671 public void removeDataBinding() {
672 if (model != null) {
673 model.removePropertyChangeListener("catchEnabled", this);
674 }
675 }
676 });
677 registerDataBinding(new DefaultJAXXBinding(this, BINDING_WARNING_LABEL_TEXT, true) {
678
679 @Override
680 public void applyDataBinding() {
681 if (model != null) {
682 model.addPropertyChangeListener("validationErrorMessage", this);
683 }
684 }
685
686 @Override
687 public void processDataBinding() {
688 if (model != null) {
689 warningLabel.setText(t(model.getValidationErrorMessage()));
690 }
691 }
692
693 @Override
694 public void removeDataBinding() {
695 if (model != null) {
696 model.removePropertyChangeListener("validationErrorMessage", this);
697 }
698 }
699 });
700 registerDataBinding(new DefaultJAXXBinding(this, BINDING_CATCHES_TAB_ENABLED, true, true) {
701
702 @Override
703 public void applyDataBinding() {
704 if (model != null) {
705 model.addPropertyChangeListener("selectedFishingOperation", this);
706 }
707 if (model != null) {
708 model.addPropertyChangeListener("catchEnabled", this);
709 }
710 }
711
712 @Override
713 public void processDataBinding() {
714 if (model != null) {
715 catchesTab.setEnabled(model.getSelectedFishingOperation() != null && model.isCatchEnabled());
716 }
717 }
718
719 @Override
720 public void removeDataBinding() {
721 if (model != null) {
722 model.removePropertyChangeListener("selectedFishingOperation", this);
723 }
724 if (model != null) {
725 model.removePropertyChangeListener("catchEnabled", this);
726 }
727 }
728 });
729 }
730
731 }