KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > buchuki > ensmer > input > event > semantic > ObjectEvent


1 /*
2  * Copyright 2004 Dusty Phillips
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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  */

16
17 package com.buchuki.ensmer.input.event.semantic;
18
19 import java.util.EventObject JavaDoc;
20
21 /**
22  * Event issued to indicate that an object was added or removed. Usually this
23  * would be called by the Area class. Objects can be added to or removed from
24  * areas, or can be destroyed. A removed object may be added to another area,
25  * a destroyed object may not. Note that a destroyed object is usually also removed,
26  * so both events would be fired.
27  *
28  * @author Dusty Phillips [dusty@buchuki.com]
29  */

30 public class ObjectEvent extends EventObject JavaDoc {
31
32     /**
33      * Creates a new instance of FocusEvent.
34      *
35      * @param source the object that issued the FocusEvent, usually an instance
36      * of Area
37      * @param object the identifier of the object that was manipulated
38      * @param action an instance of ObjectEvent.EventType indicating the kind of
39      * event (object addition, removal, or destruction, possibly others in future)
40      * that occured
41      */

42     public ObjectEvent(Object JavaDoc source, Long JavaDoc object, EventType action) {
43         super(source);
44         this.object = object;
45         this.action = action;
46     }
47
48     /**
49      * Get the object that was influenced by this event
50      *
51      * @return the identifier of the object who's focus changed
52      */

53     public Long JavaDoc getObject() {
54         return this.object;
55     }
56     
57     /**
58      * Get the type of event that occured.
59      * @return of instance of EventType enum
60      */

61     public EventType getAction() {
62         return action;
63     }
64     
65     /**
66      * The identifier of the object that was removed in this event
67      */

68     private Long JavaDoc object;
69     
70     /**
71      * The type of event that occured
72      */

73     private EventType action;
74     
75     /**
76      * Enumeration of possible event actions
77      */

78     public enum EventType {
79         OBJECT_ADDED,
80         OBJECT_REMOVED,
81         OBJECT_DESTROYED
82     }
83 }
84
Popular Tags