01: /**
02: * Copyright 2006 Webmedia Group Ltd.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: **/package org.araneaframework.jsp;
16:
17: /**
18: * Basic event that can be sent to widgets.
19: *
20: * @author Taimo Peelo (taimo@araneaframework.org)
21: */
22: public class UiEvent {
23: private String id;
24: private String target;
25: private String param;
26:
27: public UiEvent() {
28: }
29:
30: public UiEvent(String id, String target, String param) {
31: this .id = id;
32: this .target = target;
33: this .param = param;
34: }
35:
36: public String getId() {
37: return id;
38: }
39:
40: public void setId(String eventId) {
41: this .id = eventId;
42: }
43:
44: public String getParam() {
45: return param;
46: }
47:
48: public void setParam(String eventParam) {
49: this .param = eventParam;
50: }
51:
52: public String getTarget() {
53: return target;
54: }
55:
56: public void setTarget(String targetWidgetId) {
57: this .target = targetWidgetId;
58: }
59:
60: /** returns the event attributes in form suitable for outputting to HTML */
61: public StringBuffer getEventAttributes() {
62: StringBuffer result = new StringBuffer();
63: result.append(AraneaAttributes.Event.ID).append("=\"").append(
64: getId()).append("\" ");
65:
66: if (getTarget() != null)
67: result.append(AraneaAttributes.Event.TARGET_WIDGET_ID)
68: .append("=\"").append(getTarget()).append("\" ");
69: if (getParam() != null)
70: result.append(AraneaAttributes.Event.PARAM).append("=\"")
71: .append(getParam()).append("\"");
72:
73: return result;
74: }
75:
76: public void clear() {
77: id = target = param = null;
78: }
79: }
|