View Javadoc
1   package fr.ifremer.dali.ui.swing.content.manage.filter.list;
2   
3   import fr.ifremer.dali.dto.configuration.filter.FilterDTO;
4   import fr.ifremer.dali.ui.swing.DaliHelpBroker;
5   import fr.ifremer.dali.ui.swing.DaliUIContext;
6   import fr.ifremer.dali.ui.swing.util.DaliUI;
7   import fr.ifremer.quadrige3.ui.swing.ApplicationUI;
8   import fr.ifremer.quadrige3.ui.swing.ApplicationUIUtil;
9   import fr.ifremer.quadrige3.ui.swing.component.bean.ExtendedComboBox;
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.GridLayout;
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.JLabel;
28  import javax.swing.JPanel;
29  import javax.swing.JScrollPane;
30  import javax.swing.SwingConstants;
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 org.apache.commons.logging.Log;
40  import org.apache.commons.logging.LogFactory;
41  import static org.nuiton.i18n.I18n.t;
42  
43  public class FilterListUI extends JPanel implements DaliUI<FilterListUIModel, FilterListUIHandler>, JAXXObject {
44  
45      /*-----------------------------------------------------------------------*/
46      /*------------------ Constants for all public bindings ------------------*/
47      /*-----------------------------------------------------------------------*/
48  
49      public static final String BINDING_DELETE_BUTTON_ENABLED = "deleteButton.enabled";
50      public static final String BINDING_DUPLICATE_BUTTON_ENABLED = "duplicateButton.enabled";
51      public static final String BINDING_EXPORT_BUTTON_ENABLED = "exportButton.enabled";
52  
53      /*-----------------------------------------------------------------------*/
54      /*------------------------- Other static fields -------------------------*/
55      /*-----------------------------------------------------------------------*/
56  
57      private static final String $jaxxObjectDescriptor = "H4sIAAAAAAAAAK1XzW8bRRQfO3E+nKQpSZuGNinOB2lymbRUCKQQmuaLJqQU4iBF5ADj3bEzZb27nR2TDVYRfwJ/Aty5IHHjhDhwgQMHLogbZ4Q4cEW8mbF31856vYqJlI09781v3vu9t783+fpPlPM4mntKfB/zmi1YleL9h8fHT0pPqSG2qWdw5gqHI/2TyaLsCRoxg3VPoIWTA7l9tbF9dcupuo5N7cjutQOU98S5Rb1TSoVAs607DM9bLQbmNd+t8SZqEFQc6pd//5X9wvz8qyxCvgvRTUEqhW67wkz6D1CWmQJNwEmfkFWL2BUIgzO7AvGOybUti3jeO6RKn6HP0OABGnAJBzCB5tOnrDDUft8VaLTMLEH5AfPE+3sCbZQ5ZmVOq5Rjk1gM1xj2ziACbDi2AEBcJTapUKy3YQv24d0IhOsq7AGBclXHpJZAO71CPpY4Ie5AiTsfUy7QnY7A2/DtEezZVJ7h1qHF/XeJTa27wLGk02/461XpNBz4Dlu0LIL1a/IxERqr1K61Gq8HxpEGpaQk0289SC1KvxuBe6MCHtSs5Ai0HsnqWY2YnFXo/ShnjcriEiU23vGBQZOaavOm47dBl2pCOLbXMVLDooRvKieBJlsi1avS8aUQzwN34zQ0LbTa84KULNp6Wsjo2OJ+0eCOZUkHKMGNlvNCk3RfCttIYQqEk3lRXrgoPx/Jj3L3chi4K2PScXtBaEsXGuNeYMNhrW161pbx3cA4btZcixlE0I4uo9C9NMHePPuVmLNHGVSbi7a9r4d26sfbObrVojugaDhUtFByMicox2uwLND0yUURPASTlr/pNvmTgMr679Tkr9/9/u1uU/MKcPb1WNeIZIMWudxx4S1m8uhxLXg1wazVx8RdO0HDHpBmaD2fiQms2DBDcHDeC3I7ltvxI+KdAkRu8Lfvf5j66Jc+lN1Fecsh5i6R/ntoWJxyYMGxTN99sKEiGj0bgudV+O2DHtavo266fsFr8GcM/M+2qeFwAhjQk2ViebA+LNcPqSdHiHL1gamZGKaCcEvDP/4zWfxmo8lWBqJ/saN7yFjuAzTAbIvZVM2IhvzHzoQR16M10wllPk74EUj/1XbxaAjllnq+dYGcjNReh5tSex/UN9Unzeo5NjiFd+CICYua2rIslueVKoPKl1kFS8XEQjrMr6w892vyjCeKAfnpPRQVVbdLJFl4ayyppLuyGlfqUQV9LktBfajIgjq+MVXCMRfMGQkQF0dUv7tF0g8C/yFxtQYwx35oyKdA1+pFJZX6OzYk9RBZnqjve3Lyof4ys80g2mkVrbZjrbM6RAhIOI51xNwj5TgV4yiYG5dJi15fNpXJ+pacEkmZ5HjzHVAR3o6JUE2a+IRmOrp3SCs6trplFW3anfRNe7FrEls3Mvi6BdTXxl0fMcMmGG+8MdUqUAFzp52q2x2CA9dOZIXjq1tkuQ4NMFvfbg45fS1LbGrDcc+DfG5FSxuMyvg2KMT7NpKF7AQapLbkGfh6uz6nrpe4QoVWS2oeOmfe8gpm3k7VFefLK4WlpUInJ499SsFjfb1wL7ag7XP9stzdrG+r6d+duAF9TQiom4i2QtPWythch27Q3u2ULaagLJaLlgvMZVXkZn1PXWVSEKHvPPFENG3piNDeHdUxerm6fIF3/JR56btafF5NW7q8tPf/V+DoLTKNoFrk3AFndOUNkwhSKMEcg3v3mxewM/KZ74ool3+Sj5/jEaZ6RphOkdWQ/Ifq6NylCTizPUdSSBFJHqpeseE2JI4TkOZTxfJHAsLLPWdzp2eE1Z6zuN8zwqs9I7zWM8JazwjrKTqrnxn6/8Reeioz1GtPJSKkqmciQqp6JiKkqmciQqp6JiLIev4H54iGpA8VAAA=";
58      private static final Log log = LogFactory.getLog(FilterListUI.class);
59      private static final long serialVersionUID = 1L;
60  
61      /*-----------------------------------------------------------------------*/
62      /*--------------------------- Internal states ---------------------------*/
63      /*-----------------------------------------------------------------------*/
64  
65      protected List<Object> $activeBindings = new ArrayList<Object>();
66      protected Map<String, Object> $bindingSources = new HashMap<String, Object>();
67      protected final Map<String, JAXXBinding> $bindings = new TreeMap<String, JAXXBinding>();
68      protected Map<String, Object> $objectMap = new HashMap<String, Object>();
69      protected Map<?, ?> $previousValues = new HashMap<Object, Object>();
70      private boolean allComponentsCreated;
71      protected final JAXXContext delegateContext = new DefaultJAXXContext();
72  
73      /*-----------------------------------------------------------------------*/
74      /*------------------------ Protected components  ------------------------*/
75      /*-----------------------------------------------------------------------*/
76  
77      protected DaliHelpBroker broker;
78      protected JPanel buttonsPanel;
79      protected JButton clearButton;
80      protected JButton deleteButton;
81      protected JButton duplicateButton;
82      protected JButton exportButton;
83      protected JLabel filterLabel;
84      protected FilterListUI filterListUI = this;
85      protected ExtendedComboBox<FilterDTO> filtersCombo;
86      protected final FilterListUIHandler handler = createHandler();
87      protected JButton importButton;
88      protected JPanel leftPanel;
89      protected JPanel menuPanel;
90      protected FilterListUIModel model;
91      protected JButton newButton;
92      protected JPanel panelButtons;
93      protected JButton searchButton;
94      protected SwingTable table;
95      protected JPanel tablePanel;
96  
97      /*-----------------------------------------------------------------------*/
98      /*------------------------- Private components  -------------------------*/
99      /*-----------------------------------------------------------------------*/
100 
101     private JPanel $JPanel0;
102     private JPanel $JPanel1;
103     private JPanel $JPanel2;
104     private JScrollPane $JScrollPane0;
105 
106     /*-----------------------------------------------------------------------*/
107     /*---------------------------- Constructors  ----------------------------*/
108     /*-----------------------------------------------------------------------*/
109 
110     public FilterListUI(ApplicationUI parentUI) {
111         ApplicationUIUtil.setParentUI(this, parentUI);
112             $initialize();
113     }
114 
115     public FilterListUI() {
116         $initialize();
117     }
118 
119     public FilterListUI(JAXXContext parentContext) {
120         JAXXUtil.initContext(this, parentContext);
121         $initialize();
122     }
123 
124     public FilterListUI(boolean param0) {
125         super(param0);
126         $initialize();
127     }
128 
129     public FilterListUI(JAXXContext parentContext, boolean param1) {
130         super(param1);
131         JAXXUtil.initContext(this, parentContext);
132         $initialize();
133     }
134 
135     public FilterListUI(LayoutManager param0) {
136         super(param0);
137         $initialize();
138     }
139 
140     public FilterListUI(JAXXContext parentContext, LayoutManager param1) {
141         super(param1);
142         JAXXUtil.initContext(this, parentContext);
143         $initialize();
144     }
145 
146     public FilterListUI(LayoutManager param0, boolean param1) {
147         super(param0 ,param1);
148         $initialize();
149     }
150 
151     public FilterListUI(JAXXContext parentContext, LayoutManager param1, boolean param2) {
152         super(param1 ,param2);
153         JAXXUtil.initContext(this, parentContext);
154         $initialize();
155     }
156 
157     /*-----------------------------------------------------------------------*/
158     /*--------------------------- Statics methods ---------------------------*/
159     /*-----------------------------------------------------------------------*/
160 
161     public static JAXXObjectDescriptor $getJAXXObjectDescriptor() {
162         return JAXXUtil.decodeCompressedJAXXObjectDescriptor($jaxxObjectDescriptor);
163     }
164 
165     /*-----------------------------------------------------------------------*/
166     /*---------------------- JAXXObject implementation ----------------------*/
167     /*-----------------------------------------------------------------------*/
168 
169     @Override
170     public void applyDataBinding(String $binding) {
171         if (allComponentsCreated && $bindings.containsKey($binding)) {
172             getDataBinding($binding).applyDataBinding();
173         }
174         processDataBinding($binding);
175     }
176 
177     @Override
178     public void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
179         super.firePropertyChange(propertyName, oldValue, newValue);
180     }
181 
182     @Override
183     public Map<String, Object> get$objectMap() {
184         return $objectMap;
185     }
186 
187     @Override
188     public JAXXBinding getDataBinding(String bindingId) {
189         return $bindings.get(bindingId);
190     }
191 
192     @Override
193     public JAXXBinding[] getDataBindings() {
194         return $bindings.values().toArray(new JAXXBinding[$bindings.size()]);
195     }
196 
197     @Override
198     public Object getObjectById(String id) {
199         return $objectMap.get(id);
200     }
201 
202     @Override
203     public void processDataBinding(String $binding, boolean $force) {
204         if (!$force && $activeBindings.contains($binding)) { 
205             return;
206         }
207         $activeBindings.add($binding);
208         try {
209             if (allComponentsCreated && $bindings.containsKey($binding)) {
210                 getDataBinding($binding).processDataBinding();
211             }
212         } finally {
213             $activeBindings.remove($binding);
214         }
215     }
216 
217     @Override
218     public void processDataBinding(String $binding) {
219         processDataBinding($binding, false);
220     }
221 
222     @Override
223     public void registerDataBinding(JAXXBinding binding) {
224         $bindings.put(binding.getId(), binding);
225     }
226 
227     @Override
228     public void removeDataBinding(String $binding) {
229         if (allComponentsCreated && $bindings.containsKey($binding)) {
230             getDataBinding($binding).removeDataBinding();
231         }
232     }
233 
234     /*-----------------------------------------------------------------------*/
235     /*--------------------- JAXXContext implementation  ---------------------*/
236     /*-----------------------------------------------------------------------*/
237 
238     @Override
239     public <T> T getContextValue(Class<T> clazz) {
240         return delegateContext.getContextValue(clazz, null);
241     }
242 
243     @Override
244     public <T> T getContextValue(Class<T> clazz, String name) {
245         return delegateContext.getContextValue(clazz, name);
246     }
247 
248     @Override
249     public JAXXContext getDelegateContext() {
250         return delegateContext;
251     }
252 
253     @Override
254     public <O extends Container> O getParentContainer(Class<O> clazz) {
255         return SwingUtil.getParentContainer(this, clazz);
256     }
257 
258     @Override
259     public <O extends Container> O getParentContainer(Object source, Class<O> clazz) {
260         return SwingUtil.getParentContainer(source, clazz);
261     }
262 
263     @Override
264     public <T> void removeContextValue(Class<T> clazz) {
265         delegateContext.removeContextValue(clazz, null);
266     }
267 
268     @Override
269     public <T> void removeContextValue(Class<T> clazz, String name) {
270         delegateContext.removeContextValue(clazz, name);
271     }
272 
273     @Override
274     public <T> void setContextValue(T o) {
275         delegateContext.setContextValue(o, null);
276     }
277 
278     @Override
279     public <T> void setContextValue(T o, String name) {
280         delegateContext.setContextValue(o, name);
281     }
282 
283     /*-----------------------------------------------------------------------*/
284     /*---------------------------- Event methods ----------------------------*/
285     /*-----------------------------------------------------------------------*/
286 
287     public void doActionPerformed__on__newButton(ActionEvent event) {
288         if (log.isDebugEnabled()) {
289             log.debug(event);
290         }
291         model.addNewRow();
292     }
293 
294     /*-----------------------------------------------------------------------*/
295     /*----------------------- Public acessor methods  -----------------------*/
296     /*-----------------------------------------------------------------------*/
297 
298     public DaliHelpBroker getBroker() {
299         return broker;
300     }
301 
302     public JPanel getButtonsPanel() {
303         return buttonsPanel;
304     }
305 
306     public JButton getClearButton() {
307         return clearButton;
308     }
309 
310     public JButton getDeleteButton() {
311         return deleteButton;
312     }
313 
314     public JButton getDuplicateButton() {
315         return duplicateButton;
316     }
317 
318     public JButton getExportButton() {
319         return exportButton;
320     }
321 
322     public JLabel getFilterLabel() {
323         return filterLabel;
324     }
325 
326     public ExtendedComboBox<FilterDTO> getFiltersCombo() {
327         return filtersCombo;
328     }
329 
330     public FilterListUIHandler getHandler() {
331         return handler;
332     }
333 
334     public JButton getImportButton() {
335         return importButton;
336     }
337 
338     public JPanel getLeftPanel() {
339         return leftPanel;
340     }
341 
342     public JPanel getMenuPanel() {
343         return menuPanel;
344     }
345 
346     public FilterListUIModel getModel() {
347         return model;
348     }
349 
350     public JButton getNewButton() {
351         return newButton;
352     }
353 
354     public JPanel getPanelButtons() {
355         return panelButtons;
356     }
357 
358     public JButton getSearchButton() {
359         return searchButton;
360     }
361 
362     public SwingTable getTable() {
363         return table;
364     }
365 
366     public JPanel getTablePanel() {
367         return tablePanel;
368     }
369 
370     /*-----------------------------------------------------------------------*/
371     /*--------------------- Protected acessors methods  ---------------------*/
372     /*-----------------------------------------------------------------------*/
373 
374     protected JPanel get$JPanel0() {
375         return $JPanel0;
376     }
377 
378     protected JPanel get$JPanel1() {
379         return $JPanel1;
380     }
381 
382     protected JPanel get$JPanel2() {
383         return $JPanel2;
384     }
385 
386     protected JScrollPane get$JScrollPane0() {
387         return $JScrollPane0;
388     }
389 
390     /*-----------------------------------------------------------------------*/
391     /*--------------------- Components creation methods ---------------------*/
392     /*-----------------------------------------------------------------------*/
393 
394     protected void addChildrenToButtonsPanel() {
395         if (!allComponentsCreated) {
396             return;
397         }
398         buttonsPanel.add(clearButton);
399         buttonsPanel.add(searchButton);
400     }
401 
402     protected void addChildrenToFilterListUI() {
403         if (!allComponentsCreated) {
404             return;
405         }
406         add($JPanel0, BorderLayout.LINE_START);
407         add(tablePanel, BorderLayout.CENTER);
408     }
409 
410     protected void addChildrenToLeftPanel() {
411         if (!allComponentsCreated) {
412             return;
413         }
414         leftPanel.add(menuPanel);
415         leftPanel.add(buttonsPanel);
416     }
417 
418     protected void addChildrenToMenuPanel() {
419         if (!allComponentsCreated) {
420             return;
421         }
422         menuPanel.add(filterLabel, BorderLayout.PAGE_START);
423         menuPanel.add(filtersCombo);
424     }
425 
426     protected void addChildrenToPanelButtons() {
427         if (!allComponentsCreated) {
428             return;
429         }
430         panelButtons.add($JPanel1, BorderLayout.LINE_START);
431         panelButtons.add($JPanel2, BorderLayout.LINE_END);
432     }
433 
434     protected void addChildrenToTablePanel() {
435         if (!allComponentsCreated) {
436             return;
437         }
438         tablePanel.add($JScrollPane0);
439         tablePanel.add(panelButtons, BorderLayout.PAGE_END);
440     }
441 
442     protected void createBroker() {
443         $objectMap.put("broker", broker = new DaliHelpBroker("dali.home.help"));
444     }
445 
446     protected void createButtonsPanel() {
447         $objectMap.put("buttonsPanel", buttonsPanel = new JPanel());
448         
449         buttonsPanel.setName("buttonsPanel");
450         buttonsPanel.setLayout(new GridLayout(1,0));
451     }
452 
453     protected void createClearButton() {
454         $objectMap.put("clearButton", clearButton = new JButton());
455         
456         clearButton.setName("clearButton");
457         clearButton.setText(t("dali.action.search.clear.label"));
458         clearButton.setToolTipText(t("dali.action.search.clear.tip"));
459         clearButton.putClientProperty("applicationAction", ClearAction.class);
460     }
461 
462     protected void createDeleteButton() {
463         $objectMap.put("deleteButton", deleteButton = new JButton());
464         
465         deleteButton.setName("deleteButton");
466         deleteButton.setText(t("dali.common.delete"));
467         deleteButton.setToolTipText(t("dali.filter.filterList.delete.tip"));
468         deleteButton.putClientProperty("applicationAction", DeleteFilterAction.class);
469     }
470 
471     protected void createDuplicateButton() {
472         $objectMap.put("duplicateButton", duplicateButton = new JButton());
473         
474         duplicateButton.setName("duplicateButton");
475         duplicateButton.setText(t("dali.action.duplicate.label"));
476         duplicateButton.setToolTipText(t("dali.action.duplicate.filter.tip"));
477         duplicateButton.putClientProperty("applicationAction", DuplicateFilterAction.class);
478     }
479 
480     protected void createExportButton() {
481         $objectMap.put("exportButton", exportButton = new JButton());
482         
483         exportButton.setName("exportButton");
484         exportButton.setText(t("dali.common.export"));
485         exportButton.setToolTipText(t("dali.filter.filterList.export.tip"));
486         exportButton.putClientProperty("applicationAction", ExportFilterAction.class);
487     }
488 
489     protected void createFilterLabel() {
490         $objectMap.put("filterLabel", filterLabel = new JLabel());
491         
492         filterLabel.setName("filterLabel");
493         filterLabel.setText(t("dali.filter.filterList.filter.label"));
494     }
495 
496     protected void createFiltersCombo() {
497         $objectMap.put("filtersCombo", filtersCombo = new ExtendedComboBox<FilterDTO>(this));
498         
499         filtersCombo.setName("filtersCombo");
500         filtersCombo.setFilterable(true);
501         filtersCombo.setShowDecorator(false);
502         filtersCombo.setShowReset(true);
503     }
504 
505     protected FilterListUIHandler createHandler() {
506         return new FilterListUIHandler();
507     }
508 
509     protected void createImportButton() {
510         $objectMap.put("importButton", importButton = new JButton());
511         
512         importButton.setName("importButton");
513         importButton.setText(t("dali.common.import"));
514         importButton.setToolTipText(t("dali.filter.filterList.import.tip"));
515         importButton.putClientProperty("applicationAction", ImportFilterAction.class);
516     }
517 
518     protected void createLeftPanel() {
519         $objectMap.put("leftPanel", leftPanel = new JPanel());
520         
521         leftPanel.setName("leftPanel");
522         leftPanel.setLayout(new BoxLayout(leftPanel, BoxLayout.PAGE_AXIS));
523     }
524 
525     protected void createMenuPanel() {
526         $objectMap.put("menuPanel", menuPanel = new JPanel());
527         
528         menuPanel.setName("menuPanel");
529         menuPanel.setLayout(new BorderLayout());
530     }
531 
532     protected void createModel() {
533         $objectMap.put("model", model = getContextValue(FilterListUIModel.class));
534     }
535 
536     protected void createNewButton() {
537         $objectMap.put("newButton", newButton = new JButton());
538         
539         newButton.setName("newButton");
540         newButton.setText(t("dali.common.new"));
541         newButton.setToolTipText(t("dali.filter.filterList.new.tip"));
542         newButton.addActionListener(JAXXUtil.getEventListener(ActionListener.class, "actionPerformed", this, "doActionPerformed__on__newButton"));
543     }
544 
545     protected void createPanelButtons() {
546         $objectMap.put("panelButtons", panelButtons = new JPanel());
547         
548         panelButtons.setName("panelButtons");
549         panelButtons.setLayout(new BorderLayout());
550     }
551 
552     protected void createSearchButton() {
553         $objectMap.put("searchButton", searchButton = new JButton());
554         
555         searchButton.setName("searchButton");
556         searchButton.setText(t("dali.action.search.label"));
557         searchButton.setToolTipText(t("dali.action.search.tip"));
558         searchButton.putClientProperty("applicationAction", SearchAction.class);
559     }
560 
561     protected void createTable() {
562         $objectMap.put("table", table = new SwingTable());
563         
564         table.setName("table");
565     }
566 
567     protected void createTablePanel() {
568         $objectMap.put("tablePanel", tablePanel = new JPanel());
569         
570         tablePanel.setName("tablePanel");
571         tablePanel.setLayout(new BorderLayout());
572     }
573 
574     /*-----------------------------------------------------------------------*/
575     /*------------------------ Internal jaxx methods ------------------------*/
576     /*-----------------------------------------------------------------------*/
577 
578     private void $completeSetup() {
579         allComponentsCreated = true;
580         if (log.isDebugEnabled()) {
581             log.debug(this);
582         }
583         addChildrenToFilterListUI();
584         // inline complete setup of $JPanel0
585         $JPanel0.add(leftPanel);
586         addChildrenToLeftPanel();
587         addChildrenToMenuPanel();
588         addChildrenToButtonsPanel();
589         addChildrenToTablePanel();
590         // inline complete setup of $JScrollPane0
591         $JScrollPane0.getViewport().add(table);
592         addChildrenToPanelButtons();
593         // inline complete setup of $JPanel1
594         $JPanel1.add(newButton);
595         $JPanel1.add(duplicateButton);
596         $JPanel1.add(deleteButton);
597         // inline complete setup of $JPanel2
598         $JPanel2.add(importButton);
599         $JPanel2.add(exportButton);
600         
601         // apply 3 data bindings
602         JAXXUtil.applyDataBinding(this, $bindings.keySet());
603         
604         // apply 24 property setters
605         filtersCombo.setBeanType(FilterDTO.class);
606         clearButton.setAlignmentX(Component.CENTER_ALIGNMENT);
607         searchButton.setAlignmentX(Component.CENTER_ALIGNMENT);
608         newButton.setAlignmentX(Component.CENTER_ALIGNMENT);
609         duplicateButton.setAlignmentX(Component.CENTER_ALIGNMENT);
610         deleteButton.setAlignmentX(Component.CENTER_ALIGNMENT);
611         importButton.setAlignmentX(Component.CENTER_ALIGNMENT);
612         exportButton.setAlignmentX(Component.CENTER_ALIGNMENT);
613         menuPanel.setBorder(BorderFactory.createTitledBorder(t("dali.config.menu.title")));
614         filterLabel.setLabelFor(filtersCombo);
615         clearButton.setIcon(SwingUtil.createActionIcon("reset"));
616         searchButton.setIcon(SwingUtil.createActionIcon("find"));
617         tablePanel.setBorder(BorderFactory.createTitledBorder(t("dali.filter.filterList.title")));
618         newButton.setIcon(SwingUtil.createActionIcon("add"));
619         duplicateButton.setIcon(SwingUtil.createActionIcon("copy"));
620         deleteButton.setIcon(SwingUtil.createActionIcon("delete"));
621         importButton.setIcon(SwingUtil.createActionIcon("import"));
622         exportButton.setIcon(SwingUtil.createActionIcon("export"));
623     }
624 
625     private void $initialize() {
626         if (allComponentsCreated) {
627             return;
628         }
629         if (log.isDebugEnabled()) {
630             log.debug(this);
631         }
632         handler.beforeInit(this);
633         $objectMap.put("filterListUI", filterListUI);
634         createModel();
635         createBroker();
636         // inline creation of $JPanel0
637         $objectMap.put("$JPanel0", $JPanel0 = new JPanel());
638         
639         $JPanel0.setName("$JPanel0");
640         createLeftPanel();
641         createMenuPanel();
642         createFilterLabel();
643         createFiltersCombo();
644         createButtonsPanel();
645         createClearButton();
646         createSearchButton();
647         createTablePanel();
648         // inline creation of $JScrollPane0
649         $objectMap.put("$JScrollPane0", $JScrollPane0 = new JScrollPane());
650         
651         $JScrollPane0.setName("$JScrollPane0");
652         createTable();
653         createPanelButtons();
654         // inline creation of $JPanel1
655         $objectMap.put("$JPanel1", $JPanel1 = new JPanel());
656         
657         $JPanel1.setName("$JPanel1");
658         createNewButton();
659         createDuplicateButton();
660         createDeleteButton();
661         // inline creation of $JPanel2
662         $objectMap.put("$JPanel2", $JPanel2 = new JPanel());
663         
664         $JPanel2.setName("$JPanel2");
665         createImportButton();
666         createExportButton();
667         // inline creation of filterListUI
668         setName("filterListUI");
669         setLayout(new BorderLayout());
670         
671         // registers 3 data bindings
672         $registerDefaultBindings();
673         $completeSetup();
674         handler.afterInit(this);
675     }
676 
677     private void $registerDefaultBindings() {
678         // register 3 data bindings
679         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DUPLICATE_BUTTON_ENABLED, true) {
680         
681             @Override
682             public void applyDataBinding() {
683                 if (model != null) {
684                     model.addPropertyChangeListener("selectedRows", this);
685                 }
686             }
687         
688             @Override
689             public void processDataBinding() {
690                 if (model != null && model.getSelectedRows() != null) {
691                     duplicateButton.setEnabled(!model.getSelectedRows().isEmpty() && model.getSelectedRows().size() == 1);
692                 }
693             }
694         
695             @Override
696             public void removeDataBinding() {
697                 if (model != null) {
698                     model.removePropertyChangeListener("selectedRows", this);
699                 }
700             }
701         });
702         registerDataBinding(new DefaultJAXXBinding(this, BINDING_DELETE_BUTTON_ENABLED, true) {
703         
704             @Override
705             public void applyDataBinding() {
706                 if (model != null) {
707                     model.addPropertyChangeListener("selectedRows", this);
708                 }
709             }
710         
711             @Override
712             public void processDataBinding() {
713                 if (model != null && model.getSelectedRows() != null) {
714                     deleteButton.setEnabled(!model.getSelectedRows().isEmpty());
715                 }
716             }
717         
718             @Override
719             public void removeDataBinding() {
720                 if (model != null) {
721                     model.removePropertyChangeListener("selectedRows", this);
722                 }
723             }
724         });
725         registerDataBinding(new DefaultJAXXBinding(this, BINDING_EXPORT_BUTTON_ENABLED, true) {
726         
727             @Override
728             public void applyDataBinding() {
729                 if (model != null) {
730                     model.addPropertyChangeListener("selectedRows", this);
731                 }
732             }
733         
734             @Override
735             public void processDataBinding() {
736                 if (model != null && model.getSelectedRows() != null) {
737                     exportButton.setEnabled(!model.getSelectedRows().isEmpty());
738                 }
739             }
740         
741             @Override
742             public void removeDataBinding() {
743                 if (model != null) {
744                     model.removePropertyChangeListener("selectedRows", this);
745                 }
746             }
747         });
748     }
749 
750 }