01: package org.columba.mail.filter.plugins;
02:
03: import java.awt.Color;
04:
05: import org.columba.api.command.ICommand;
06: import org.columba.core.filter.AbstractFilterAction;
07: import org.columba.core.filter.FilterAction;
08: import org.columba.core.filter.IFilterAction;
09: import org.columba.core.folder.api.IFolder;
10: import org.columba.mail.command.MailFolderCommandReference;
11: import org.columba.mail.folder.command.ColorMessageCommand;
12:
13: /**
14: * This Filter Action colors a message with a specified color. The action
15: * retrieves the integer attribute "<b>rgb</b>" from the filter action as
16: * the color to color the message with. In order to keep the memory consumtion
17: * up, it creates the <code>Color</code> object by using the <code>ColorFactory</code>.
18: * The message is colored by setting the "<b>columba.color</b>" header.
19: *
20: * @author redsolo
21: */
22: public class ColorMessageFilterAction extends AbstractFilterAction {
23: /** {@inheritDoc} */
24: public ICommand getCommand(IFilterAction filterAction,
25: IFolder srcFolder, Object[] uids) throws Exception {
26: int rgb = filterAction.getIntegerWithDefault("rgb", Color.black
27: .getRGB());
28:
29: // create reference
30: MailFolderCommandReference r = new MailFolderCommandReference(
31: srcFolder, uids);
32: r.setColorValue(rgb);
33:
34: // create command
35: return new ColorMessageCommand(r);
36: }
37: }
|