001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.plugins.main.core.actions.vertex;
005    
006    import graphlab.graph.event.VertexEvent;
007    import graphlab.platform.core.AbstractAction;
008    import graphlab.platform.core.BlackBoard;
009    
010    import java.awt.event.MouseEvent;
011    
012    /**
013     * @author azin azadi
014     */
015    public class VertexSelectEvent extends AbstractAction {
016        public VertexSelectEvent(BlackBoard bb) {
017            super(bb);
018            listen4Event(VertexEvent.EVENT_KEY);
019        }
020    
021        public void performAction(String eventName, Object value) {
022            VertexSelectData d = new VertexSelectData();
023            VertexEvent cvd = blackboard.getData(VertexEvent.EVENT_KEY);
024            if (cvd.eventType == VertexEvent.CLICKED) {
025                if (cvd.mouseBtn == MouseEvent.BUTTON1) {
026                    d.v = cvd.v;
027                    blackboard.setData(VertexSelectData.EVENT_KEY, d);
028                }
029            }
030        }
031    }
032