1 package org.columba.mail.gui.config.filter.util; 17 18 import java.awt.Component ; 19 20 import javax.swing.DefaultListCellRenderer ; 21 import javax.swing.JList ; 22 import javax.swing.UIManager ; 23 24 import org.columba.api.plugin.IExtensionHandler; 25 import org.columba.api.plugin.PluginHandlerNotFoundException; 26 import org.columba.core.gui.dialog.ErrorDialog; 27 import org.columba.core.plugin.PluginManager; 28 import org.columba.mail.plugin.IExtensionHandlerKeys; 29 30 36 37 public class ActionComboBoxRenderer extends DefaultListCellRenderer { 38 protected IExtensionHandler pluginHandler; 39 40 43 public ActionComboBoxRenderer() { 44 super(); 45 46 try { 47 pluginHandler = PluginManager 48 .getInstance().getExtensionHandler(IExtensionHandlerKeys.ORG_COLUMBA_MAIL_FILTERACTION); 49 } catch (PluginHandlerNotFoundException ex) { 50 ErrorDialog.createDialog(ex.getMessage(), ex); 51 } 52 } 53 54 60 public Component getListCellRendererComponent(JList list, Object value, 61 int index, boolean isSelected, boolean cellHasFocus) { 62 if (cellHasFocus) { 63 setBackground(list.getSelectionBackground()); 64 setForeground(list.getSelectionForeground()); 65 } else { 66 setBackground(list.getBackground()); 67 setForeground(list.getForeground()); 68 } 69 70 setBorder((cellHasFocus) ? UIManager 71 .getBorder("List.focusCellHighlightBorder") : noFocusBorder); 72 73 String id = (String ) value; 75 76 String userVisibleName = id; 78 79 setText(userVisibleName); 80 81 return this; 82 } 83 } 84 | Popular Tags |