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.templates;
19:
20: import net.ar.webonswing.visitor.*;
21:
22: public class DefaultTemplateElement implements TemplateElement,
23: PublicCloneable {
24: protected Object theId;
25: protected Visitable theContent;
26:
27: public DefaultTemplateElement(int i, Visitable aContent) {
28: theId = new Integer(i);
29: theContent = aContent;
30: }
31:
32: public DefaultTemplateElement(Object aId, Visitable aContent) {
33: theId = aId;
34: theContent = aContent;
35: }
36:
37: public Visitable getContent() {
38: return theContent;
39: }
40:
41: public boolean equals(Object obj) {
42: if (obj instanceof DefaultTemplateElement) {
43: DefaultTemplateElement theElement = (DefaultTemplateElement) obj;
44:
45: return theElement.getId().equals(getId());
46: } else
47: return false;
48: }
49:
50: public Object getId() {
51: return theId;
52: }
53:
54: public void setId(Object anId) {
55: this .theId = anId;
56: }
57:
58: public String toString() {
59: return super .toString() + ": theId= " + theId
60: + ", theContent= " + theContent;
61: }
62:
63: public void accept(Visitor aVisitor) {
64: }
65:
66: public void setContent(Visitable aContent) {
67: theContent = aContent;
68: }
69:
70: public Object clone() throws CloneNotSupportedException {
71: DefaultTemplateElement theTemplateElement = (DefaultTemplateElement) super
72: .clone();
73: theTemplateElement.theContent = (Visitable) ((PublicCloneable) theContent)
74: .clone();
75:
76: return theTemplateElement;
77: }
78:
79: }
|