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.edge; 005 006 import graphlab.graph.event.EdgeEvent; 007 import graphlab.platform.core.AbstractAction; 008 import graphlab.platform.core.BlackBoard; 009 010 import java.awt.event.MouseEvent; 011 012 /** 013 * @author Ruzbeh 014 */ 015 public class EdgeSelectEvent extends AbstractAction { 016 public EdgeSelectEvent(BlackBoard bb) { 017 super(bb); 018 listen4Event(EdgeEvent.EVENT_KEY); 019 } 020 021 public void performAction(String eventName, Object value) { 022 EdgeSelectData d = new EdgeSelectData(); 023 EdgeEvent evd = blackboard.getData(EdgeEvent.EVENT_KEY); 024 if (evd.eventType == EdgeEvent.CLICKED) { 025 if (evd.mouseBtn == MouseEvent.BUTTON1) { 026 d.edge = evd.e; 027 blackboard.setData(EdgeSelectData.EVENT_KEY, d); 028 } 029 } 030 } 031 }