1 package fr.ifremer.dali.ui.swing.content.observation.operation.measurement.grouped;
2
3 import fr.ifremer.dali.ui.swing.DaliHelpBroker;
4 import fr.ifremer.dali.ui.swing.DaliUIContext;
5 import fr.ifremer.dali.ui.swing.util.DaliUI;
6 import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
7 import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
8 import fr.ifremer.quadrige3.ui.swing.component.ToggleButton;
9 import fr.ifremer.quadrige3.ui.swing.plaf.WaitBlockingLayerUI;
10 import fr.ifremer.quadrige3.ui.swing.table.SwingTable;
11 import java.awt.BorderLayout;
12 import java.awt.Component;
13 import java.awt.Container;
14 import java.awt.FlowLayout;
15 import java.awt.LayoutManager;
16 import java.awt.event.ActionEvent;
17 import java.awt.event.ActionListener;
18 import java.util.ArrayList;
19 import java.util.HashMap;
20 import java.util.List;
21 import java.util.Map;
22 import java.util.TreeMap;
23 import javax.swing.BorderFactory;
24 import javax.swing.Box;
25 import javax.swing.BoxLayout;
26 import javax.swing.JButton;
27 import javax.swing.JComboBox;
28 import javax.swing.JPanel;
29 import javax.swing.JScrollPane;
30 import javax.swing.SpringLayout;
31 import jaxx.runtime.JAXXBinding;
32 import jaxx.runtime.JAXXContext;
33 import jaxx.runtime.JAXXObject;
34 import jaxx.runtime.JAXXObjectDescriptor;
35 import jaxx.runtime.JAXXUtil;
36 import jaxx.runtime.SwingUtil;
37 import jaxx.runtime.binding.DefaultJAXXBinding;
38 import jaxx.runtime.context.DefaultJAXXContext;
39 import jaxx.runtime.swing.help.JAXXHelpUI;
40 import org.apache.commons.logging.Log;
41 import org.apache.commons.logging.LogFactory;
42 import static org.nuiton.i18n.I18n.t;
43
44 public class OperationMeasurementsGroupedTableUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, DaliUI<OperationMeasurementsGroupedTableUIModel, OperationMeasurementsGroupedTableUIHandler>, JAXXObject {
45
46
47
48
49
50 public static final String BINDING_ADD_BUTTON_ENABLED = "addButton.enabled";
51 public static final String BINDING_DELETE_BUTTON_ENABLED = "deleteButton.enabled";
52 public static final String BINDING_DUPLICATE_BUTTON_ENABLED = "duplicateButton.enabled";
53 public static final String BINDING_INIT_DATA_GRID_COMBO_BOX_ENABLED = "initDataGridComboBox.enabled";
54 public static final String BINDING_MULTI_EDIT_BUTTON_ENABLED = "multiEditButton.enabled";
55 public static final String BINDING_TABLE_BLOCK_LAYER_BLOCK = "tableBlockLayer.block";
56
57
58
59
60
61 private static final String $jaxxObjectDescriptor = "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";
62 private static final Log log = LogFactory.getLog(OperationMeasurementsGroupedTableUI.class);
63 private static final long serialVersionUID = 1L;
64
65
66
67
68
69 protected List<Object> $activeBindings = new ArrayList<Object>();
70 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
71 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
72 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
73 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
74 private boolean allComponentsCreated;
75 protected final JAXXContext delegateContext = new DefaultJAXXContext();
76
77
78
79
80
81 protected JButton addButton;
82 protected DaliHelpBroker broker;
83 protected JButton configInitDataGridButton;
84 protected JButton deleteButton;
85 protected JButton duplicateButton;
86 protected SpringLayout footerLayout;
87 protected JPanel footerPanel;
88 protected ToggleButton fullScreenToggleButton;
89 protected final OperationMeasurementsGroupedTableUIHandler handler = createHandler();
90 protected JButton initButton;
91 protected JButton initDataGridButton;
92 protected JComboBox initDataGridComboBox;
93 protected OperationMeasurementsGroupedTableUIModel model;
94 protected JButton multiEditButton;
95 protected SwingTable operationGroupedMeasurementTable;
96 protected WaitBlockingLayerUI tableBlockLayer;
97 protected OperationMeasurementsGroupedTableUI tableauBasPanel = this;
98 protected JScrollPane tableauBasScrollPane;
99
100
101
102
103
104 private JPanel $JPanel0;
105 private JPanel $JPanel1;
106 private JPanel $JPanel2;
107 private JPanel $JPanel3;
108
109
110
111
112
113 public OperationMeasurementsGroupedTableUI(ApplicationUI parentUI) {
114 ApplicationUIUtil.setParentUI(this, parentUI);
115 $initialize();
116 }
117
118 public OperationMeasurementsGroupedTableUI() {
119 $initialize();
120 }
121
122 public OperationMeasurementsGroupedTableUI(JAXXContext parentContext) {
123 JAXXUtil.initContext(this, parentContext);
124 $initialize();
125 }
126
127 public OperationMeasurementsGroupedTableUI(boolean param0) {
128 super(param0);
129 $initialize();
130 }
131
132 public OperationMeasurementsGroupedTableUI(JAXXContext parentContext, boolean param1) {
133 super(param1);
134 JAXXUtil.initContext(this, parentContext);
135 $initialize();
136 }
137
138 public OperationMeasurementsGroupedTableUI(LayoutManager param0) {
139 super(param0);
140 $initialize();
141 }
142
143 public OperationMeasurementsGroupedTableUI(JAXXContext parentContext, LayoutManager param1) {
144 super(param1);
145 JAXXUtil.initContext(this, parentContext);
146 $initialize();
147 }
148
149 public OperationMeasurementsGroupedTableUI(LayoutManager param0, boolean param1) {
150 super(param0 ,param1);
151 $initialize();
152 }
153
154 public OperationMeasurementsGroupedTableUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
155 super(param1 ,param2);
156 JAXXUtil.initContext(this, parentContext);
157 $initialize();
158 }
159
160
161
162
163
164 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
165 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
166 }
167
168
169
170
171
172 @Override
173 public void applyDataBinding(String $binding) {
174 if (allComponentsCreated && $bindings.containsKey($binding)) {
175 getDataBinding($binding).applyDataBinding();
176 }
177 processDataBinding($binding);
178 }
179
180 @Override
181 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
182 super.firePropertyChange(propertyName, oldValue, newValue);
183 }
184
185 @Override
186 public Map<String, Object> get$objectMap() {
187 return $objectMap;
188 }
189
190 @Override
191 public JAXXBinding getDataBinding(String bindingId) {
192 return $bindings.get(bindingId);
193 }
194
195 @Override
196 public JAXXBinding[] getDataBindings() {
197 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
198 }
199
200 @Override
201 public Object getObjectById(String id) {
202 return $objectMap.get(id);
203 }
204
205 @Override
206 public void processDataBinding(String $binding, boolean $force) {
207 if (!$force && $activeBindings.contains($binding)) {
208 return;
209 }
210 $activeBindings.add($binding);
211 try {
212 if (allComponentsCreated && $bindings.containsKey($binding)) {
213 getDataBinding($binding).processDataBinding();
214 }
215 } finally {
216 $activeBindings.remove($binding);
217 }
218 }
219
220 @Override
221 public void processDataBinding(String $binding) {
222 processDataBinding($binding, false);
223 }
224
225 @Override
226 public void registerDataBinding(JAXXBinding binding) {
227 $bindings.put(binding.getId(), binding);
228 }
229
230 @Override
231 public void removeDataBinding(String $binding) {
232 if (allComponentsCreated && $bindings.containsKey($binding)) {
233 getDataBinding($binding).removeDataBinding();
234 }
235 }
236
237
238
239
240
241 @Override
242 public <T> T getContextValue(Class<T> clazz) {
243 return delegateContext.getContextValue(clazz, null);
244 }
245
246 @Override
247 public <T> T getContextValue(Class<T> clazz, String name) {
248 return delegateContext.getContextValue(clazz, name);
249 }
250
251 @Override
252 public JAXXContext getDelegateContext() {
253 return delegateContext;
254 }
255
256 @Override
257 public <O extends Container> O getParentContainer(Class<O> clazz) {
258 return SwingUtil.getParentContainer(this, clazz);
259 }
260
261 @Override
262 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
263 return SwingUtil.getParentContainer(source, clazz);
264 }
265
266 @Override
267 public <T> void removeContextValue(Class<T> clazz) {
268 delegateContext.removeContextValue(clazz, null);
269 }
270
271 @Override
272 public <T> void removeContextValue(Class<T> clazz, String name) {
273 delegateContext.removeContextValue(clazz, name);
274 }
275
276 @Override
277 public <T> void setContextValue(T o) {
278 delegateContext.setContextValue(o, null);
279 }
280
281 @Override
282 public <T> void setContextValue(T o, String name) {
283 delegateContext.setContextValue(o, name);
284 }
285
286
287
288
289
290 public void doActionPerformed__on__addButton(ActionEvent event) {
291 if (log.isDebugEnabled()) {
292 log.debug(event);
293 }
294 model.insertNewRowAfterSelected();
295 }
296
297 public void doActionPerformed__on__configInitDataGridButton(ActionEvent event) {
298 if (log.isDebugEnabled()) {
299 log.debug(event);
300 }
301 handler.initializeDataGrid(true);
302 }
303
304 public void doActionPerformed__on__deleteButton(ActionEvent event) {
305 if (log.isDebugEnabled()) {
306 log.debug(event);
307 }
308 handler.removeIndividualMeasurements();
309 }
310
311 public void doActionPerformed__on__duplicateButton(ActionEvent event) {
312 if (log.isDebugEnabled()) {
313 log.debug(event);
314 }
315 handler.duplicateSelectedRow();
316 }
317
318 public void doActionPerformed__on__fullScreenToggleButton(ActionEvent event) {
319 if (log.isDebugEnabled()) {
320 log.debug(event);
321 }
322 handler.toggleFullScreen(tableauBasPanel, fullScreenToggleButton);
323 }
324
325 public void doActionPerformed__on__initDataGridButton(ActionEvent event) {
326 if (log.isDebugEnabled()) {
327 log.debug(event);
328 }
329 handler.initializeDataGrid(false);
330 }
331
332 public void doActionPerformed__on__multiEditButton(ActionEvent event) {
333 if (log.isDebugEnabled()) {
334 log.debug(event);
335 }
336 handler.editSelectedMeasurements();
337 }
338
339
340
341
342
343 public JButton getAddButton() {
344 return addButton;
345 }
346
347 public DaliHelpBroker getBroker() {
348 return broker;
349 }
350
351 public JButton getConfigInitDataGridButton() {
352 return configInitDataGridButton;
353 }
354
355 public JButton getDeleteButton() {
356 return deleteButton;
357 }
358
359 public JButton getDuplicateButton() {
360 return duplicateButton;
361 }
362
363 public SpringLayout getFooterLayout() {
364 return footerLayout;
365 }
366
367 public JPanel getFooterPanel() {
368 return footerPanel;
369 }
370
371 public ToggleButton getFullScreenToggleButton() {
372 return fullScreenToggleButton;
373 }
374
375 public OperationMeasurementsGroupedTableUIHandler getHandler() {
376 return handler;
377 }
378
379 public JButton getInitButton() {
380 return initButton;
381 }
382
383 public JButton getInitDataGridButton() {
384 return initDataGridButton;
385 }
386
387 public JComboBox getInitDataGridComboBox() {
388 return initDataGridComboBox;
389 }
390
391 public OperationMeasurementsGroupedTableUIModel getModel() {
392 return model;
393 }
394
395 public JButton getMultiEditButton() {
396 return multiEditButton;
397 }
398
399 public SwingTable getOperationGroupedMeasurementTable() {
400 return operationGroupedMeasurementTable;
401 }
402
403 public WaitBlockingLayerUI getTableBlockLayer() {
404 return tableBlockLayer;
405 }
406
407 public JScrollPane getTableauBasScrollPane() {
408 return tableauBasScrollPane;
409 }
410
411
412
413
414
415 @Override
416 public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
417 broker.installUI(component, helpId);
418 }
419
420 @Override
421 public void showHelp(String helpId) {
422 getBroker().showHelp(this, helpId);
423 }
424
425
426
427
428
429 protected JPanel get$JPanel0() {
430 return $JPanel0;
431 }
432
433 protected JPanel get$JPanel1() {
434 return $JPanel1;
435 }
436
437 protected JPanel get$JPanel2() {
438 return $JPanel2;
439 }
440
441 protected JPanel get$JPanel3() {
442 return $JPanel3;
443 }
444
445
446
447
448
449 protected void addChildrenToTableauBasPanel() {
450 if (!allComponentsCreated) {
451 return;
452 }
453 add($JPanel0);
454 add($JPanel1, BorderLayout.PAGE_END);
455 }
456
457 protected void addChildrenToTableauBasScrollPane() {
458 if (!allComponentsCreated) {
459 return;
460 }
461 tableauBasScrollPane.getViewport().add(operationGroupedMeasurementTable);
462 }
463
464 protected void createAddButton() {
465 $objectMap.put("addButton", addButton = new JButton());
466
467 addButton.setName("addButton");
468 addButton.setText(t("dali.common.new"));
469 addButton.setToolTipText(t("dali.samplingOperation.measurement.grouped.new.tip"));
470 addButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__addButton"));
471 }
472
473 protected void createBroker() {
474 $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
475 }
476
477 protected void createConfigInitDataGridButton() {
478 $objectMap.put("configInitDataGridButton", configInitDataGridButton = new JButton());
479
480 configInitDataGridButton.setName("configInitDataGridButton");
481 configInitDataGridButton.setVisible(false);
482 configInitDataGridButton.setText(t("dali.common.config.init"));
483 configInitDataGridButton.setToolTipText(t("dali.samplingOperation.measurement.grouped.config.init.tip"));
484 configInitDataGridButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__configInitDataGridButton"));
485 }
486
487 protected void createDeleteButton() {
488 $objectMap.put("deleteButton", deleteButton = new JButton());
489
490 deleteButton.setName("deleteButton");
491 deleteButton.setText(t("dali.common.delete"));
492 deleteButton.setToolTipText(t("dali.samplingOperation.measurement.grouped.delete.tip"));
493 deleteButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__deleteButton"));
494 }
495
496 protected void createDuplicateButton() {
497 $objectMap.put("duplicateButton", duplicateButton = new JButton());
498
499 duplicateButton.setName("duplicateButton");
500 duplicateButton.setText(t("dali.action.duplicate.label"));
501 duplicateButton.setToolTipText(t("dali.action.duplicate.measurement.tip"));
502 duplicateButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__duplicateButton"));
503 }
504
505 protected void createFooterLayout() {
506 $objectMap.put("footerLayout", footerLayout = new SpringLayout());
507 }
508
509 protected void createFooterPanel() {
510 $objectMap.put("footerPanel", footerPanel = new JPanel());
511
512 footerPanel.setName("footerPanel");
513 footerPanel.setLayout(footerLayout);
514 }
515
516 protected void createFullScreenToggleButton() {
517 $objectMap.put("fullScreenToggleButton", fullScreenToggleButton = new ToggleButton());
518
519 fullScreenToggleButton.setName("fullScreenToggleButton");
520 fullScreenToggleButton.setText(t("dali.table.view.fullScreen"));
521 fullScreenToggleButton.setToolTipText(t("dali.table.view.fullScreen.tip"));
522 fullScreenToggleButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__fullScreenToggleButton"));
523 }
524
525 protected OperationMeasurementsGroupedTableUIHandler createHandler() {
526 return new OperationMeasurementsGroupedTableUIHandler();
527 }
528
529 protected void createInitButton() {
530 $objectMap.put("initButton", initButton = new JButton());
531
532 initButton.setName("initButton");
533 initButton.setVisible(false);
534 initButton.setText(t("dali.common.init"));
535 }
536
537 protected void createInitDataGridButton() {
538 $objectMap.put("initDataGridButton", initDataGridButton = new JButton());
539
540 initDataGridButton.setName("initDataGridButton");
541 initDataGridButton.setVisible(false);
542 initDataGridButton.setText(t("dali.common.init"));
543 initDataGridButton.setToolTipText(t("dali.samplingOperation.measurement.grouped.init.tip"));
544 initDataGridButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__initDataGridButton"));
545 }
546
547 protected void createInitDataGridComboBox() {
548 $objectMap.put("initDataGridComboBox", initDataGridComboBox = new JComboBox());
549
550 initDataGridComboBox.setName("initDataGridComboBox");
551 }
552
553 protected void createModel() {
554 $objectMap.put("model", model = getContextValue(OperationMeasurementsGroupedTableUIModel.class));
555 }
556
557 protected void createMultiEditButton() {
558 $objectMap.put("multiEditButton", multiEditButton = new JButton());
559
560 multiEditButton.setName("multiEditButton");
561 multiEditButton.setText(t("dali.common.edit"));
562 multiEditButton.setToolTipText(t("dali.measurement.grouped.multiEdit.tip"));
563 multiEditButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__multiEditButton"));
564 }
565
566 protected void createOperationGroupedMeasurementTable() {
567 $objectMap.put("operationGroupedMeasurementTable", operationGroupedMeasurementTable = new SwingTable());
568
569 operationGroupedMeasurementTable.setName("operationGroupedMeasurementTable");
570 }
571
572 protected void createTableBlockLayer() {
573 $objectMap.put("tableBlockLayer", tableBlockLayer = new WaitBlockingLayerUI());
574 }
575
576 protected void createTableauBasScrollPane() {
577 $objectMap.put("tableauBasScrollPane", tableauBasScrollPane = new JScrollPane());
578
579 tableauBasScrollPane.setName("tableauBasScrollPane");
580 }
581
582
583
584
585
586 private void $completeSetup() {
587 allComponentsCreated = true;
588 if (log.isDebugEnabled()) {
589 log.debug(this);
590 }
591 addChildrenToTableauBasPanel();
592
593 $JPanel0.add(SwingUtil.boxComponentWithJxLayer(tableauBasScrollPane));
594 $JPanel0.add(footerPanel, BorderLayout.PAGE_END);
595 addChildrenToTableauBasScrollPane();
596
597 $JPanel1.add($JPanel2, BorderLayout.LINE_START);
598 $JPanel1.add($JPanel3, BorderLayout.LINE_END);
599
600 $JPanel2.add(addButton);
601 $JPanel2.add(duplicateButton);
602 $JPanel2.add(initDataGridComboBox);
603 $JPanel2.add(initButton);
604 $JPanel2.add(initDataGridButton);
605 $JPanel2.add(configInitDataGridButton);
606 $JPanel2.add(multiEditButton);
607 $JPanel2.add(deleteButton);
608
609 $JPanel3.add(fullScreenToggleButton);
610
611
612 JAXXUtil.applyDataBinding(this, $bindings.keySet());
613
614
615 tableauBasScrollPane.setBorder(null);
616 addButton.setAlignmentX(Component.CENTER_ALIGNMENT);
617 duplicateButton.setAlignmentX(Component.CENTER_ALIGNMENT);
618 initDataGridComboBox.setAlignmentX(Component.CENTER_ALIGNMENT);
619 initDataGridButton.setAlignmentX(Component.CENTER_ALIGNMENT);
620 configInitDataGridButton.setAlignmentX(Component.CENTER_ALIGNMENT);
621 multiEditButton.setAlignmentX(Component.CENTER_ALIGNMENT);
622 deleteButton.setAlignmentX(Component.CENTER_ALIGNMENT);
623 setBorder(BorderFactory.createTitledBorder(""));
624 tableBlockLayer.setBlockingColor(handler.getConfig().getColorBlockingLayer());
625 addButton.setIcon(SwingUtil.createActionIcon("add"));
626 duplicateButton.setIcon(SwingUtil.createActionIcon("copy"));
627 initDataGridComboBox.setModel(handler.newActionComboBoxModel(initDataGridButton, configInitDataGridButton));
628 initButton.setIcon(SwingUtil.createActionIcon("edit"));
629 initDataGridButton.setIcon(SwingUtil.createActionIcon("edit"));
630 configInitDataGridButton.setIcon(SwingUtil.createActionIcon("edit"));
631 multiEditButton.setIcon(SwingUtil.createActionIcon("edit"));
632 deleteButton.setIcon(SwingUtil.createActionIcon("delete"));
633 fullScreenToggleButton.setToggledIcon(SwingUtil.createActionIcon("unFullScreen"));
634 fullScreenToggleButton.setToggledText(t("dali.table.view.unFullScreen"));
635 fullScreenToggleButton.setIcon(SwingUtil.createActionIcon("fullScreen"));
636 fullScreenToggleButton.setToggledToolTipText(t("dali.table.view.unFullScreen.tip"));
637 }
638
639 private void $initialize() {
640 if (allComponentsCreated) {
641 return;
642 }
643 if (log.isDebugEnabled()) {
644 log.debug(this);
645 }
646 handler.beforeInit(this);
647 $objectMap.put("tableauBasPanel", tableauBasPanel);
648 createModel();
649 createBroker();
650 createTableBlockLayer();
651
652 $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
653
654 $JPanel0.setName("$JPanel0");
655 $JPanel0.setLayout(new BorderLayout());
656 createTableauBasScrollPane();
657 createOperationGroupedMeasurementTable();
658 createFooterLayout();
659 createFooterPanel();
660
661 $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
662
663 $JPanel1.setName("$JPanel1");
664 $JPanel1.setLayout(new BorderLayout());
665
666 $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
667
668 $JPanel2.setName("$JPanel2");
669 createAddButton();
670 createDuplicateButton();
671 createInitDataGridComboBox();
672 createInitButton();
673 createInitDataGridButton();
674 createConfigInitDataGridButton();
675 createMultiEditButton();
676 createDeleteButton();
677
678 $objectMap.put("$JPanel3", $JPanel3 = new JPanel());
679
680 $JPanel3.setName("$JPanel3");
681 createFullScreenToggleButton();
682
683 setName("tableauBasPanel");
684 setLayout(new BorderLayout());
685 tableauBasPanel.putClientProperty("panelType", DaliUI.EDITION_PANEL_TYPE);
686
687
688 $registerDefaultBindings();
689 $completeSetup();
690 handler.afterInit(this);
691 }
692
693 private void $registerDefaultBindings() {
694
695 registerDataBinding(new DefaultJAXXBinding(this, BINDING_TABLE_BLOCK_LAYER_BLOCK, true) {
696
697 @Override
698 public void applyDataBinding() {
699 if (model != null) {
700 model.addPropertyChangeListener("loading", this);
701 }
702 }
703
704 @Override
705 public void processDataBinding() {
706 if (model != null) {
707 tableBlockLayer.setBlock(model.isLoading());
708 }
709 }
710
711 @Override
712 public void removeDataBinding() {
713 if (model != null) {
714 model.removePropertyChangeListener("loading", this);
715 }
716 }
717 });
718 registerDataBinding(new DefaultJAXXBinding(this, BINDING_ADD_BUTTON_ENABLED, true) {
719
720 @Override
721 public void applyDataBinding() {
722 if (model != null) {
723 model.addPropertyChangeListener("survey", this);
724 }
725 }
726
727 @Override
728 public void processDataBinding() {
729 if (model != null && model.getSurvey() != null) {
730 addButton.setEnabled(model.getSurvey().isEditable());
731 }
732 }
733
734 @Override
735 public void removeDataBinding() {
736 if (model != null) {
737 model.removePropertyChangeListener("survey", this);
738 }
739 }
740 });
741 registerDataBinding(new DefaultJAXXBinding(this, BINDING_DUPLICATE_BUTTON_ENABLED, true, true) {
742
743 @Override
744 public void applyDataBinding() {
745 if (model != null) {
746 model.addPropertyChangeListener("survey", this);
747 }
748 if (model != null) {
749 model.addPropertyChangeListener("selectedRows", this);
750 }
751 }
752
753 @Override
754 public void processDataBinding() {
755 if (model != null && model.getSurvey() != null && model.getSelectedRows() != null) {
756 duplicateButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() == 1));
757 }
758 }
759
760 @Override
761 public void removeDataBinding() {
762 if (model != null) {
763 model.removePropertyChangeListener("survey", this);
764 }
765 if (model != null) {
766 model.removePropertyChangeListener("selectedRows", this);
767 }
768 }
769 });
770 registerDataBinding(new DefaultJAXXBinding(this, BINDING_INIT_DATA_GRID_COMBO_BOX_ENABLED, true) {
771
772 @Override
773 public void applyDataBinding() {
774 if (model != null) {
775 model.addPropertyChangeListener("survey", this);
776 }
777 }
778
779 @Override
780 public void processDataBinding() {
781 if (model != null && model.getSurvey() != null) {
782 initDataGridComboBox.setEnabled(model.getSurvey().isEditable());
783 }
784 }
785
786 @Override
787 public void removeDataBinding() {
788 if (model != null) {
789 model.removePropertyChangeListener("survey", this);
790 }
791 }
792 });
793 registerDataBinding(new DefaultJAXXBinding(this, BINDING_MULTI_EDIT_BUTTON_ENABLED, true, true) {
794
795 @Override
796 public void applyDataBinding() {
797 if (model != null) {
798 model.addPropertyChangeListener("survey", this);
799 }
800 if (model != null) {
801 model.addPropertyChangeListener("selectedRows", this);
802 }
803 if (model != null) {
804 model.addPropertyChangeListener("pmfms", this);
805 }
806 }
807
808 @Override
809 public void processDataBinding() {
810 if (model != null && model.getPmfms() != null && model.getSurvey() != null && model.getSelectedRows() != null) {
811 multiEditButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty() && (model.getSelectedRows().size() >= 2) && !model.getPmfms().isEmpty());
812 }
813 }
814
815 @Override
816 public void removeDataBinding() {
817 if (model != null) {
818 model.removePropertyChangeListener("survey", this);
819 }
820 if (model != null) {
821 model.removePropertyChangeListener("selectedRows", this);
822 }
823 if (model != null) {
824 model.removePropertyChangeListener("pmfms", this);
825 }
826 }
827 });
828 registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_BUTTON_ENABLED, true, true) {
829
830 @Override
831 public void applyDataBinding() {
832 if (model != null) {
833 model.addPropertyChangeListener("survey", this);
834 }
835 if (model != null) {
836 model.addPropertyChangeListener("selectedRows", this);
837 }
838 }
839
840 @Override
841 public void processDataBinding() {
842 if (model != null && model.getSurvey() != null && model.getSelectedRows() != null) {
843 deleteButton.setEnabled(model.getSurvey().isEditable() && !model.getSelectedRows().isEmpty());
844 }
845 }
846
847 @Override
848 public void removeDataBinding() {
849 if (model != null) {
850 model.removePropertyChangeListener("survey", this);
851 }
852 if (model != null) {
853 model.removePropertyChangeListener("selectedRows", this);
854 }
855 }
856 });
857 }
858
859 }