01: package org.wings.plaf.css;
02:
03: import java.util.ArrayList;
04: import java.util.Iterator;
05: import java.util.List;
06:
07: import org.wings.plaf.Update;
08:
09: public final class UpdateHandler implements Update.Handler {
10:
11: protected String name;
12: protected final List<Object> parameters;
13:
14: public UpdateHandler(String name) {
15: if (name == null)
16: throw new IllegalArgumentException(
17: "Handler name must not be null!");
18:
19: this .name = name;
20: parameters = new ArrayList<Object>(5);
21: }
22:
23: public String getName() {
24: return "wingS.update." + name;
25: }
26:
27: public void setName(String name) {
28: this .name = name;
29: }
30:
31: public void addParameter(Object o) {
32: parameters.add(o);
33: }
34:
35: public Iterator<Object> getParameters() {
36: return parameters.iterator();
37: }
38:
39: public Object getParameter(int index) {
40: return parameters.get(index);
41: }
42:
43: public Object removeParameter(int index) {
44: return parameters.remove(index);
45: }
46:
47: public void addParameter(int index, Object o) {
48: parameters.add(index, o);
49: }
50:
51: public Object setParameter(int index, Object o) {
52: return parameters.set(index, o);
53: }
54:
55: @Override
56: public String toString() {
57: return getClass().getName() + "[" + name + "]";
58: }
59:
60: @Override
61: public boolean equals(Object object) {
62: if (object == this )
63: return true;
64: if (object == null || object.getClass() != this .getClass())
65: return false;
66:
67: final UpdateHandler handler = (UpdateHandler) object;
68:
69: if (!this .getName().equals(handler.getName()))
70: return false;
71: return parameters.equals(handler.parameters);
72: }
73:
74: @Override
75: public int hashCode() {
76: return name != null ? name.hashCode() : 0;
77: }
78: }
|