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 |
|
---|
27 | package org.greenstone.gatherer.collection;
|
---|
28 |
|
---|
29 |
|
---|
30 | import java.io.*;
|
---|
31 | import javax.swing.*;
|
---|
32 | import org.greenstone.gatherer.cdm.CollectionDesignManager;
|
---|
33 | import org.greenstone.gatherer.file.FileNode;
|
---|
34 | import org.greenstone.gatherer.util.JarTools;
|
---|
35 | import java.util.Set;
|
---|
36 | import java.util.Iterator;
|
---|
37 | import java.nio.charset.Charset;
|
---|
38 |
|
---|
39 |
|
---|
40 | /** This class represents one node in the collection tree. */
|
---|
41 | public class CollectionTreeNode
|
---|
42 | extends FileNode
|
---|
43 | {
|
---|
44 | static final public ImageIcon GREEN_FILE_ICON = JarTools.getImage("greenfile.gif", true);
|
---|
45 |
|
---|
46 | /** Is this file a metadata database that is explodable with the explode_metadata_databases.pl script? */
|
---|
47 | private boolean is_explodable = false;
|
---|
48 |
|
---|
49 | /** Keeps track of whether this file can be replaced with a Greenstone-generated html file.
|
---|
50 | * To work with replace_srcdoc_with_html.pl */
|
---|
51 | private boolean is_srcreplaceable = false;
|
---|
52 |
|
---|
53 | public CollectionTreeNode(File file)
|
---|
54 | {
|
---|
55 | super(file);
|
---|
56 |
|
---|
57 | this.is_explodable = CollectionDesignManager.plugin_manager.isFileExplodable(file);
|
---|
58 | // To work with replace_srcdoc_with_html.pl
|
---|
59 | this.is_srcreplaceable = CollectionDesignManager.plugin_manager.isFileSrcReplaceable(file);
|
---|
60 |
|
---|
61 | }
|
---|
62 |
|
---|
63 |
|
---|
64 | public FileNode addChildNode(File file)
|
---|
65 | {
|
---|
66 | CollectionTreeNode child_node = new CollectionTreeNode(file);
|
---|
67 | child_node.setModel(model);
|
---|
68 | child_node.setParent(this);
|
---|
69 | return child_node;
|
---|
70 | }
|
---|
71 |
|
---|
72 |
|
---|
73 | public boolean isExplodable()
|
---|
74 | {
|
---|
75 | return is_explodable;
|
---|
76 | }
|
---|
77 |
|
---|
78 | // To work with replace_srcdoc_with_html.pl
|
---|
79 | public boolean isSrcReplaceable()
|
---|
80 | {
|
---|
81 | return is_srcreplaceable;
|
---|
82 | }
|
---|
83 | }
|
---|