KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > api > registry > BindingEvent


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.api.registry;
21
22
23 /** An event from context indicating that binding was modified,
24  * added or removed. The event intentionally does not pass value of
25  * the object because in some situation it could result in unnecessary
26  * creation of the object. The client receiving this event can retrieve
27  * the value by regular Context methods. The {@link #getType}
28  * can be used to distinguish type of the change.
29  *
30  * @author David Konecny
31  */

32 public final class BindingEvent extends ContextEvent {
33
34     /** This event type is for added binding. */
35     public static final int BINDING_ADDED = 1;
36
37     /** This event type is for removed binding. */
38     public static final int BINDING_REMOVED = 2;
39     
40     /** This event type is for modified binding. */
41     public static final int BINDING_MODIFIED = 3;
42     
43     private String JavaDoc bindingName;
44     private int type;
45
46     BindingEvent(Context source, String JavaDoc bindingName, int type) {
47         super(source);
48         this.bindingName = bindingName;
49         this.type = type;
50     }
51
52     /**
53      * Name of the binding. It can be null what means
54      * that concrete source of the change was not clear and that
55      * client should reexamine whole context.
56      *
57      * @return binding name; can be null
58      */

59     public String JavaDoc getBindingName() {
60         return bindingName;
61     }
62     
63     public int getType() {
64         return type;
65     }
66
67     public String JavaDoc toString() {
68         return "BindingEvent: [bindingName="+bindingName+", type="+type+"] " + super.toString(); // NOI18N
69
}
70 }
71
Popular Tags