KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > batik > gvt > event > SelectionEvent


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

18 package org.apache.batik.gvt.event;
19
20 import java.awt.Shape JavaDoc;
21
22 /**
23  * An event which indicates that a selection is being made or has been made.
24  *
25  * @author <a HREF="mailto:bill.haneman@ireland.sun.com">Bill Haneman</a>
26  * @author <a HREF="mailto:tkormann@ilog.fr">Thierry Kormann</a>
27  * @version $Id: SelectionEvent.java,v 1.7 2004/08/18 07:14:30 vhardy Exp $
28  */

29 public class SelectionEvent {
30
31     /**
32      * The id for the "selection changing" event.
33      * (Selection process is under way)
34      */

35     public static final int SELECTION_CHANGED = 1;
36
37     /**
38      * The id for the "selection cleared" event.
39      */

40     public static final int SELECTION_CLEARED = 3;
41
42     /**
43      * The id for the "selection started" event.
44      */

45     public static final int SELECTION_STARTED = 4;
46
47     /**
48      * The id for the "selection completed" event.
49      * (Selection process is complete).
50      */

51     public static final int SELECTION_DONE = 2;
52
53     /** The shape enclosing the selection */
54     protected Shape JavaDoc highlightShape;
55
56     /** The object which composes the selection */
57     protected Object JavaDoc selection;
58
59     /** The event type of the current selection event */
60     protected int id;
61
62     /**
63      * Constructs a new graphics node paint event.
64      * @param selection the selection
65      * @param id the id of this event
66      * @param highlightShape a user-space shape enclosing the selection.
67      */

68     public SelectionEvent(Object JavaDoc selection, int id, Shape JavaDoc highlightShape ) {
69         this.id = id;
70         this.selection = selection;
71         this.highlightShape = highlightShape;
72     }
73
74     /**
75      * Returns a shape in user space that encloses the current selection.
76      */

77     public Shape JavaDoc getHighlightShape() {
78         return highlightShape;
79     }
80
81     /**
82      * Returns the selection associated with this event.
83      * Only guaranteed current for events of type SELECTION_DONE.
84      */

85     public Object JavaDoc getSelection() {
86         return selection;
87     }
88
89     /**
90      * Returns the event's selection event type.
91      * @see org.apache.batik.gvt.event.SelectionEvent#SELECTION_CHANGED
92      * @see org.apache.batik.gvt.event.SelectionEvent#SELECTION_CLEARED
93      * @see org.apache.batik.gvt.event.SelectionEvent#SELECTION_DONE
94      */

95     public int getID() {
96         return id;
97     }
98 }
99
Popular Tags