source: trunk/gli/src/org/greenstone/gatherer/collection/CollectionTree.java@ 9897

Last change on this file since 9897 was 9026, checked in by mdewsnip, 19 years ago

Minor variable rename.

  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1/**
2 *############################################################################
3 * A component of the Greenstone Librarian Interface, part of the Greenstone
4 * digital library suite from the New Zealand Digital Library Project at the
5 * University of Waikato, New Zealand.
6 *
7 * Author: Michael Dewsnip, NZDL Project, University of Waikato, NZ
8 *
9 * Copyright (C) 2004 New Zealand Digital Library Project
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 *############################################################################
25 */
26
27package org.greenstone.gatherer.collection;
28
29import java.awt.*;
30import javax.swing.*;
31import org.greenstone.gatherer.gui.tree.DragTree;
32import org.greenstone.gatherer.gui.tree.DragTreeCellRenderer;
33
34
35public class CollectionTree
36 extends DragTree
37{
38 public CollectionTree(String name, CollectionTreeModel collection_tree_model, boolean mixed_selection)
39 {
40 super(name, collection_tree_model, mixed_selection);
41 setCellRenderer(new CollectionTreeCellRenderer());
42 }
43
44
45 private class CollectionTreeCellRenderer
46 extends DragTreeCellRenderer
47 {
48 public Component getTreeCellRendererComponent(JTree tree, Object value, boolean sel, boolean expanded, boolean leaf, int row, boolean hasFocus)
49 {
50 JLabel tree_cell = (JLabel) super.getTreeCellRendererComponent(tree, value, sel, expanded, leaf, row, hasFocus);
51
52 // Mark explodable files with a different icon
53 if (value instanceof CollectionTreeNode && ((CollectionTreeNode) value).isExplodable()) {
54 tree_cell.setIcon(CollectionTreeNode.GREEN_FILE_ICON);
55 }
56
57 return tree_cell;
58 }
59 }
60}
Note: See TracBrowser for help on using the repository browser.