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: import java.util.List;
18: import org.araneaframework.jsp.util.JspUpdateRegionUtil;
19:
20: /**
21: * More advanced event that can be sent to widgets, includes event precondition
22: * (script that will be executed and only if returns true is event actually sent)
23: * and updateregions that should be updated each time when event is processed.
24: *
25: * @author Taimo Peelo (taimo@araneaframework.org)
26: */
27: public class UiUpdateEvent extends UiEvent {
28: private List updateRegionNames;
29: private String eventPrecondition;
30:
31: public UiUpdateEvent() {
32: }
33:
34: public UiUpdateEvent(String id, String target, String param) {
35: super (id, target, param);
36: }
37:
38: public UiUpdateEvent(String id, String target, String param,
39: List updateRegionNames) {
40: super (id, target, param);
41: this .updateRegionNames = updateRegionNames;
42: }
43:
44: public List getUpdateRegionNames() {
45: return updateRegionNames;
46: }
47:
48: public void setUpdateRegionNames(List updateRegionNames) {
49: this .updateRegionNames = updateRegionNames;
50: }
51:
52: public String getEventPrecondition() {
53: return eventPrecondition;
54: }
55:
56: public void setEventPrecondition(String eventPrecondition) {
57: this .eventPrecondition = eventPrecondition;
58: }
59:
60: public StringBuffer getEventAttributes() {
61: StringBuffer result = super .getEventAttributes();
62: if (eventPrecondition != null)
63: result.append(' ').append(AraneaAttributes.Event.CONDITION)
64: .append("=\"").append(eventPrecondition)
65: .append('"');
66: if (getUpdateRegionNames() != null
67: && !getUpdateRegionNames().isEmpty())
68: result
69: .append(' ')
70: .append(AraneaAttributes.Event.UPDATE_REGIONS)
71: .append("=\"")
72: .append(
73: JspUpdateRegionUtil
74: .formatUpdateRegionsJS(getUpdateRegionNames()))
75: .append("\"");
76:
77: return result;
78: }
79:
80: public void clear() {
81: super.clear();
82: updateRegionNames = null;
83: eventPrecondition = null;
84: }
85: }
|