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.addressbook.gui.tree.util;
17:
18: import java.awt.Component;
19:
20: import javax.swing.JTree;
21: import javax.swing.border.Border;
22: import javax.swing.tree.DefaultTreeCellRenderer;
23:
24: import org.columba.addressbook.folder.AddressbookTreeNode;
25:
26: @SuppressWarnings({"serial","serial"})
27: public class AddressbookTreeCellRenderer extends
28: DefaultTreeCellRenderer {
29: Border unselectedBorder = null;
30:
31: Border selectedBorder = null;
32:
33: boolean isBordered = true;
34:
35: boolean bool;
36:
37: public AddressbookTreeCellRenderer(boolean bool) {
38: super ();
39:
40: this .bool = bool;
41:
42: }
43:
44: public Component getTreeCellRendererComponent(JTree tree,
45: Object value, boolean isSelected, boolean expanded,
46: boolean leaf, int row, boolean hasFocus) {
47: super .getTreeCellRendererComponent(tree, value, isSelected,
48: expanded, leaf, row, hasFocus);
49:
50: AddressbookTreeNode folder = (AddressbookTreeNode) value;
51:
52: if (folder == null) {
53: return this;
54: }
55:
56: setText(folder.getName());
57: setIcon(folder.getIcon());
58:
59: return this;
60: }
61: }
|