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.metadata;
|
---|
28 |
|
---|
29 |
|
---|
30 | import javax.swing.tree.*;
|
---|
31 |
|
---|
32 |
|
---|
33 | /** This class represents one Metadata value */
|
---|
34 | public class MetadataValueTreeNode
|
---|
35 | extends DefaultMutableTreeNode
|
---|
36 | {
|
---|
37 | static public final String METADATA_VALUE_TREE_NODE_HIERARCHY_TOKEN = "|";
|
---|
38 |
|
---|
39 | private String value = null;
|
---|
40 |
|
---|
41 |
|
---|
42 | public MetadataValueTreeNode(Object object)
|
---|
43 | {
|
---|
44 | super(object);
|
---|
45 | }
|
---|
46 |
|
---|
47 |
|
---|
48 | public MetadataValueTreeNode(String value)
|
---|
49 | {
|
---|
50 | this.value = value;
|
---|
51 | }
|
---|
52 |
|
---|
53 |
|
---|
54 | public String getFullValue()
|
---|
55 | {
|
---|
56 | if (parent == null) {
|
---|
57 | return "";
|
---|
58 | }
|
---|
59 |
|
---|
60 | if (((MetadataValueTreeNode) parent).isRoot()) {
|
---|
61 | return value;
|
---|
62 | }
|
---|
63 |
|
---|
64 | return ((MetadataValueTreeNode) parent).getFullValue() + METADATA_VALUE_TREE_NODE_HIERARCHY_TOKEN + value;
|
---|
65 | }
|
---|
66 |
|
---|
67 |
|
---|
68 | public String getValue()
|
---|
69 | {
|
---|
70 | return value;
|
---|
71 | }
|
---|
72 |
|
---|
73 |
|
---|
74 | /** This is used to display the node in the value tree */
|
---|
75 | public String toString()
|
---|
76 | {
|
---|
77 | return value;
|
---|
78 | }
|
---|
79 | }
|
---|