1 package org.columba.mail.gui.config.filter.plugins; 17 18 import java.awt.Component ; 19 20 import javax.swing.DefaultListCellRenderer ; 21 import javax.swing.JComboBox ; 22 import javax.swing.JList ; 23 24 import org.columba.api.gui.frame.IFrameMediator; 25 import org.columba.core.filter.FilterAction; 26 import org.columba.core.filter.IFilterAction; 27 import org.columba.mail.filter.MailFilterAction; 28 import org.columba.mail.gui.config.filter.ActionList; 29 import org.columba.mail.util.MailResourceLoader; 30 31 37 public class MarkActionRow extends DefaultActionRow { 38 JComboBox variantComboBox; 39 40 public MarkActionRow(IFrameMediator mediator, ActionList list, 41 IFilterAction action) { 42 super(mediator, list, action); 43 } 44 45 public void updateComponents(boolean b) { 46 super.updateComponents(b); 47 48 if (b) { 49 String variant = new MailFilterAction(filterAction).getMarkVariant(); 50 51 if (variant == null) { 53 variant = "read"; 54 } 55 56 variantComboBox.setSelectedItem(variant); 57 } else { 58 new MailFilterAction(filterAction) 59 .setMarkVariant((String ) variantComboBox.getSelectedItem()); 60 } 61 } 62 63 public void initComponents() { 64 super.initComponents(); 65 66 String [] items = { "read", "unread", "expunged", "not_expunged", 67 "flagged", "not_flagged", "answered", "spam", "no_spam" }; 68 69 variantComboBox = new JComboBox (items); 70 variantComboBox.setRenderer(new ComboBoxRenderer()); 71 variantComboBox.setSelectedItem("read"); 72 addComponent(variantComboBox); 73 } 74 75 class ComboBoxRenderer extends DefaultListCellRenderer { 76 public ComboBoxRenderer() { 77 super(); 78 } 79 80 public Component getListCellRendererComponent(JList arg0, Object arg1, 81 int arg2, boolean arg3, boolean arg4) { 82 setText(MailResourceLoader.getString("dialog", "filter", 83 (String ) arg1)); 84 85 return this; 86 } 87 } 88 } | Popular Tags |