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; 005 006 import graphlab.graph.graph.EdgeModel; 007 import graphlab.graph.graph.GraphModel; 008 import graphlab.graph.graph.VertexModel; 009 import graphlab.graph.ui.GHTMLPageComponent; 010 import graphlab.graph.ui.GTabbedGraphPane; 011 import graphlab.platform.core.BlackBoard; 012 import graphlab.platform.extension.ExtensionLoader; 013 import graphlab.platform.plugin.PluginInterface; 014 import graphlab.platform.preferences.lastsettings.StorableOnExit; 015 import graphlab.plugins.main.extension.GraphActionExtensionHandler; 016 017 import java.io.File; 018 import java.net.MalformedURLException; 019 020 /** 021 * @author azin azadi 022 */ 023 public class Init implements PluginInterface, StorableOnExit { 024 static { 025 ExtensionLoader.registerExtensionHandler(new GraphActionExtensionHandler()); 026 } 027 028 public void init(BlackBoard blackboard) { 029 new graphlab.plugins.main.resources.Init().init(blackboard); 030 new graphlab.plugins.main.core.Init().init(blackboard); 031 new graphlab.plugins.main.select.Init().init(blackboard); 032 new graphlab.plugins.main.saveload.Init().init(blackboard); 033 //init the setting 034 EdgeModel em = new EdgeModel(new VertexModel(), new VertexModel()); 035 SETTINGS.registerSetting(em, "Graph Drawings"); 036 GTabbedGraphPane gtgp = blackboard.getData(GTabbedGraphPane.NAME); 037 GHTMLPageComponent pc = new GHTMLPageComponent(blackboard); 038 try { 039 pc.setPage(new File("doc/welcome_page.html").toURL()); 040 gtgp.jtp.addTab("Welcome!", pc); 041 } catch (MalformedURLException e) { 042 e.printStackTrace(); 043 } 044 gtgp.addGraph(new GraphModel(false)); 045 gtgp.jtp.setSelectedIndex(0); 046 } 047 } 048