Differences between revisions 2 and 3
Revision 2 as of 2008-05-12 16:16:56
Size: 2434
Editor: cabernet
Comment:
Revision 3 as of 2008-05-12 16:18:34
Size: 2431
Editor: cabernet
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
=Cytoscape developer's tutorial= = Cytoscape developer's tutorial =
Line 16: Line 16:
==1. How to add a tabbed Panel to Control panel? == == 1. How to add a tabbed Panel to Control panel? ==
Line 42: Line 42:


TableOfContents([2])

Cytoscape developer's tutorial

This tutorial will show some code snippets about how to use Cytoscape APIs on plugin development. Each feature is included in a sample plugin, which can serve as a starting point or template for new plugin developers. The code snippets can also be used as reference for experienced developers.

Cytoscape plugin is usually packaged in a jar file and deployed to the plugins directory of Cytoscape. When Cytoscape starts up and initializes, its plugin manager will look up all the plugins in plugins directory. A plugin should have following three components.

1. A class, which extends CytoscapePlugin. This is the entry point to Cytoscape. 2. A manifest file, explicitly list the class, which extended CytoscapePlugin class 3. A plugin.props file, which list the information about the plugin, such as plugin name, author, release date and more. Although this file is not absolutely required, it is recommended to have one, since plugin manager will need the information to handle the plugin properly. See the page at http://www.cytoscape.org/cgi-bin/moin.cgi/Cytoscape_Plugin_Tutorial for detail about the definition of a plugin.props.

If plugin developer will share and publish their plugins, they are encouraged to submit their plugins to Cytoscape plugin website at http://cytoscape.org/plugins/index.php .

1. How to add a tabbed Panel to Control panel?

It takes three steps to add a tabbed panel to the control panel. (1) Get a handler to the cytoPanel west, which is the control panel CytoPanelImp ctrlPanel = (CytoPanelImp) Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST);

(2) Create a JPanel object (a class extends JPanel, say, MyPanel) MyPanel myPanel = new MyPanel();

  • (3) Add it to the control panel.

ctrlPanel.add("myPanel", myPanel);

Download a sample plugin, here.

2. How to add an image icon (menu item) to the toolbar?

  • (1) Create a toolbarAction

ImageIcon icon = new ImageIcon(getClass().getResource("/tiger.jpg")); MyPluginToolBarAction toolbarAction = new MyPluginToolBarAction(icon, this); The toolbarAction must extend the class cytoscape.util.CytoscapeAction and its method isInToolBar()returns true.

  • (2) Add the action to Cytoscape toolbar

Cytoscape.getDesktop().getCyMenus().addCytoscapeAction((CytoscapeAction) toolbarAction);

Download a sample plugin, here.

plugin_developer_tutorial (last edited 2011-09-06 18:52:37 by merlot)

Funding for Cytoscape is provided by a federal grant from the U.S. National Institute of General Medical Sciences (NIGMS) of the Na tional Institutes of Health (NIH) under award number GM070743-01. Corporate funding is provided through a contract from Unilever PLC.

MoinMoin Appliance - Powered by TurnKey Linux