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 | import java.util.ArrayList;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Wrapper class for attributes displayed in the table
|
---|
43 | * @author Shaoqun Wu, Greenstone Digital Library, University of Waikato
|
---|
44 | * @version 2.4
|
---|
45 | */
|
---|
46 | public class Attribute
|
---|
47 | {
|
---|
48 | private String name="";
|
---|
49 | private String value="";
|
---|
50 | private String lang="";
|
---|
51 | private boolean isRequired;
|
---|
52 | private boolean isLanguageDependent;
|
---|
53 |
|
---|
54 | public Attribute(){}
|
---|
55 |
|
---|
56 | public Attribute(String name, String value, String lang, boolean isRequired, boolean isLanDep){
|
---|
57 | this.name = name;
|
---|
58 | this.value = value;
|
---|
59 | this.lang = lang;
|
---|
60 | this.isRequired = isRequired;
|
---|
61 | this.isLanguageDependent = isLanDep;
|
---|
62 | }
|
---|
63 |
|
---|
64 | public Attribute(String name, String value, boolean isRequired, boolean isLanDep){
|
---|
65 | this.name = name;
|
---|
66 | this.value = value;
|
---|
67 | this.lang = lang;
|
---|
68 | this.isRequired = isRequired;
|
---|
69 | this.isLanguageDependent = isLanDep;
|
---|
70 | }
|
---|
71 |
|
---|
72 | public Attribute(String name, String value){
|
---|
73 | this.name = name;
|
---|
74 | this.value = value;
|
---|
75 | }
|
---|
76 |
|
---|
77 | public String getName(){return name;}
|
---|
78 |
|
---|
79 | public String getValue() {return value;}
|
---|
80 |
|
---|
81 | public String getLanguage() {return lang;}
|
---|
82 |
|
---|
83 | public boolean isRequired(){return this.isRequired;}
|
---|
84 |
|
---|
85 | public boolean isLanguageDependent(){return this.isLanguageDependent;}
|
---|
86 |
|
---|
87 | public void setName(String name){
|
---|
88 | if (name.trim().equals(this.name)) return;
|
---|
89 | this.name = name.trim();
|
---|
90 |
|
---|
91 | }
|
---|
92 |
|
---|
93 | public void setValue(String value){
|
---|
94 | if (value.trim().equals(this.value)) return;
|
---|
95 | this.value = value.trim();
|
---|
96 | }
|
---|
97 |
|
---|
98 | public void setLanguage(String lang){
|
---|
99 | if (lang.trim().equals(this.lang)) return;
|
---|
100 | this.lang = lang;
|
---|
101 | }
|
---|
102 |
|
---|
103 | public void setRequired(boolean isRequired){this.isRequired = isRequired;}
|
---|
104 |
|
---|
105 | public void setLanguageDependent(boolean isLanDep){this.isLanguageDependent = isLanDep;}
|
---|
106 |
|
---|
107 | public String toString(){
|
---|
108 | return (this.name + " " + this.value +" " + this.lang);
|
---|
109 | }
|
---|
110 | }
|
---|