|
|||||||||||||||||||
30 day Evaluation License registered to hlship@comcast.net Your 30 day evaluation period has expired. Please visit http://www.cenqua.com to obtain a licensed version of Clover | |||||||||||||||||||
Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
ObservedChangeEvent.java | - | 100% | 100% | 100% |
|
1 | // Copyright 2004, 2005 The Apache Software Foundation | |
2 | // | |
3 | // Licensed under the Apache License, Version 2.0 (the "License"); | |
4 | // you may not use this file except in compliance with the License. | |
5 | // You may obtain a copy of the License at | |
6 | // | |
7 | // http://www.apache.org/licenses/LICENSE-2.0 | |
8 | // | |
9 | // Unless required by applicable law or agreed to in writing, software | |
10 | // distributed under the License is distributed on an "AS IS" BASIS, | |
11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
12 | // See the License for the specific language governing permissions and | |
13 | // limitations under the License. | |
14 | ||
15 | package org.apache.tapestry.event; | |
16 | ||
17 | import java.util.EventObject; | |
18 | ||
19 | import org.apache.hivemind.util.Defense; | |
20 | import org.apache.tapestry.IComponent; | |
21 | ||
22 | /** | |
23 | * Event which describes a change to a particular {@link IComponent}. | |
24 | * | |
25 | * @author Howard Ship | |
26 | */ | |
27 | ||
28 | public class ObservedChangeEvent extends EventObject | |
29 | { | |
30 | private IComponent _component; | |
31 | ||
32 | private String _propertyName; | |
33 | ||
34 | private Object _newValue; | |
35 | ||
36 | /** | |
37 | * Creates the event. The new value must be null, or be a serializable object. (It is declared | |
38 | * as Object as a concession to the Java 2 collections framework, where the implementations are | |
39 | * serializable but the interfaces (Map, List, etc.) don't extend Serializable ... so we wait | |
40 | * until runtime to check). | |
41 | * | |
42 | * @param component | |
43 | * The component (not necessarily a page) whose property changed. | |
44 | * @param propertyName | |
45 | * the name of the property which was changed. | |
46 | * @param newValue | |
47 | * The new value of the property. | |
48 | * @throws IllegalArgumentException | |
49 | * if propertyName is null, or if the new value is not serializable | |
50 | */ | |
51 | ||
52 | 23 | public ObservedChangeEvent(IComponent component, String propertyName, Object newValue) |
53 | { | |
54 | 23 | super(component); |
55 | ||
56 | 23 | Defense.notNull(propertyName, "propertyName"); |
57 | ||
58 | 23 | _component = component; |
59 | 23 | _propertyName = propertyName; |
60 | 23 | _newValue = newValue; |
61 | } | |
62 | ||
63 | 23 | public IComponent getComponent() |
64 | { | |
65 | 23 | return _component; |
66 | } | |
67 | ||
68 | 21 | public Object getNewValue() |
69 | { | |
70 | 21 | return _newValue; |
71 | } | |
72 | ||
73 | 23 | public String getPropertyName() |
74 | { | |
75 | 23 | return _propertyName; |
76 | } | |
77 | ||
78 | } |
|