01: //The contents of this file are subject to the Mozilla Public License Version 1.1
02: //(the "License"); you may not use this file except in compliance with the
03: //License. You may obtain a copy of the License at http://www.mozilla.org/MPL/
04: //
05: //Software distributed under the License is distributed on an "AS IS" basis,
06: //WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
07: //for the specific language governing rights and
08: //limitations under the License.
09: //
10: //The Original Code is "The Columba Project"
11: //
12: //The Initial Developers of the Original Code are Frederik Dietz and Timo Stich.
13: //Portions created by Frederik Dietz and Timo Stich are Copyright (C) 2003.
14: //
15: //All Rights Reserved.
16: package org.columba.mail.gui.table.plugins;
17:
18: import java.awt.Component;
19:
20: import javax.swing.ImageIcon;
21: import javax.swing.JTable;
22: import javax.swing.SwingConstants;
23:
24: import org.columba.mail.gui.table.model.MessageNode;
25: import org.columba.mail.resourceloader.MailImageLoader;
26: import org.columba.mail.util.MailResourceLoader;
27:
28: public class AttachmentRenderer extends DefaultLabelRenderer {
29: boolean bool;
30: ImageIcon image1;
31:
32: public AttachmentRenderer() {
33: super ();
34:
35: setHorizontalAlignment(SwingConstants.CENTER);
36:
37: image1 = MailImageLoader.getSmallIcon("attachment-col.png");
38:
39: }
40:
41: public Component getTableCellRendererComponent(JTable table,
42: Object value, boolean isSelected, boolean hasFocus,
43: int row, int column) {
44: super .getTableCellRendererComponent(table, value, isSelected,
45: hasFocus, row, column);
46:
47: if (value == null) {
48: setIcon(null);
49:
50: return this ;
51: }
52:
53: setText("");
54:
55: boolean hasAttachment = ((Boolean) ((MessageNode) value)
56: .getHeader().get("columba.attachment")).booleanValue();
57:
58: if (hasAttachment) {
59: setIcon(image1);
60:
61: setToolTipText(MailResourceLoader.getString("header",
62: "column", "attachment"));
63: } else {
64: setIcon(null);
65: }
66:
67: return this;
68: }
69: }
|