|
|||||||||||||||||||
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover 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 | 33 |
public ObservedChangeEvent(IComponent component, String propertyName, Object newValue)
|
53 |
{ |
|
54 | 33 |
super(component);
|
55 |
|
|
56 | 33 |
Defense.notNull(propertyName, "propertyName");
|
57 |
|
|
58 | 33 |
_component = component; |
59 | 33 |
_propertyName = propertyName; |
60 | 33 |
_newValue = newValue; |
61 |
} |
|
62 |
|
|
63 | 33 |
public IComponent getComponent()
|
64 |
{ |
|
65 | 33 |
return _component;
|
66 |
} |
|
67 |
|
|
68 | 31 |
public Object getNewValue()
|
69 |
{ |
|
70 | 31 |
return _newValue;
|
71 |
} |
|
72 |
|
|
73 | 33 |
public String getPropertyName()
|
74 |
{ |
|
75 | 33 |
return _propertyName;
|
76 |
} |
|
77 |
|
|
78 |
} |
|