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 | * <BR><BR>
|
---|
9 | *
|
---|
10 | * Author: Shaoqun Wu, Greenstone Digital Library, University of Waikato
|
---|
11 | *
|
---|
12 | * <BR><BR>
|
---|
13 | *
|
---|
14 | * Copyright (C) 2006 New Zealand Digital Library Project
|
---|
15 | *
|
---|
16 | * <BR><BR>
|
---|
17 | *
|
---|
18 | * This program is free software; you can redistribute it and/or modify
|
---|
19 | * it under the terms of the GNU General Public License as published by
|
---|
20 | * the Free Software Foundation; either version 2 of the License, or
|
---|
21 | * (at your option) any later version.
|
---|
22 | *
|
---|
23 | * <BR><BR>
|
---|
24 | *
|
---|
25 | * This program is distributed in the hope that it will be useful,
|
---|
26 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
27 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
28 | * GNU General Public License for more details.
|
---|
29 | *
|
---|
30 | * <BR><BR>
|
---|
31 | *
|
---|
32 | * You should have received a copy of the GNU General Public License
|
---|
33 | * along with this program; if not, write to the Free Software
|
---|
34 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
35 | *########################################################################
|
---|
36 | */
|
---|
37 | package org.greenstone.gatherer.gems;
|
---|
38 |
|
---|
39 |
|
---|
40 | /**
|
---|
41 | * Wrapper class for attributes displayed in the table
|
---|
42 | * @author Shaoqun Wu, Greenstone Digital Library, University of Waikato
|
---|
43 | */
|
---|
44 | public class Attribute
|
---|
45 | {
|
---|
46 | private String name="";
|
---|
47 | private String value="";
|
---|
48 | private String lang="";
|
---|
49 | private boolean isRequired;
|
---|
50 | //private boolean isLanguageDependent;
|
---|
51 |
|
---|
52 | public Attribute() {}
|
---|
53 |
|
---|
54 | public Attribute(String name, String value, String lang, boolean isRequired /*, boolean isLangDep*/){
|
---|
55 | this.name = name;
|
---|
56 | this.value = value;
|
---|
57 | this.lang = lang;
|
---|
58 | this.isRequired = isRequired;
|
---|
59 | //this.isLanguageDependent = isLangDep;
|
---|
60 | }
|
---|
61 |
|
---|
62 | public Attribute(String name, String value, boolean isRequired/*, boolean isLangDep*/){
|
---|
63 | this.name = name;
|
---|
64 | this.value = value;
|
---|
65 | //this.lang = lang;
|
---|
66 | this.isRequired = isRequired;
|
---|
67 | //this.isLanguageDependent = isLangDep;
|
---|
68 | }
|
---|
69 |
|
---|
70 | public Attribute(String name, String value){
|
---|
71 | this.name = name;
|
---|
72 | this.value = value;
|
---|
73 | }
|
---|
74 |
|
---|
75 | public String getName(){
|
---|
76 | return name;
|
---|
77 | }
|
---|
78 |
|
---|
79 | public String getValue() {
|
---|
80 | return value;
|
---|
81 | }
|
---|
82 |
|
---|
83 | public String getLanguage() {
|
---|
84 | return lang;
|
---|
85 | }
|
---|
86 |
|
---|
87 | public boolean isRequired(){
|
---|
88 | return this.isRequired;
|
---|
89 | }
|
---|
90 |
|
---|
91 | // public boolean isLanguageDependent(){
|
---|
92 | // return this.isLanguageDependent;
|
---|
93 | // }
|
---|
94 |
|
---|
95 | public void setName(String name) {
|
---|
96 | if (name.trim().equals(this.name)) return;
|
---|
97 | this.name = name.trim();
|
---|
98 |
|
---|
99 | }
|
---|
100 |
|
---|
101 | public void setValue(String value) {
|
---|
102 | if (value.trim().equals(this.value)) return;
|
---|
103 | this.value = value.trim();
|
---|
104 | }
|
---|
105 |
|
---|
106 | public void setLanguage(String lang) {
|
---|
107 | if (lang.trim().equals(this.lang)) return;
|
---|
108 | this.lang = lang;
|
---|
109 | }
|
---|
110 |
|
---|
111 | public void setRequired(boolean isRequired) {
|
---|
112 | this.isRequired = isRequired;
|
---|
113 | }
|
---|
114 |
|
---|
115 | // public void setLanguageDependent(boolean isLangDep) {
|
---|
116 | // this.isLanguageDependent = isLangDep;
|
---|
117 | // }
|
---|
118 |
|
---|
119 | public String toString() {
|
---|
120 | return (this.name + " " + this.value +" " + this.lang);
|
---|
121 | }
|
---|
122 | }
|
---|