1 package fr.ifremer.tutti.ui.swing.content.operation.catches.accidental;
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.content.operation.catches.EditCatchesUIModel;
29 import fr.ifremer.tutti.ui.swing.util.TuttiUI;
30 import fr.ifremer.tutti.ui.swing.util.TuttiUIUtil;
31 import fr.ifremer.tutti.ui.swing.util.attachment.ButtonAttachment;
32 import java.awt.BorderLayout;
33 import java.awt.Color;
34 import java.awt.Component;
35 import java.awt.Container;
36 import java.awt.GridLayout;
37 import java.awt.LayoutManager;
38 import java.awt.event.KeyEvent;
39 import java.awt.event.KeyListener;
40 import java.awt.event.MouseEvent;
41 import java.awt.event.MouseListener;
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.JButton;
48 import javax.swing.JMenu;
49 import javax.swing.JMenuBar;
50 import javax.swing.JMenuItem;
51 import javax.swing.JPanel;
52 import javax.swing.JPopupMenu;
53 import javax.swing.JScrollPane;
54 import javax.swing.JToolBar;
55 import javax.swing.ListSelectionModel;
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.context.DefaultJAXXContext;
65 import jaxx.runtime.swing.help.JAXXHelpUI;
66 import jaxx.runtime.validator.swing.SwingValidator;
67 import jaxx.runtime.validator.swing.SwingValidatorUtil;
68 import jaxx.runtime.validator.swing.meta.Validator;
69 import jaxx.runtime.validator.swing.meta.ValidatorField;
70 import jaxx.runtime.validator.swing.ui.ImageValidationUI;
71 import org.apache.commons.logging.Log;
72 import org.apache.commons.logging.LogFactory;
73 import org.jdesktop.swingx.JXTable;
74 import static org.nuiton.i18n.I18n.t;
75
76 public class AccidentalBatchUI extends JPanel implements JAXXHelpUI<TuttiHelpBroker>, TuttiUI<AccidentalBatchUIModel, AccidentalBatchUIHandler>, JAXXObject, JAXXValidator {
77
78
79
80
81
82 public static final String BINDING_REMOVE_ACCIDENTAL_BATCH_MENU_ENABLED = "removeAccidentalBatchMenu.enabled";
83
84
85
86
87
88 private static final String $jaxxObjectDescriptor = "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";
89 private static final Log log = LogFactory.getLog(AccidentalBatchUI.class);
90 private static final long serialVersionUID = 1L;
91
92
93
94
95
96 protected List<Object> $activeBindings = new ArrayList<Object>();
97 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
98 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
99 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
100 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
101 private boolean allComponentsCreated;
102 protected final JAXXContext delegateContext = new DefaultJAXXContext();
103
104
105
106
107
108 protected ButtonAttachment accidentalBatchAttachmentsButton;
109 protected JToolBar accidentalBatchTabToolBar;
110 protected TuttiHelpBroker broker;
111 protected JButton createAccidentalBatchButton;
112 protected AccidentalBatchUI editAccidentalBatchTopPanel = this;
113 protected JMenuItem exportMultiPostButton;
114 protected final AccidentalBatchUIHandler handler = createHandler();
115 protected JMenuItem importMultiPostButton;
116 protected JMenuBar menu;
117 protected JMenu menuAction;
118 protected AccidentalBatchUIModel model;
119 protected JMenuItem removeAccidentalBatchMenu;
120 protected JXTable table;
121 protected JPopupMenu tablePopup;
122 protected JScrollPane tableScrollPane;
123 protected JPanel tableToolbar;
124 @Validator( validatorId = "validator")
125 protected SwingValidator<AccidentalBatchUIModel> validator;
126 protected List<String> validatorIds = new ArrayList<String>();
127
128
129
130
131
132 private JPanel $JPanel0;
133
134
135
136
137
138 public AccidentalBatchUI(TuttiUI parentUI) {
139 TuttiUIUtil.setParentUI(this, parentUI);
140 $initialize();
141 }
142
143 public AccidentalBatchUI(LayoutManager param0, boolean param1) {
144 super(param0 ,param1);
145 $initialize();
146 }
147
148 public AccidentalBatchUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
149 super(param1 ,param2);
150 JAXXUtil.initContext(this, parentContext);
151 $initialize();
152 }
153
154 public AccidentalBatchUI(LayoutManager param0) {
155 super(param0);
156 $initialize();
157 }
158
159 public AccidentalBatchUI(JAXXContext parentContext, LayoutManager param1) {
160 super(param1);
161 JAXXUtil.initContext(this, parentContext);
162 $initialize();
163 }
164
165 public AccidentalBatchUI() {
166 $initialize();
167 }
168
169 public AccidentalBatchUI(JAXXContext parentContext) {
170 JAXXUtil.initContext(this, parentContext);
171 $initialize();
172 }
173
174 public AccidentalBatchUI(boolean param0) {
175 super(param0);
176 $initialize();
177 }
178
179 public AccidentalBatchUI(JAXXContext parentContext, boolean param1) {
180 super(param1);
181 JAXXUtil.initContext(this, parentContext);
182 $initialize();
183 }
184
185
186
187
188
189 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
190 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
191 }
192
193
194
195
196
197 @Override
198 public void applyDataBinding(String $binding) {
199 if (allComponentsCreated && $bindings.containsKey($binding)) {
200 getDataBinding($binding).applyDataBinding();
201 }
202 processDataBinding($binding);
203 }
204
205 @Override
206 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
207 super.firePropertyChange(propertyName, oldValue, newValue);
208 }
209
210 @Override
211 public Map<String, Object> get$objectMap() {
212 return $objectMap;
213 }
214
215 @Override
216 public JAXXBinding getDataBinding(String bindingId) {
217 return $bindings.get(bindingId);
218 }
219
220 @Override
221 public JAXXBinding[] getDataBindings() {
222 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
223 }
224
225 @Override
226 public Object getObjectById(String id) {
227 return $objectMap.get(id);
228 }
229
230 @Override
231 public void processDataBinding(String $binding, boolean $force) {
232 if (!$force && $activeBindings.contains($binding)) {
233 return;
234 }
235 $activeBindings.add($binding);
236 try {
237 if (allComponentsCreated && $bindings.containsKey($binding)) {
238 getDataBinding($binding).processDataBinding();
239 }
240 } finally {
241 $activeBindings.remove($binding);
242 }
243 }
244
245 @Override
246 public void processDataBinding(String $binding) {
247 processDataBinding($binding, false);
248 }
249
250 @Override
251 public void registerDataBinding(JAXXBinding binding) {
252 $bindings.put(binding.getId(), binding);
253 }
254
255 @Override
256 public void removeDataBinding(String $binding) {
257 if (allComponentsCreated && $bindings.containsKey($binding)) {
258 getDataBinding($binding).removeDataBinding();
259 }
260 }
261
262
263
264
265
266 @Override
267 public <T> T getContextValue(Class<T> clazz) {
268 return delegateContext.getContextValue(clazz, null);
269 }
270
271 @Override
272 public <T> T getContextValue(Class<T> clazz, String name) {
273 return delegateContext.getContextValue(clazz, name);
274 }
275
276 @Override
277 public JAXXContext getDelegateContext() {
278 return delegateContext;
279 }
280
281 @Override
282 public <O extends Container> O getParentContainer(Class<O> clazz) {
283 return SwingUtil.getParentContainer(this, clazz);
284 }
285
286 @Override
287 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
288 return SwingUtil.getParentContainer(source, clazz);
289 }
290
291 @Override
292 public <T> void removeContextValue(Class<T> clazz) {
293 delegateContext.removeContextValue(clazz, null);
294 }
295
296 @Override
297 public <T> void removeContextValue(Class<T> clazz, String name) {
298 delegateContext.removeContextValue(clazz, name);
299 }
300
301 @Override
302 public <T> void setContextValue(T o) {
303 delegateContext.setContextValue(o, null);
304 }
305
306 @Override
307 public <T> void setContextValue(T o, String name) {
308 delegateContext.setContextValue(o, name);
309 }
310
311
312
313
314
315 @Override
316 public SwingValidator<?> getValidator(String validatorId) {
317 return (SwingValidator<?>) (validatorIds.contains(validatorId) ? getObjectById(validatorId) : null);
318 }
319
320 @Override
321 public List<String> getValidatorIds() {
322 return validatorIds;
323 }
324
325 @Override
326 public void registerValidatorFields() {
327 SwingValidatorUtil.detectValidatorFields(this);
328 }
329
330
331
332
333
334 public void doKeyPressed__on__table(KeyEvent event) {
335 if (log.isDebugEnabled()) {
336 log.debug(event);
337 }
338 handler.openRowMenu(event, tablePopup);
339 }
340
341 public void doMouseClicked__on__table(MouseEvent event) {
342 if (log.isDebugEnabled()) {
343 log.debug(event);
344 }
345 handler.autoSelectRowInTable(event, tablePopup);
346 }
347
348
349
350
351
352 public ButtonAttachment getAccidentalBatchAttachmentsButton() {
353 return accidentalBatchAttachmentsButton;
354 }
355
356 public JToolBar getAccidentalBatchTabToolBar() {
357 return accidentalBatchTabToolBar;
358 }
359
360 public TuttiHelpBroker getBroker() {
361 return broker;
362 }
363
364 public JButton getCreateAccidentalBatchButton() {
365 return createAccidentalBatchButton;
366 }
367
368 public JMenuItem getExportMultiPostButton() {
369 return exportMultiPostButton;
370 }
371
372 public AccidentalBatchUIHandler getHandler() {
373 return handler;
374 }
375
376 public JMenuItem getImportMultiPostButton() {
377 return importMultiPostButton;
378 }
379
380 public JMenuBar getMenu() {
381 return menu;
382 }
383
384 public JMenu getMenuAction() {
385 return menuAction;
386 }
387
388 public AccidentalBatchUIModel getModel() {
389 return model;
390 }
391
392 public JMenuItem getRemoveAccidentalBatchMenu() {
393 return removeAccidentalBatchMenu;
394 }
395
396 public JXTable getTable() {
397 return table;
398 }
399
400 public JPopupMenu getTablePopup() {
401 return tablePopup;
402 }
403
404 public JScrollPane getTableScrollPane() {
405 return tableScrollPane;
406 }
407
408 public JPanel getTableToolbar() {
409 return tableToolbar;
410 }
411
412 public SwingValidator<AccidentalBatchUIModel> getValidator() {
413 return validator;
414 }
415
416
417
418
419
420 @Override
421 public void registerHelpId(TuttiHelpBroker broker, Component component, String helpId) {
422 broker.installUI(component, helpId);
423 }
424
425 @Override
426 public void showHelp(String helpId) {
427 getBroker().showHelp(this, helpId);
428 }
429
430
431
432
433
434 protected JPanel get$JPanel0() {
435 return $JPanel0;
436 }
437
438
439
440
441
442 protected void addChildrenToAccidentalBatchTabToolBar() {
443 if (!allComponentsCreated) {
444 return;
445 }
446 accidentalBatchTabToolBar.add(menu);
447 accidentalBatchTabToolBar.add(accidentalBatchAttachmentsButton);
448 }
449
450 protected void addChildrenToEditAccidentalBatchTopPanel() {
451 if (!allComponentsCreated) {
452 return;
453 }
454 add(accidentalBatchTabToolBar);
455 add(tableToolbar, BorderLayout.NORTH);
456 add(tableScrollPane, BorderLayout.CENTER);
457 }
458
459 protected void addChildrenToMenu() {
460 if (!allComponentsCreated) {
461 return;
462 }
463 menu.add(menuAction);
464 }
465
466 protected void addChildrenToMenuAction() {
467 if (!allComponentsCreated) {
468 return;
469 }
470 menuAction.add(importMultiPostButton);
471 menuAction.add(exportMultiPostButton);
472 }
473
474 protected void addChildrenToTablePopup() {
475 if (!allComponentsCreated) {
476 return;
477 }
478 tablePopup.add(removeAccidentalBatchMenu);
479 }
480
481 protected void addChildrenToTableScrollPane() {
482 if (!allComponentsCreated) {
483 return;
484 }
485 tableScrollPane.getViewport().add(table);
486 }
487
488 protected void addChildrenToTableToolbar() {
489 if (!allComponentsCreated) {
490 return;
491 }
492 tableToolbar.add($JPanel0, BorderLayout.WEST);
493 }
494
495 protected void addChildrenToValidator() {
496 if (!allComponentsCreated) {
497 return;
498 }
499 validator.setUiClass(ImageValidationUI.class);
500 validator.setBean(model);
501 }
502
503 protected void createAccidentalBatchAttachmentsButton() {
504 $objectMap.put("accidentalBatchAttachmentsButton", accidentalBatchAttachmentsButton = new ButtonAttachment(handler.getContext(), getContextValue(EditCatchesUIModel.class)));
505
506 accidentalBatchAttachmentsButton.setName("accidentalBatchAttachmentsButton");
507 accidentalBatchAttachmentsButton.setToolTipText(t("tutti.editAccidentalBatch.action.attachments.tip"));
508 accidentalBatchAttachmentsButton.setFocusPainted(false);
509 }
510
511 protected void createAccidentalBatchTabToolBar() {
512 $objectMap.put("accidentalBatchTabToolBar", accidentalBatchTabToolBar = new JToolBar());
513
514 accidentalBatchTabToolBar.setName("accidentalBatchTabToolBar");
515 accidentalBatchTabToolBar.setBorderPainted(false);
516 accidentalBatchTabToolBar.setOpaque(true);
517 accidentalBatchTabToolBar.setFloatable(false);
518 }
519
520 protected void createBroker() {
521 $objectMap.put("broker", broker = new TuttiHelpBroker("tutti.editAccidentalBatch.help"));
522 }
523
524 protected void createCreateAccidentalBatchButton() {
525 $objectMap.put("createAccidentalBatchButton", createAccidentalBatchButton = new JButton());
526
527 createAccidentalBatchButton.setName("createAccidentalBatchButton");
528 createAccidentalBatchButton.setText(t("tutti.editAccidentalBatch.action.createBatch"));
529 createAccidentalBatchButton.setToolTipText(t("tutti.editAccidentalBatch.action.createBatch.tip"));
530 createAccidentalBatchButton.putClientProperty("help", "tutti.editAccidentalBatch.action.createBatch.help");
531 createAccidentalBatchButton.putClientProperty("simpleAction", fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.actions.OpenCreateAccidentalBatchUIAction.class);
532 }
533
534 protected void createExportMultiPostButton() {
535 $objectMap.put("exportMultiPostButton", exportMultiPostButton = new JMenuItem());
536
537 exportMultiPostButton.setName("exportMultiPostButton");
538 exportMultiPostButton.setText(t("tutti.editAccidentalBatch.action.exportMultiPost"));
539 exportMultiPostButton.setToolTipText(t("tutti.editAccidentalBatch.action.exportMultiPost.tip"));
540 exportMultiPostButton.putClientProperty("help", "tutti.editAccidentalBatch.action.exportMultiPost.help");
541 exportMultiPostButton.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.actions.ExportMultiPostAccidentalAction.class);
542 }
543
544 protected AccidentalBatchUIHandler createHandler() {
545 return new AccidentalBatchUIHandler();
546 }
547
548 protected void createImportMultiPostButton() {
549 $objectMap.put("importMultiPostButton", importMultiPostButton = new JMenuItem());
550
551 importMultiPostButton.setName("importMultiPostButton");
552 importMultiPostButton.setText(t("tutti.editAccidentalBatch.action.importMultiPost"));
553 importMultiPostButton.setToolTipText(t("tutti.editAccidentalBatch.action.importMultiPost.tip"));
554 importMultiPostButton.putClientProperty("help", "tutti.editAccidentalBatch.action.importMultiPost.help");
555 importMultiPostButton.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.actions.ImportMultiPostAccidentalAction.class);
556 }
557
558 protected void createMenu() {
559 $objectMap.put("menu", menu = new JMenuBar());
560
561 menu.setName("menu");
562 }
563
564 protected void createMenuAction() {
565 $objectMap.put("menuAction", menuAction = new JMenu());
566
567 menuAction.setName("menuAction");
568 menuAction.setOpaque(true);
569 menuAction.setText(t("tutti.toolbar.menu.action"));
570 menuAction.setToolTipText(t("tutti.toolbar.menu.action.tip"));
571 }
572
573 protected void createModel() {
574 $objectMap.put("model", model = getContextValue(AccidentalBatchUIModel.class));
575 }
576
577 protected void createRemoveAccidentalBatchMenu() {
578 $objectMap.put("removeAccidentalBatchMenu", removeAccidentalBatchMenu = new JMenuItem());
579
580 removeAccidentalBatchMenu.setName("removeAccidentalBatchMenu");
581 removeAccidentalBatchMenu.setText(t("tutti.editAccidentalBatch.action.removeBatch"));
582 removeAccidentalBatchMenu.setToolTipText(t("tutti.editAccidentalBatch.action.removeBatch.tip"));
583 removeAccidentalBatchMenu.putClientProperty("help", "tutti.editAccidentalBatch.action.removeBatch.help");
584 removeAccidentalBatchMenu.putClientProperty("applicationAction", fr.ifremer.tutti.ui.swing.content.operation.catches.accidental.actions.RemoveAccidentalBatchAction.class);
585 }
586
587 protected void createTable() {
588 $objectMap.put("table", table = new JXTable());
589
590 table.setName("table");
591 table.setSortable(false);
592 table.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyPressed", this, "doKeyPressed__on__table"));
593 table.addMouseListener(JAXXUtil.getEventListener(MouseListener.class, "mouseClicked", this, "doMouseClicked__on__table"));
594 }
595
596 protected void createTablePopup() {
597 $objectMap.put("tablePopup", tablePopup = new JPopupMenu());
598
599 tablePopup.setName("tablePopup");
600 tablePopup.setLabel("tutti.editAccidentalBatch.title.batchActions");
601 }
602
603 protected void createTableScrollPane() {
604 $objectMap.put("tableScrollPane", tableScrollPane = new JScrollPane());
605
606 tableScrollPane.setName("tableScrollPane");
607 }
608
609 protected void createTableToolbar() {
610 $objectMap.put("tableToolbar", tableToolbar = new JPanel());
611
612 tableToolbar.setName("tableToolbar");
613 tableToolbar.setLayout(new BorderLayout());
614 SwingUtil.setComponentHeight(tableToolbar,50);
615 }
616
617 protected void createValidator() {
618 $objectMap.put("validator", validator = SwingValidator.newValidator(AccidentalBatchUIModel.class, null));
619 }
620
621
622
623
624
625 private void $completeSetup() {
626 allComponentsCreated = true;
627 if (log.isDebugEnabled()) {
628 log.debug(this);
629 }
630 addChildrenToEditAccidentalBatchTopPanel();
631 addChildrenToValidator();
632 addChildrenToAccidentalBatchTabToolBar();
633 addChildrenToMenu();
634 addChildrenToMenuAction();
635 addChildrenToTablePopup();
636 addChildrenToTableToolbar();
637
638 $JPanel0.add(createAccidentalBatchButton);
639 addChildrenToTableScrollPane();
640
641
642 JAXXUtil.applyDataBinding(this, $bindings.keySet());
643
644
645 menu.setBorder(null);
646 menu.setBackground(javax.swing.UIManager.getColor("MenuBar.background"));
647 menuAction.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.toolbar.menu.action.mnemonic"),'Z'));
648 importMultiPostButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editAccidentalBatch.action.importMultiPost.mnemonic"),'Z'));
649 importMultiPostButton.setIcon(SwingUtil.createActionIcon("import"));
650 exportMultiPostButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editAccidentalBatch.action.exportMultiPost.mnemonic"),'Z'));
651 exportMultiPostButton.setIcon(SwingUtil.createActionIcon("export"));
652 removeAccidentalBatchMenu.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editAccidentalBatch.action.removeBatch.mnemonic"),'Z'));
653 removeAccidentalBatchMenu.setIcon(SwingUtil.createActionIcon("batch-delete"));
654 createAccidentalBatchButton.setMnemonic(SwingUtil.getFirstCharAt(t("tutti.editAccidentalBatch.action.createBatch.mnemonic"),'Z'));
655 createAccidentalBatchButton.setIcon(SwingUtil.createActionIcon("batch-create"));
656 table.setSelectionForeground(Color.BLACK);
657 table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
658
659
660 TuttiHelpBroker _broker = getBroker();
661 registerHelpId(_broker, editAccidentalBatchTopPanel, "tutti.editAccidentalBatch.help");
662 registerHelpId(_broker, importMultiPostButton, "tutti.editAccidentalBatch.action.importMultiPost.help");
663 registerHelpId(_broker, exportMultiPostButton, "tutti.editAccidentalBatch.action.exportMultiPost.help");
664 registerHelpId(_broker, removeAccidentalBatchMenu, "tutti.editAccidentalBatch.action.removeBatch.help");
665 registerHelpId(_broker, createAccidentalBatchButton, "tutti.editAccidentalBatch.action.createBatch.help");
666 _broker.prepareUI(this);
667
668 validatorIds = SwingValidatorUtil.detectValidators(this);
669 SwingValidatorUtil.installUI(this);
670 }
671
672 private void $initialize() {
673 if (allComponentsCreated) {
674 return;
675 }
676 if (log.isDebugEnabled()) {
677 log.debug(this);
678 }
679 handler.beforeInit(this);
680 $objectMap.put("editAccidentalBatchTopPanel", editAccidentalBatchTopPanel);
681 createModel();
682 createValidator();
683 createBroker();
684 createAccidentalBatchTabToolBar();
685 createMenu();
686 createMenuAction();
687 createImportMultiPostButton();
688 createExportMultiPostButton();
689 createAccidentalBatchAttachmentsButton();
690 createTablePopup();
691 createRemoveAccidentalBatchMenu();
692 createTableToolbar();
693
694 $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
695
696 $JPanel0.setName("$JPanel0");
697 $JPanel0.setLayout(new GridLayout(1,0));
698 createCreateAccidentalBatchButton();
699 createTableScrollPane();
700 createTable();
701
702 setName("editAccidentalBatchTopPanel");
703 setLayout(new BorderLayout());
704 editAccidentalBatchTopPanel.putClientProperty("help", "tutti.editAccidentalBatch.help");
705
706
707 $registerDefaultBindings();
708 $completeSetup();
709 handler.afterInit(this);
710 }
711
712 private void $registerDefaultBindings() {
713
714 registerDataBinding(new DefaultJAXXBinding(this, BINDING_REMOVE_ACCIDENTAL_BATCH_MENU_ENABLED, true) {
715
716 @Override
717 public void applyDataBinding() {
718 if (model != null) {
719 model.addPropertyChangeListener("removeBatchEnabled", this);
720 }
721 }
722
723 @Override
724 public void processDataBinding() {
725 if (model != null) {
726 removeAccidentalBatchMenu.setEnabled(model.isRemoveBatchEnabled());
727 }
728 }
729
730 @Override
731 public void removeDataBinding() {
732 if (model != null) {
733 model.removePropertyChangeListener("removeBatchEnabled", this);
734 }
735 }
736 });
737 }
738
739 }