source: trunk/gli/src/org/greenstone/gatherer/cdm/SuperCollection.java@ 7578

Last change on this file since 7578 was 5590, checked in by mdewsnip, 21 years ago

Could it be I've finished adding tooltips?? Why yes, very nearly... and a big "hallelulah" for that.

  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1/**
2 *#########################################################################
3 *
4 * A component of the Gatherer application, part of the Greenstone digital
5 * library suite from the New Zealand Digital Library Project at the
6 * University of Waikato, New Zealand.
7 *
8 * Author: John Thompson, Greenstone Digital Library, University of Waikato
9 *
10 * Copyright (C) 1999 New Zealand Digital Library Project
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17* This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
25 *########################################################################
26 */
27package org.greenstone.gatherer.cdm;
28
29/**************************************************************************************
30 * Written: 02/07/03
31 * Revised:
32 **************************************************************************************/
33import org.greenstone.gatherer.cdm.CollectionConfiguration;
34import org.greenstone.gatherer.cdm.DOMProxyListEntry;
35import org.w3c.dom.Element;
36
37public class SuperCollection
38 implements DOMProxyListEntry {
39
40 private Element element;
41 private String name;
42
43 public SuperCollection() {
44 element = null;
45 name = null;
46 }
47
48 public SuperCollection(Element element) {
49 this.element = element;
50 name = null;
51 }
52
53 public int compareTo(Object other) {
54 return this.getName().compareTo(other.toString());
55 }
56
57 public DOMProxyListEntry create(Element element) {
58 return new SuperCollection(element);
59 }
60
61 public boolean equals(Object other) {
62 return (compareTo(other) == 0);
63 }
64
65 public Element getElement() {
66 return element;
67 }
68
69 public String getName() {
70 if(name == null && element != null) {
71 name = element.getAttribute(CollectionConfiguration.NAME_ATTRIBUTE);
72 }
73 return name;
74 }
75
76 public boolean isAssigned() {
77 return (element != null && element.getAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE).equals(CollectionConfiguration.TRUE_STR));
78 }
79
80 public void setAssigned(boolean assigned) {
81 if(element != null) {
82 element.setAttribute(CollectionConfiguration.ASSIGNED_ATTRIBUTE, (assigned ? CollectionConfiguration.TRUE_STR : CollectionConfiguration.FALSE_STR));
83 }
84 }
85
86 public void setElement(Element element) {
87 this.element = element;
88 name = null;
89 }
90
91 public void setName(String name) {
92 this.name = name;
93 if(element != null) {
94 element.setAttribute(CollectionConfiguration.NAME_ATTRIBUTE, name);
95 }
96 }
97
98 public String toString() {
99 return getName();
100 }
101}
Note: See TracBrowser for help on using the repository browser.