Cytoscape 2.8.0 API

Package cytoscape.view.cytopanels

CytoPanels Framework.

See:
          Description

Interface Summary
CytoPanel Interface to a CytoPanel.
CytoPanelContainer Interface for Container of CytoPanel Objects.
CytoPanelListener This listener interface provides the mechanism to respond to CytoPanel Events.
 

Class Summary
BiModalJSplitPane The BiModalJSplitPane class extends JSplitPane to provide two modes: MODE_SHOW_SPLIT: The split in the split pane appears as it normally would, and the user can resize the split pane as needed.
CytoPanelImp The CytoPanel class extends JPanel to provide the following functionality: Floating/Docking of Panel.
CytoPanelState CytoPanelState Class.
CytoPanelUtil Contains methods to assist with various tasks performed by the CytoPanel API.
 

Enum Summary
CytoPanelName An enum that maps names to compass directions.
 

Package cytoscape.view.cytopanels Description

CytoPanels Framework.

What are CytoPanels ?

CytoPanels are floatable / dockable panels, which will be available in Cytoscape 2.2. We built the CytoPanel API to cut down on the number of pop-up windows within Cytoscape, and create a more unified user experience. For example, in Cytoscape 2.1, the cPath Plugin enables users to click on a node and immediately view node details in a pop-up window. Using the CytoPanel API, we can now show these node details in an embedded CytoPanel, and present a more integrated experience to the user. For example, the image below shows a screenshot of the latest BioPAX Plugin. When you click on a node, the node details appear directly in the left CytoPanel.

The user can then chose to resize, hide or float the left CytoPanel. For example, in the screenshot below, the user has chosen to float it:

Basic Usage

Cytoscape 2.2 now includes three CytoPanels: CytoPanel 1 (appears on the left), CytoPanel 2 (appears on the bottom), and CytoPanel 3 (appears on the right). By default, only CytoPanel 1 will appear, and it will automatically contain the network list and bird's eye view component. The other panels will be hidden. The end-user can show / hide any panel via the new CytoPanel menu, or via the keyboard accelerator short-cuts.

Working with the CytoPanel API

The CytoPanel API is straightforward and fully documented. If you are a core Cytoscape coder or a Plugin writer, here are a few tips to get started.

Step 1: Obtain a CytoPanel

As noted above, the Cytoscape Desktop contains three default CytoPanels. To obtain one, use the CytoscapeDesktop.getCytoPanel() method. This method takes a SwingConstants integer value, indicating a compass direction (this enables us to add additional CytoPanels in the future, if we decide that's necessary.) Here is sample code for accessing the left CytoPanel:

CytoscapeDesktop desktop = Cytoscape.getDesktop();
CytoPanel cytoPanel = desktop.getCytoPanel (SwingConstants.WEST);

Step 2: Add your Component

You can place any Swing Component object in a CytoPanel, and it will automatically get its own tab. For example, in the code below, I create a BioPAX component, and add it the left CytoPanel. The code also adds an icon and a tooltip:

BioPaxContainer bpContainer = BioPaxContainer.getInstance();
CytoscapeDesktop desktop = Cytoscape.getDesktop();
CytoPanel cytoPanel = desktop.getCytoPanel (SwingConstants.WEST);
URL url = BioPaxDetailsPanel.class.getResource("resources/read_obj.gif");
Icon icon = new ImageIcon(url);
cytoPanel.add("BioPax PlugIn", icon, bpContainer, "BioPax PlugIn");

Step 3: Set the CytoPanel State

You can also (optionally) set the CytoPanel state. Each CytoPanel exists in one of three states:

Here is sample code for setting the current state:

cytoPanel.setState(CytoPanelState.DOCK);

If you want, you can also activate your tab within a CytoPanel. To do so, first determine the index value of your component. Then, call setSelectedIndex(). For example:

int index = cytoPanel.indexOfComponent(myComponent);
cytoPanel.setSelectedIndex(index);

CytoPanel Events

You can also (optionally) register to receive CytoPanel Events. In order to do so, you must implement the CytoPanelListener interface and make the following call:

addCytoPanelListener(CytoPanelListener cytoPanelListener);

Once you are registered to receive CytoPanel events, you will be notified of the following:

A CytoPanel Listener can choose to stop receiving CytoPanel Events. To do so, call:

removeCytoPanelListener(CytoPanelListener cytoPanelListener);

See CytoPanelListener for more information.


Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.