01: //WebOnSwing - Web Application Framework
02: //Copyright (C) 2003 Fernando Damian Petrola
03: //
04: //This library is free software; you can redistribute it and/or
05: //modify it under the terms of the GNU Lesser General Public
06: //License as published by the Free Software Foundation; either
07: //version 2.1 of the License, or (at your option) any later version.
08: //
09: //This library is distributed in the hope that it will be useful,
10: //but WITHOUT ANY WARRANTY; without even the implied warranty of
11: //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: //Lesser General Public License for more details.
13: //
14: //You should have received a copy of the GNU Lesser General Public
15: //License along with this library; if not, write to the Free Software
16: //Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17:
18: package net.ar.webonswing.render.markup;
19:
20: import java.io.*;
21:
22: import net.ar.webonswing.visitor.*;
23:
24: public class TagAttribute implements Visitable, PublicCloneable,
25: Serializable {
26: protected String theValue;
27: protected String theKey;
28:
29: public TagAttribute(String aKey, String aValue) {
30: theKey = aKey;
31: theValue = aValue;
32: }
33:
34: public TagAttribute(String aKey, int aValue) {
35: theKey = aKey;
36: theValue = new Integer(aValue).toString();
37: }
38:
39: public String getKey() {
40: return theKey;
41: }
42:
43: public void setKey(String aKey) {
44: this .theKey = aKey;
45: }
46:
47: public String getValue() {
48: return theValue;
49: }
50:
51: public void setValue(String aValue) {
52: this .theValue = aValue;
53: }
54:
55: public boolean equals(Object obj) {
56: if (obj instanceof TagAttribute) {
57: TagAttribute theAttribute = (TagAttribute) obj;
58: return getKey().equals(theAttribute.getKey());
59: } else
60: return false;
61: }
62:
63: public void accept(Visitor aRenderer) {
64: ((MarkupVisitor) aRenderer).visitAttribute(this );
65: }
66:
67: public Object clone() throws CloneNotSupportedException {
68: TagAttribute theAttribute = (TagAttribute) super.clone();
69:
70: theAttribute.theKey = theKey;
71: theAttribute.theValue = theValue;
72:
73: return theAttribute;
74: }
75:
76: }
|