1 package fr.ifremer.dali.ui.swing.content.manage.referential.location.menu;
2
3 import fr.ifremer.dali.dto.configuration.programStrategy.ProgramDTO;
4 import fr.ifremer.dali.dto.referential.GroupingDTO;
5 import fr.ifremer.dali.dto.referential.GroupingTypeDTO;
6 import fr.ifremer.dali.ui.swing.DaliHelpBroker;
7 import fr.ifremer.dali.ui.swing.DaliUIContext;
8 import fr.ifremer.dali.ui.swing.content.manage.filter.element.menu.ApplyFilterUI;
9 import fr.ifremer.dali.ui.swing.content.manage.referential.menu.ReferentialMenuUI;
10 import fr.ifremer.dali.ui.swing.util.DaliUI;
11 import fr.ifremer.quadrige3.ui.core.dto.referential.StatusDTO;
12 import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
13 import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
14 import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedComboBox;
15 import java.awt.BorderLayout;
16 import java.awt.Component;
17 import java.awt.Container;
18 import java.awt.GridBagConstraints;
19 import java.awt.GridLayout;
20 import java.awt.Insets;
21 import java.awt.LayoutManager;
22 import java.awt.event.KeyEvent;
23 import java.awt.event.KeyListener;
24 import java.util.ArrayList;
25 import java.util.HashMap;
26 import java.util.List;
27 import java.util.Map;
28 import java.util.TreeMap;
29 import javax.swing.BorderFactory;
30 import javax.swing.Box;
31 import javax.swing.BoxLayout;
32 import javax.swing.JButton;
33 import javax.swing.JLabel;
34 import javax.swing.JPanel;
35 import javax.swing.JTextField;
36 import javax.swing.SwingConstants;
37 import jaxx.runtime.JAXXBinding;
38 import jaxx.runtime.JAXXContext;
39 import jaxx.runtime.JAXXObject;
40 import jaxx.runtime.JAXXObjectDescriptor;
41 import jaxx.runtime.JAXXUtil;
42 import jaxx.runtime.SwingUtil;
43 import jaxx.runtime.binding.DefaultJAXXBinding;
44 import jaxx.runtime.context.DefaultJAXXContext;
45 import jaxx.runtime.swing.Table;
46 import jaxx.runtime.swing.help.JAXXHelpUI;
47 import org.apache.commons.logging.Log;
48 import org.apache.commons.logging.LogFactory;
49 import static org.nuiton.i18n.I18n.t;
50
51 public class LocationMenuUI extends JPanel implements JAXXHelpUI<DaliHelpBroker>, ReferentialMenuUI<LocationMenuUIModel, LocationMenuUIHandler>, JAXXObject {
52
53
54
55
56
57 public static final String BINDING_GROUPING_COMBO_SELECTED_ITEM = "groupingCombo.selectedItem";
58 public static final String BINDING_GROUPING_TYPE_COMBO_SELECTED_ITEM = "groupingTypeCombo.selectedItem";
59 public static final String BINDING_LABEL_EDITOR_TEXT = "labelEditor.text";
60 public static final String BINDING_NAME_EDITOR_TEXT = "nameEditor.text";
61 public static final String BINDING_PROGRAM_COMBO_SELECTED_ITEM = "programCombo.selectedItem";
62 public static final String BINDING_STATUS_COMBO_SELECTED_ITEM = "statusCombo.selectedItem";
63
64
65
66
67
68 private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAK1YzW8bRRQfmziJ89UkTqKUpqRNK5JIdANNQYIAzVdNXTkQNYkUNUgw9o6dKevd7eyYOLKK+BP4E+DOBYkbJ8SBMwcuiAtcEUIcuCLem13vh72JNzGRsvbOvPd7v9+bmfcm+fpPknEEufmUNhqaqJuS15j2aOPw8IPSU1aW28wpC25LSxD3J5Um6SMyrPvjjiS3jorovuK5r2xZNdsymRnyXiuSIUeeGsw5ZkxKcj3qUXaclT1/eq1h10UL1ScVh/rl33+lv9A//ypNSMMGdi+ClBvdvAIlfUWS5rokkxDpU7piULMKNAQ3q8B3FMe2DOo479Mae0Y+IwNF0m9TAWCSLCSXrDCUf8OWZPD2o11qMuNVSXYrQuMVwWpMaDo1uFbnmnMC0bWyZUoA02rUpFWmCVZhGJZTQzOsMpXcMrUaM+ta0XvbgZeDgm2rOP2SZGqWzgxJDv7vEDuIG8TpLwnrEyYkWTwz0Da8PQSfTWUZuGYRXaUCFgBz3fAc3PygVdY3HqW2bZzmuSGZOChIUkiqq6JcNGaAKY6ioo0wFgaY9OOMOWBZRrkes9nIbnJD7NOSwaJ+rVV9Dd+n8DEbcK8Kq26DY5GWOsWqQbS85jtMtBz2T20GO6tkSfJOSPCzOtUFr7LVsGpv/2klRk3tQQNyoDNdOW9ajSh+i+zd88gqVxxcwMetDufVGOcRW1hVQWu+pnl8LHbMR7EXO7DvxWAPO5LKuhOFvtM+HUW+04H8egzyONdx41c4NWUUfjWAN3Digc7hYEsyE1nBfdaQec4MPerSCvlGTMisCSUlGustf3IIJ91QOPJmdHba36GbdSkt0/FPy1R0Sw6XDUaFayRJLkLZHUXD9WBxHDAvHwdT2968INcihwCKtRYU66Capo5IRtRhGE7NUWd9fwxTbmWfbavsCKhm/53J/fzdr9/mW+V8HmJPx5qGuhGUWdhWNhQhjqGvuLW8LrmxskPttSOSdTOmWtVcDLE9bxrIQbwJdNfQXXtInWOAyAz88v0PMx//9AJJ58mQYVE9T9G+QLLyWEAWLENv2PfXFaORk0F4jsNvH6ykW32wXEh4F3X4GAX7k21WtgRVeylToYYD41kcf8wc7I6eaR+eZUkGmqqYP29A6uZiUufzL2V//Ce39816K30pkHP1TPMghZknpJ+bBjeZ6odeq4vtf8O2w+q6FbS0uCZHoM2Nt5cgr/AX1XO3I1sp7CWW0LGX3G9uqm9umk+1smBUsn0uDaa7M0tyaUGVfaj2FV51y7pEg4XlZUgUxniiMoDfPiQdhd3uQicN51cd+Tyu0ZVmpCo+xxWCQy/JvCLhbb/ToHG2zOOYRNtBAiIjLnWmFySrSXLV3Q5alcn3Qn1iaRloDbaogFe4icTx6OwyF+cy3cmlncdgolwkjR9alLFmuJsEazIdXRPPKC56pF1dXPxUIH7XBWrXPpAg+CWUjzZDzS4QPhUV7trEhQ630ovLzgWy9xROu+r+rpEvpTnUgQPNubYDiDZxgTt6fLfoKT/EZKBXeS7FF5jwDeFi0kaaQcMPlE1GlaFJXNjgJpFc0USgCEv7GYJC15Bu0NDqJj/CGzp369+GKrS4VbbwDuK+amVsESBwiKr3At7U4cbQanmK2ktKtWuguRcSTd1j3KWFNEvLMva5va/M5840l9yOXaXQpeiyqqaaeyrSebL6KtzUfVWzMTRj9czEGJ6hJHJdS7D2/QY9tcCYjL2tU0lvlIAgFN53O7BT+Mx1RcTh3/DxezzCXAJOg3jBwfZzDs7NnpncToTwxzkIL/fMYalnDq/0zEHrmcPdnjnc6xlhrWeEjQQ7cwjOYdXEfxkcnoO0lYRLauochHySqs3L7h9kPbG43oXFf9IFOssJFAAA";
69 private static final Log log = LogFactory.getLog(LocationMenuUI.class);
70 private static final long serialVersionUID = 1L;
71
72
73
74
75
76 protected List<Object> $activeBindings = new ArrayList<Object>();
77 protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
78 protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
79 protected Map<String, Object> $objectMap = new HashMap<String, Object>();
80 protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
81 private boolean allComponentsCreated;
82 protected final JAXXContext delegateContext = new DefaultJAXXContext();
83
84
85
86
87
88 protected ApplyFilterUI applyFilterUI;
89 protected DaliHelpBroker broker;
90 protected JButton clearButton;
91 protected ExtendedComboBox<GroupingDTO> groupingCombo;
92 protected JLabel groupingLabel;
93 protected ExtendedComboBox<GroupingTypeDTO> groupingTypeCombo;
94 protected final LocationMenuUIHandler handler = createHandler();
95 protected JLabel identifiantLabel;
96 protected JTextField labelEditor;
97 protected JPanel menuPanel;
98 protected LocationMenuUIModel model;
99 protected JTextField nameEditor;
100 protected JLabel nameLabel;
101 protected ExtendedComboBox<ProgramDTO> programCombo;
102 protected JLabel programLabel;
103 protected JButton searchButton;
104 protected JPanel selectionButtonsPanel;
105 protected Table selectionPanel;
106 protected ExtendedComboBox<StatusDTO> statusCombo;
107 protected JLabel statusLabel;
108
109
110
111
112
113 private LocationMenuUI $JPanel0 = this;
114 private JPanel $JPanel1;
115 private JPanel $JPanel2;
116 private JPanel $JPanel3;
117 private JPanel $JPanel4;
118 private JPanel $JPanel5;
119 private JPanel $JPanel6;
120
121
122
123
124
125 public LocationMenuUI(ApplicationUI parentUI) {
126 ApplicationUIUtil.setParentUI(this, parentUI);
127 $initialize();
128 }
129
130 public LocationMenuUI() {
131 $initialize();
132 }
133
134 public LocationMenuUI(JAXXContext parentContext) {
135 JAXXUtil.initContext(this, parentContext);
136 $initialize();
137 }
138
139 public LocationMenuUI(boolean param0) {
140 super(param0);
141 $initialize();
142 }
143
144 public LocationMenuUI(JAXXContext parentContext, boolean param1) {
145 super(param1);
146 JAXXUtil.initContext(this, parentContext);
147 $initialize();
148 }
149
150 public LocationMenuUI(LayoutManager param0) {
151 super(param0);
152 $initialize();
153 }
154
155 public LocationMenuUI(JAXXContext parentContext, LayoutManager param1) {
156 super(param1);
157 JAXXUtil.initContext(this, parentContext);
158 $initialize();
159 }
160
161 public LocationMenuUI(LayoutManager param0, boolean param1) {
162 super(param0 ,param1);
163 $initialize();
164 }
165
166 public LocationMenuUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
167 super(param1 ,param2);
168 JAXXUtil.initContext(this, parentContext);
169 $initialize();
170 }
171
172
173
174
175
176 public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
177 return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
178 }
179
180
181
182
183
184 @Override
185 public void applyDataBinding(String $binding) {
186 if (allComponentsCreated && $bindings.containsKey($binding)) {
187 getDataBinding($binding).applyDataBinding();
188 }
189 processDataBinding($binding);
190 }
191
192 @Override
193 public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
194 super.firePropertyChange(propertyName, oldValue, newValue);
195 }
196
197 @Override
198 public Map<String, Object> get$objectMap() {
199 return $objectMap;
200 }
201
202 @Override
203 public JAXXBinding getDataBinding(String bindingId) {
204 return $bindings.get(bindingId);
205 }
206
207 @Override
208 public JAXXBinding[] getDataBindings() {
209 return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
210 }
211
212 @Override
213 public Object getObjectById(String id) {
214 return $objectMap.get(id);
215 }
216
217 @Override
218 public void processDataBinding(String $binding, boolean $force) {
219 if (!$force && $activeBindings.contains($binding)) {
220 return;
221 }
222 $activeBindings.add($binding);
223 try {
224 if (allComponentsCreated && $bindings.containsKey($binding)) {
225 getDataBinding($binding).processDataBinding();
226 }
227 } finally {
228 $activeBindings.remove($binding);
229 }
230 }
231
232 @Override
233 public void processDataBinding(String $binding) {
234 processDataBinding($binding, false);
235 }
236
237 @Override
238 public void registerDataBinding(JAXXBinding binding) {
239 $bindings.put(binding.getId(), binding);
240 }
241
242 @Override
243 public void removeDataBinding(String $binding) {
244 if (allComponentsCreated && $bindings.containsKey($binding)) {
245 getDataBinding($binding).removeDataBinding();
246 }
247 }
248
249
250
251
252
253 @Override
254 public <T> T getContextValue(Class<T> clazz) {
255 return delegateContext.getContextValue(clazz, null);
256 }
257
258 @Override
259 public <T> T getContextValue(Class<T> clazz, String name) {
260 return delegateContext.getContextValue(clazz, name);
261 }
262
263 @Override
264 public JAXXContext getDelegateContext() {
265 return delegateContext;
266 }
267
268 @Override
269 public <O extends Container> O getParentContainer(Class<O> clazz) {
270 return SwingUtil.getParentContainer(this, clazz);
271 }
272
273 @Override
274 public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
275 return SwingUtil.getParentContainer(source, clazz);
276 }
277
278 @Override
279 public <T> void removeContextValue(Class<T> clazz) {
280 delegateContext.removeContextValue(clazz, null);
281 }
282
283 @Override
284 public <T> void removeContextValue(Class<T> clazz, String name) {
285 delegateContext.removeContextValue(clazz, name);
286 }
287
288 @Override
289 public <T> void setContextValue(T o) {
290 delegateContext.setContextValue(o, null);
291 }
292
293 @Override
294 public <T> void setContextValue(T o, String name) {
295 delegateContext.setContextValue(o, name);
296 }
297
298
299
300
301
302 public void doKeyReleased__on__labelEditor(KeyEvent event) {
303 if (log.isDebugEnabled()) {
304 log.debug(event);
305 }
306 handler.setText(event, "label");
307 }
308
309 public void doKeyReleased__on__nameEditor(KeyEvent event) {
310 if (log.isDebugEnabled()) {
311 log.debug(event);
312 }
313 handler.setText(event, "name");
314 }
315
316
317
318
319
320 public ApplyFilterUI getApplyFilterUI() {
321 return applyFilterUI;
322 }
323
324 public DaliHelpBroker getBroker() {
325 return broker;
326 }
327
328 public JButton getClearButton() {
329 return clearButton;
330 }
331
332 public ExtendedComboBox<GroupingDTO> getGroupingCombo() {
333 return groupingCombo;
334 }
335
336 public JLabel getGroupingLabel() {
337 return groupingLabel;
338 }
339
340 public ExtendedComboBox<GroupingTypeDTO> getGroupingTypeCombo() {
341 return groupingTypeCombo;
342 }
343
344 public LocationMenuUIHandler getHandler() {
345 return handler;
346 }
347
348 public JLabel getIdentifiantLabel() {
349 return identifiantLabel;
350 }
351
352 public JTextField getLabelEditor() {
353 return labelEditor;
354 }
355
356 public JPanel getMenuPanel() {
357 return menuPanel;
358 }
359
360 public LocationMenuUIModel getModel() {
361 return model;
362 }
363
364 public JTextField getNameEditor() {
365 return nameEditor;
366 }
367
368 public JLabel getNameLabel() {
369 return nameLabel;
370 }
371
372 public ExtendedComboBox<ProgramDTO> getProgramCombo() {
373 return programCombo;
374 }
375
376 public JLabel getProgramLabel() {
377 return programLabel;
378 }
379
380 public JButton getSearchButton() {
381 return searchButton;
382 }
383
384 public JPanel getSelectionButtonsPanel() {
385 return selectionButtonsPanel;
386 }
387
388 public Table getSelectionPanel() {
389 return selectionPanel;
390 }
391
392 public ExtendedComboBox<StatusDTO> getStatusCombo() {
393 return statusCombo;
394 }
395
396 public JLabel getStatusLabel() {
397 return statusLabel;
398 }
399
400
401
402
403
404 @Override
405 public void registerHelpId(DaliHelpBroker broker, Component component, String helpId) {
406 broker.installUI(component, helpId);
407 }
408
409 @Override
410 public void showHelp(String helpId) {
411 getBroker().showHelp(this, helpId);
412 }
413
414
415
416
417
418 protected JPanel get$JPanel1() {
419 return $JPanel1;
420 }
421
422 protected JPanel get$JPanel2() {
423 return $JPanel2;
424 }
425
426 protected JPanel get$JPanel3() {
427 return $JPanel3;
428 }
429
430 protected JPanel get$JPanel4() {
431 return $JPanel4;
432 }
433
434 protected JPanel get$JPanel5() {
435 return $JPanel5;
436 }
437
438 protected JPanel get$JPanel6() {
439 return $JPanel6;
440 }
441
442
443
444
445
446 protected void addChildrenToMenuPanel() {
447 if (!allComponentsCreated) {
448 return;
449 }
450 menuPanel.add(applyFilterUI);
451 menuPanel.add(selectionPanel);
452 menuPanel.add(selectionButtonsPanel);
453 }
454
455 protected void addChildrenToSelectionButtonsPanel() {
456 if (!allComponentsCreated) {
457 return;
458 }
459 selectionButtonsPanel.add(clearButton);
460 selectionButtonsPanel.add(searchButton);
461 }
462
463 protected void addChildrenToSelectionPanel() {
464 if (!allComponentsCreated) {
465 return;
466 }
467 selectionPanel.add($JPanel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
468 selectionPanel.add($JPanel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
469 selectionPanel.add($JPanel3, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
470 selectionPanel.add($JPanel4, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
471 selectionPanel.add($JPanel5, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
472 selectionPanel.add($JPanel6, new GridBagConstraints(0, 5, 1, 1, 0.0, 0.0, 10, 1, new Insets(3, 3, 3, 3), 0, 0));
473 }
474
475 protected void createApplyFilterUI() {
476 $objectMap.put("applyFilterUI", applyFilterUI = new ApplyFilterUI(this));
477
478 applyFilterUI.setName("applyFilterUI");
479 }
480
481 protected void createBroker() {
482 $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
483 }
484
485 protected void createClearButton() {
486 $objectMap.put("clearButton", clearButton = new JButton());
487
488 clearButton.setName("clearButton");
489 clearButton.setText(t("dali.action.search.clear.label"));
490 clearButton.setToolTipText(t("dali.action.search.clear.tip"));
491 clearButton.putClientProperty("applicationAction", ClearAction.class);
492 }
493
494 protected void createGroupingCombo() {
495 $objectMap.put("groupingCombo", groupingCombo = new ExtendedComboBox<GroupingDTO>(this));
496
497 groupingCombo.setName("groupingCombo");
498 groupingCombo.setFilterable(true);
499 groupingCombo.setShowDecorator(false);
500 groupingCombo.setProperty("grouping");
501 groupingCombo.setShowReset(true);
502 }
503
504 protected void createGroupingLabel() {
505 $objectMap.put("groupingLabel", groupingLabel = new JLabel());
506
507 groupingLabel.setName("groupingLabel");
508 groupingLabel.setText(t("dali.property.location.grouping"));
509 }
510
511 protected void createGroupingTypeCombo() {
512 $objectMap.put("groupingTypeCombo", groupingTypeCombo = new ExtendedComboBox<GroupingTypeDTO>(this));
513
514 groupingTypeCombo.setName("groupingTypeCombo");
515 groupingTypeCombo.setFilterable(true);
516 groupingTypeCombo.setShowDecorator(false);
517 groupingTypeCombo.setProperty("groupingType");
518 groupingTypeCombo.setShowReset(true);
519 }
520
521 protected LocationMenuUIHandler createHandler() {
522 return new LocationMenuUIHandler();
523 }
524
525 protected void createIdentifiantLabel() {
526 $objectMap.put("identifiantLabel", identifiantLabel = new JLabel());
527
528 identifiantLabel.setName("identifiantLabel");
529 identifiantLabel.setText(t("dali.property.label"));
530 }
531
532 protected void createLabelEditor() {
533 $objectMap.put("labelEditor", labelEditor = new JTextField());
534
535 labelEditor.setName("labelEditor");
536 labelEditor.setColumns(15);
537 labelEditor.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__labelEditor"));
538 }
539
540 protected void createMenuPanel() {
541 $objectMap.put("menuPanel", menuPanel = new JPanel());
542
543 menuPanel.setName("menuPanel");
544 menuPanel.setLayout(new BoxLayout(menuPanel, BoxLayout.PAGE_AXIS));
545 }
546
547 protected void createModel() {
548 $objectMap.put("model", model = getContextValue(LocationMenuUIModel.class));
549 }
550
551 protected void createNameEditor() {
552 $objectMap.put("nameEditor", nameEditor = new JTextField());
553
554 nameEditor.setName("nameEditor");
555 nameEditor.setColumns(15);
556 nameEditor.addKeyListener(JAXXUtil.getEventListener(KeyListener.class, "keyReleased", this, "doKeyReleased__on__nameEditor"));
557 }
558
559 protected void createNameLabel() {
560 $objectMap.put("nameLabel", nameLabel = new JLabel());
561
562 nameLabel.setName("nameLabel");
563 nameLabel.setText(t("dali.property.name"));
564 }
565
566 protected void createProgramCombo() {
567 $objectMap.put("programCombo", programCombo = new ExtendedComboBox<ProgramDTO>(this));
568
569 programCombo.setName("programCombo");
570 programCombo.setFilterable(true);
571 programCombo.setShowDecorator(false);
572 programCombo.setProperty("program");
573 programCombo.setShowReset(true);
574 }
575
576 protected void createProgramLabel() {
577 $objectMap.put("programLabel", programLabel = new JLabel());
578
579 programLabel.setName("programLabel");
580 programLabel.setText(t("dali.property.program"));
581 }
582
583 protected void createSearchButton() {
584 $objectMap.put("searchButton", searchButton = new JButton());
585
586 searchButton.setName("searchButton");
587 searchButton.setText(t("dali.action.search.label"));
588 searchButton.setToolTipText(t("dali.action.search.tip"));
589 searchButton.putClientProperty("applicationAction", SearchAction.class);
590 }
591
592 protected void createSelectionButtonsPanel() {
593 $objectMap.put("selectionButtonsPanel", selectionButtonsPanel = new JPanel());
594
595 selectionButtonsPanel.setName("selectionButtonsPanel");
596 selectionButtonsPanel.setLayout(new GridLayout(1,0));
597 }
598
599 protected void createSelectionPanel() {
600 $objectMap.put("selectionPanel", selectionPanel = new Table());
601
602 selectionPanel.setName("selectionPanel");
603 }
604
605 protected void createStatusCombo() {
606 $objectMap.put("statusCombo", statusCombo = new ExtendedComboBox<StatusDTO>(this));
607
608 statusCombo.setName("statusCombo");
609 statusCombo.setFilterable(true);
610 statusCombo.setShowDecorator(false);
611 statusCombo.setProperty("status");
612 statusCombo.setShowReset(true);
613 }
614
615 protected void createStatusLabel() {
616 $objectMap.put("statusLabel", statusLabel = new JLabel());
617
618 statusLabel.setName("statusLabel");
619 statusLabel.setText(t("dali.property.status"));
620 }
621
622
623
624
625
626 private void $completeSetup() {
627 allComponentsCreated = true;
628 if (log.isDebugEnabled()) {
629 log.debug(this);
630 }
631
632 add(menuPanel);
633 addChildrenToMenuPanel();
634 addChildrenToSelectionPanel();
635
636 $JPanel1.add(groupingLabel, BorderLayout.PAGE_START);
637 $JPanel1.add(groupingTypeCombo, BorderLayout.CENTER);
638
639 $JPanel2.add(groupingCombo, BorderLayout.CENTER);
640
641 $JPanel3.add(programLabel, BorderLayout.PAGE_START);
642 $JPanel3.add(programCombo, BorderLayout.CENTER);
643
644 $JPanel4.add(statusLabel, BorderLayout.PAGE_START);
645 $JPanel4.add(statusCombo, BorderLayout.CENTER);
646
647 $JPanel5.add(identifiantLabel, BorderLayout.PAGE_START);
648 $JPanel5.add(labelEditor);
649
650 $JPanel6.add(nameLabel, BorderLayout.PAGE_START);
651 $JPanel6.add(nameEditor);
652 addChildrenToSelectionButtonsPanel();
653
654
655 JAXXUtil.applyDataBinding(this, $bindings.keySet());
656
657
658 groupingTypeCombo.setBeanType(GroupingTypeDTO.class);
659 groupingCombo.setBeanType(GroupingDTO.class);
660 programCombo.setBeanType(ProgramDTO.class);
661 statusCombo.setBeanType(StatusDTO.class);
662 clearButton.setAlignmentX(Component.CENTER_ALIGNMENT);
663 searchButton.setAlignmentX(Component.CENTER_ALIGNMENT);
664 selectionPanel.setBorder(BorderFactory.createTitledBorder(t("dali.config.menu.title")));
665 groupingLabel.setLabelFor(groupingCombo);
666 groupingTypeCombo.setBean(model);
667 groupingCombo.setBean(model);
668 programLabel.setLabelFor(programCombo);
669 programCombo.setBean(model);
670 statusLabel.setLabelFor(statusCombo);
671 statusCombo.setBean(model);
672 identifiantLabel.setLabelFor(labelEditor);
673 nameLabel.setLabelFor(nameEditor);
674 clearButton.setIcon(SwingUtil.createActionIcon("reset"));
675 searchButton.setIcon(SwingUtil.createActionIcon("find"));
676 }
677
678 private void $initialize() {
679 if (allComponentsCreated) {
680 return;
681 }
682 if (log.isDebugEnabled()) {
683 log.debug(this);
684 }
685 handler.beforeInit(this);
686 $objectMap.put("$JPanel0", $JPanel0);
687 createModel();
688 createBroker();
689 createMenuPanel();
690 createApplyFilterUI();
691 createSelectionPanel();
692
693 $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
694
695 $JPanel1.setName("$JPanel1");
696 $JPanel1.setLayout(new BorderLayout());
697 createGroupingLabel();
698 createGroupingTypeCombo();
699
700 $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
701
702 $JPanel2.setName("$JPanel2");
703 $JPanel2.setLayout(new BorderLayout());
704 createGroupingCombo();
705
706 $objectMap.put("$JPanel3", $JPanel3 = new JPanel());
707
708 $JPanel3.setName("$JPanel3");
709 $JPanel3.setLayout(new BorderLayout());
710 createProgramLabel();
711 createProgramCombo();
712
713 $objectMap.put("$JPanel4", $JPanel4 = new JPanel());
714
715 $JPanel4.setName("$JPanel4");
716 $JPanel4.setLayout(new BorderLayout());
717 createStatusLabel();
718 createStatusCombo();
719
720 $objectMap.put("$JPanel5", $JPanel5 = new JPanel());
721
722 $JPanel5.setName("$JPanel5");
723 $JPanel5.setLayout(new BorderLayout());
724 createIdentifiantLabel();
725 createLabelEditor();
726
727 $objectMap.put("$JPanel6", $JPanel6 = new JPanel());
728
729 $JPanel6.setName("$JPanel6");
730 $JPanel6.setLayout(new BorderLayout());
731 createNameLabel();
732 createNameEditor();
733 createSelectionButtonsPanel();
734 createClearButton();
735 createSearchButton();
736
737 setName("$JPanel0");
738
739
740 $registerDefaultBindings();
741 $completeSetup();
742 handler.afterInit(this);
743 }
744
745 private void $registerDefaultBindings() {
746
747 registerDataBinding(new DefaultJAXXBinding(this, BINDING_GROUPING_TYPE_COMBO_SELECTED_ITEM, true) {
748
749 @Override
750 public void applyDataBinding() {
751 if (model != null) {
752 model.addPropertyChangeListener("groupingType", this);
753 }
754 }
755
756 @Override
757 public void processDataBinding() {
758 if (model != null) {
759 groupingTypeCombo.setSelectedItem(model.getGroupingType());
760 }
761 }
762
763 @Override
764 public void removeDataBinding() {
765 if (model != null) {
766 model.removePropertyChangeListener("groupingType", this);
767 }
768 }
769 });
770 registerDataBinding(new DefaultJAXXBinding(this, BINDING_GROUPING_COMBO_SELECTED_ITEM, true) {
771
772 @Override
773 public void applyDataBinding() {
774 if (model != null) {
775 model.addPropertyChangeListener("grouping", this);
776 }
777 }
778
779 @Override
780 public void processDataBinding() {
781 if (model != null) {
782 groupingCombo.setSelectedItem(model.getGrouping());
783 }
784 }
785
786 @Override
787 public void removeDataBinding() {
788 if (model != null) {
789 model.removePropertyChangeListener("grouping", this);
790 }
791 }
792 });
793 registerDataBinding(new DefaultJAXXBinding(this, BINDING_PROGRAM_COMBO_SELECTED_ITEM, true) {
794
795 @Override
796 public void applyDataBinding() {
797 if (model != null) {
798 model.addPropertyChangeListener("program", this);
799 }
800 }
801
802 @Override
803 public void processDataBinding() {
804 if (model != null) {
805 programCombo.setSelectedItem(model.getProgram());
806 }
807 }
808
809 @Override
810 public void removeDataBinding() {
811 if (model != null) {
812 model.removePropertyChangeListener("program", this);
813 }
814 }
815 });
816 registerDataBinding(new DefaultJAXXBinding(this, BINDING_STATUS_COMBO_SELECTED_ITEM, true) {
817
818 @Override
819 public void applyDataBinding() {
820 if (model != null) {
821 model.addPropertyChangeListener("status", this);
822 }
823 }
824
825 @Override
826 public void processDataBinding() {
827 if (model != null) {
828 statusCombo.setSelectedItem(model.getStatus());
829 }
830 }
831
832 @Override
833 public void removeDataBinding() {
834 if (model != null) {
835 model.removePropertyChangeListener("status", this);
836 }
837 }
838 });
839 registerDataBinding(new DefaultJAXXBinding(this, BINDING_LABEL_EDITOR_TEXT, true) {
840
841 @Override
842 public void applyDataBinding() {
843 if (model != null) {
844 model.addPropertyChangeListener("label", this);
845 }
846 }
847
848 @Override
849 public void processDataBinding() {
850 if (model != null) {
851 SwingUtil.setText(labelEditor, model.getLabel());
852 }
853 }
854
855 @Override
856 public void removeDataBinding() {
857 if (model != null) {
858 model.removePropertyChangeListener("label", this);
859 }
860 }
861 });
862 registerDataBinding(new DefaultJAXXBinding(this, BINDING_NAME_EDITOR_TEXT, true) {
863
864 @Override
865 public void applyDataBinding() {
866 if (model != null) {
867 model.addPropertyChangeListener("name", this);
868 }
869 }
870
871 @Override
872 public void processDataBinding() {
873 if (model != null) {
874 SwingUtil.setText(nameEditor, model.getName());
875 }
876 }
877
878 @Override
879 public void removeDataBinding() {
880 if (model != null) {
881 model.removePropertyChangeListener("name", this);
882 }
883 }
884 });
885 }
886
887 }