KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cayenne > map > event > DataMapEvent


1 /*****************************************************************
2  * Licensed to the Apache Software Foundation (ASF) under one
3  * or more contributor license agreements. See the NOTICE file
4  * distributed with this work for additional information
5  * regarding copyright ownership. The ASF licenses this file
6  * to you under the Apache License, Version 2.0 (the
7  * "License"); you may not use this file except in compliance
8  * with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing,
13  * software distributed under the License is distributed on an
14  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15  * KIND, either express or implied. See the License for the
16  * specific language governing permissions and limitations
17  * under the License.
18  ****************************************************************/

19
20 package org.apache.cayenne.map.event;
21
22 import org.apache.cayenne.map.DataMap;
23
24 /**
25  * An events describing a DataMap change.
26  */

27 public class DataMapEvent extends MapEvent {
28     protected DataMap dataMap;
29
30     /** Creates a DataMap change event. */
31     public DataMapEvent(Object JavaDoc src, DataMap dataMap) {
32         super(src);
33         this.dataMap = dataMap;
34     }
35
36     /** Creates a DataMap event of a specified type. */
37     public DataMapEvent(Object JavaDoc src, DataMap dataMap, int id) {
38         this(src, dataMap);
39         setId(id);
40     }
41
42     /** Creates a DataMap name change event.*/
43     public DataMapEvent(Object JavaDoc src, DataMap dataMap, String JavaDoc oldName) {
44         this(src, dataMap);
45         setOldName(oldName);
46     }
47
48     /**
49      * Returns DataMap associated with this event.
50      */

51     public DataMap getDataMap() {
52         return dataMap;
53     }
54     
55     /**
56      * Sets DataMap associated with this event.
57      *
58      * @param dataMap The dataMap to set
59      */

60     public void setDataMap(DataMap dataMap) {
61         this.dataMap = dataMap;
62     }
63
64     public String JavaDoc getNewName() {
65         return (dataMap != null) ? dataMap.getName() : null;
66     }
67 }
68
Popular Tags