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.saveload.image; 005 006 import graphlab.graph.atributeset.GraphAttrSet; 007 import graphlab.graph.graph.GraphModel; 008 import graphlab.graph.graph.SubGraph; 009 import graphlab.platform.core.AbstractAction; 010 import graphlab.platform.core.BlackBoard; 011 import graphlab.ui.UIUtils; 012 013 /** 014 * @author Azin Azadi 015 */ 016 public class CopyAsImage extends AbstractAction { 017 String event = UIUtils.getUIEventKey("copy as image"); 018 019 /** 020 * constructor 021 * 022 * @param bb the blackboard of the action 023 */ 024 public CopyAsImage(BlackBoard bb) { 025 super(bb); 026 listen4Event(event); 027 } 028 029 public void performAction(String eventName, Object value) { 030 throw new RuntimeException(" graphlab.plugins.main.saveload.image.CopyAsImage Not Implemented Yet"); 031 // SelectData sd=blackboard.get(SelectData.name); 032 // GraphModel g = createGraph(sd,blackboard); 033 // BufferedImage bufferedImage = Image.Graph2Image(g); 034 // JOptionPane.showMessageDialog(null,"chejoori mishe image o rikht to clip board?"); 035 } 036 037 /** 038 * creates a new graph with the selected edges and vertices, the new graph will be built on the given blackboard 039 */ 040 public GraphModel createGraph(SubGraph sd, BlackBoard b) { 041 // Graph g = new Graph(new blackboard()); 042 GraphModel g = new GraphModel(); 043 g.insertVertices(sd.vertices); 044 g.insertEdges(sd.edges); 045 //kar 046 GraphModel gg = b.getData(GraphAttrSet.name); 047 gg.insertVertices(sd.vertices); 048 gg.insertEdges(sd.edges); 049 return g; 050 } 051 052 }