KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > modules > xml > nbprefuse > MouseoverActionControl


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-2007 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19 /*
20  * MouseoverActionControl.java
21  *
22  * Created on March 26, 2006, 7:02 PM
23  *
24  * To change this template, choose Tools | Template Manager
25  * and open the template in the editor.
26  */

27
28 package org.netbeans.modules.xml.nbprefuse;
29
30 import java.awt.event.MouseEvent JavaDoc;
31 import prefuse.controls.HoverActionControl;
32 import prefuse.visual.NodeItem;
33 import prefuse.visual.VisualItem;
34
35 /**
36  *
37  * @author Jeri Lockhart
38  */

39 public class MouseoverActionControl extends HoverActionControl{
40     protected String JavaDoc action;
41
42     /**
43      * Creates a new instance of MouseoverActionControl
44      */

45     public MouseoverActionControl(String JavaDoc action) {
46         super(action);
47         this.action = action;
48     }
49
50     /**
51      * @see prefuse.controls.Control#itemEntered(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
52      */

53     public void itemEntered(VisualItem item, MouseEvent JavaDoc e) {
54         if (item instanceof NodeItem &&
55                 item.canSetBoolean(AnalysisConstants.MOUSEOVER)){
56             item.setBoolean(AnalysisConstants.MOUSEOVER, true);
57         }
58         super.itemEntered(item, e);
59     }
60
61     /**
62      * @see prefuse.controls.Control#itemExited(prefuse.visual.VisualItem, java.awt.event.MouseEvent)
63      *
64      * NbFocusControl can also set MOUSEOVER to false
65      * if the user clicks a NodeItem while pressing the Control key
66      */

67     public void itemExited(VisualItem item, MouseEvent JavaDoc e) {
68         if (item instanceof NodeItem &&
69                 item.canSetBoolean(AnalysisConstants.MOUSEOVER)){
70             item.setBoolean(AnalysisConstants.MOUSEOVER, false);
71         }
72         super.itemExited(item, e);
73     }
74
75
76
77 }
78
Popular Tags