KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thoughtriver > open > vectorvisuals > ui > SelectionEvent


1 /*
2  * SelectionEvent.java
3  *
4  * Created on 15 June 2003, 13:54
5  */

6
7 package com.thoughtriver.open.vectorvisuals.ui;
8
9 import java.util.*;
10
11 import com.thoughtriver.open.vectorvisuals.*;
12
13 /**
14  * This type of event is produced when a <CODE>VisualObject</CODE> is selected
15  * by the user. These events are distributed to <CODE>SelectionListener</CODE>s
16  * by the <CODE>SelectionManager</CODE>.
17  *
18  * @author Brandon Franklin
19  * @version $Date: 2006/11/25 09:00:37 $
20  */

21 public class SelectionEvent extends EventObject {
22
23     private static final long serialVersionUID = 4120851049356866361L;
24
25     /** Whether or not the source is being selected (as opposed to deselected) */
26     private boolean selection;
27
28     /** Whether or not this event is part of a selection transition */
29     private boolean transition;
30
31     /**
32      * Creates a new instance of <CODE>SelectionEvent</CODE> and marks it as
33      * having been generated by the supplied source <CODE>VisualObject</CODE>.
34      *
35      * @param obj the <CODE>VisualObject</CODE> that is the source of this
36      * event
37      * @param selection whether or not the source is being selected (as opposed
38      * to deselected)
39      * @param transition whether or not the event is part of a selection
40      * transition, which means selection is changing from one object to
41      * another
42      */

43     public SelectionEvent(final VisualObject obj, final boolean selection, final boolean transition) {
44         super(obj);
45         this.selection = selection;
46         this.transition = transition;
47     }
48
49     /**
50      * Returns true if the source object is being selected, or false if the
51      * source object is being deselected.
52      *
53      * @return true if the source object is being selected, or false if the
54      * source object is being deselected
55      */

56     public boolean isSelection() {
57         return selection;
58     }
59
60     /**
61      * Returns true if the event is part of a selection transition, which means
62      * selection is changing from one object to another. If the current
63      * selection is being cleared, or if a new object is being selected when one
64      * was not already selected, this method will return false.
65      *
66      * @return true if the event is part of a selection transition
67      */

68     public boolean isTransition() {
69         return transition;
70     }
71 }
72
Popular Tags