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