1 | public class ActionComboBoxRenderer extends DefaultListCellRenderer {↵ | | 1 | public class CriteriaComboBoxRenderer extends DefaultListCellRenderer {↵
|
2 | protected IExtensionHandler pluginHandler;↵ | | 2 | protected IExtensionHandler pluginHandler;↵
|
|
3 | /**↵ | | 3 | /**↵
|
4 | * ↵ | | 4 | * ↵
|
5 | */↵ | | 5 | */↵
|
6 | public ActionComboBoxRenderer() {↵ | | 6 | public CriteriaComboBoxRenderer() {↵
|
7 | super();↵ | | 7 | super();↵
|
|
8 | try {↵ | | 8 | try {↵
|
9 | pluginHandler = PluginManager↵ | | 9 | pluginHandler = PluginManager↵
|
10 | .getInstance()↵ | | 10 | .getInstance()↵
|
11 | .getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_MAIL_FILTERACTION);↵ | | 11 | .getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_MAIL_FILTER);↵
|
12 | } catch (PluginHandlerNotFoundException ex) {↵ | | 12 | } catch (PluginHandlerNotFoundException ex) {↵
|
13 | ErrorDialog.createDialog(ex.getMessage(), ex);↵ | | 13 | ErrorDialog.createDialog(ex.getMessage(), ex);↵
|
14 | }↵ | | 14 | }↵
|
15 | }↵ | | 15 | }↵
|
|
16 | /*↵ | | 16 | /*↵
|
17 | * (non-Javadoc)↵ | | 17 | * (non-Javadoc)↵
|
18 | * ↵ | | 18 | * ↵
|
19 | * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList,↵ | | 19 | * @see javax.swing.ListCellRenderer#getListCellRendererComponent(javax.swing.JList,↵
|
20 | * java.lang.Object, int, boolean, boolean)↵ | | 20 | * java.lang.Object, int, boolean, boolean)↵
|
21 | */↵ | | 21 | */↵
|
22 | public Component getListCellRendererComponent(JList list, Object value,↵ | | 22 | public Component getListCellRendererComponent(JList list, Object value,↵
|
23 | int index, boolean isSelected, boolean cellHasFocus) {↵ | | 23 | int index, boolean isSelected, boolean cellHasFocus) {↵
|
24 | if (cellHasFocus) {↵ | | 24 | if (isSelected) {↵
|
25 | setBackground(list.getSelectionBackground());↵ | | 25 | setBackground(list.getSelectionBackground());↵
|
26 | setForeground(list.getSelectionForeground());↵ | | 26 | setForeground(list.getSelectionForeground());↵
|
27 | } else {↵ | | 27 | } else {↵
|
28 | setBackground(list.getBackground());↵ | | 28 | setBackground(list.getBackground());↵
|
29 | setForeground(list.getForeground());↵ | | 29 | setForeground(list.getForeground());↵
|
30 | }↵ | | 30 | }↵
|
|
31 | setBorder((cellHasFocus) ? UIManager↵ | | 31 | setBorder((cellHasFocus) ? UIManager↵
|
32 | .getBorder("List.focusCellHighlightBorder") : noFocusBorder);↵ | | 32 | .getBorder("List.focusCellHighlightBorder") : noFocusBorder);↵
|
|
33 | // id = org.columba.example.HelloWorld$HelloWorldPlugin↵ | | 33 | // id = org.columba.example.HelloWorld$HelloWorldPlugin↵
|
34 | String id = (String) value;↵ | | 34 | String id = (String) value;↵
|
|
35 | //String userVisibleName = pluginHandler.getUserVisibleName(id);↵ | | 35 | // String userVisibleName = pluginHandler.getUserVisibleName(id);↵
|
36 | String userVisibleName = id;↵ | | 36 | String userVisibleName = id;↵
|
|
37 | setText(userVisibleName);↵ | | 37 | setText(userVisibleName);↵
|
|
38 | return this | | 38 | return this
|