Cytoscape 2.6.2 (c) 2006,2007 ISB, MSKCC, UCSD

cytoscape.layout
Class LayoutAdapter

java.lang.Object
  extended by cytoscape.layout.LayoutAdapter
All Implemented Interfaces:
CyLayoutAlgorithm

public abstract class LayoutAdapter
extends Object
implements CyLayoutAlgorithm

LayoutAdapter provides a *very* minimal interface to implement a layout algorithm. It is meant to be used by graph readers and plugins that provide their own node placement and whose layout approach should not be made available outside of the reader or plugin's context.


Constructor Summary
LayoutAdapter()
           
 
Method Summary
 void doLayout()
          This method performs the layout on the current network using the current network view.
 void doLayout(CyNetworkView networkView)
          This method performs the layout on the current network.
abstract  void doLayout(CyNetworkView networkView, TaskMonitor monitor)
          This method performs the layout on the current network, but assumes that the layout is part of an existing monitored task
 List<String> getInitialAttributeList()
          This returns a (possibly empty) List of Strings that is used for the attribute list in the menu for attribute-based layouts.
 String getName()
          Get the name of this layout.
 LayoutProperties getSettings()
          This method is used to ask the algorithm to get all of its tunables and return them to the caller.
 JPanel getSettingsPanel()
          This method should return a JPanel that implements the UI to set the tuneable parameters for the algorithm.
 void halt()
          DOCUMENT ME!
 void lockNode(NodeView v)
          DOCUMENT ME!
 void lockNodes(NodeView[] nodes)
          DOCUMENT ME!
 void revertSettings()
          This method is used to ask the algorithm to revert its settings to some previous state.
 void setLayoutAttribute(String attributeName)
          Sets the attribute to use for node- or edge- based attribute layouts
 void setSelectedOnly(boolean selectedOnly)
          Sets the "selectedOnly" flag
 byte[] supportsEdgeAttributes()
          Tests to see if this layout supports doing a layout based on edge attributes.
 byte[] supportsNodeAttributes()
          Tests to see if this layout supports doing a layout based on node attributes.
 boolean supportsSelectedOnly()
          Tests to see if this layout supports doing a layout on a subset of the nodes in this network view.
 void unlockAllNodes()
          DOCUMENT ME!
 void unlockNode(NodeView v)
          DOCUMENT ME!
 void updateSettings()
          This method is used to ask the algorithm to get its settings from the seetings dialog.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LayoutAdapter

public LayoutAdapter()
Method Detail

doLayout

public void doLayout()
This method performs the layout on the current network using the current network view.

Specified by:
doLayout in interface CyLayoutAlgorithm

doLayout

public void doLayout(CyNetworkView networkView)
This method performs the layout on the current network.

Specified by:
doLayout in interface CyLayoutAlgorithm
Parameters:
networkView - the CyNetworkView on which to perform the layout

doLayout

public abstract void doLayout(CyNetworkView networkView,
                              TaskMonitor monitor)
This method performs the layout on the current network, but assumes that the layout is part of an existing monitored task

Specified by:
doLayout in interface CyLayoutAlgorithm
Parameters:
networkView - the CyNetworkView on which to perform the layout
monitor - the task monitor to use

getName

public String getName()
Get the name of this layout.

Specified by:
getName in interface CyLayoutAlgorithm
Returns:
String representing the name of the layout.

supportsSelectedOnly

public boolean supportsSelectedOnly()
Tests to see if this layout supports doing a layout on a subset of the nodes in this network view.

Specified by:
supportsSelectedOnly in interface CyLayoutAlgorithm
Returns:
true if layout supports layouts on a subset of the nodes

setSelectedOnly

public void setSelectedOnly(boolean selectedOnly)
Sets the "selectedOnly" flag

Specified by:
setSelectedOnly in interface CyLayoutAlgorithm
Parameters:
selectedOnly - boolean value that tells the layout algorithm whether to only layout the selected nodes

supportsNodeAttributes

public byte[] supportsNodeAttributes()
Tests to see if this layout supports doing a layout based on node attributes.

Specified by:
supportsNodeAttributes in interface CyLayoutAlgorithm
Returns:
byte array of allowable attribute types or "null" if not supported. If the first type is "-1", all types are supported

supportsEdgeAttributes

public byte[] supportsEdgeAttributes()
Tests to see if this layout supports doing a layout based on edge attributes.

Specified by:
supportsEdgeAttributes in interface CyLayoutAlgorithm
Returns:
type array of allowable attribute types or "null" if not supported. If the first type is "-1", all types are supported

setLayoutAttribute

public void setLayoutAttribute(String attributeName)
Sets the attribute to use for node- or edge- based attribute layouts

Specified by:
setLayoutAttribute in interface CyLayoutAlgorithm
Parameters:
attributeName - String with the name of the attribute to use

getInitialAttributeList

public List<String> getInitialAttributeList()
This returns a (possibly empty) List of Strings that is used for the attribute list in the menu for attribute-based layouts. This allows layout algorithms to provide "special" attributes. For example, a force directed layout might want to set the list to ["(unweighted)"] to allow the user to perform an unweighted layout. Note that this value will be set using setLayoutAttribute() just like other attributes, so the layout algorithm will need to check for it.

Specified by:
getInitialAttributeList in interface CyLayoutAlgorithm
Returns:
List of Strings

getSettingsPanel

public JPanel getSettingsPanel()
This method should return a JPanel that implements the UI to set the tuneable parameters for the algorithm.

Specified by:
getSettingsPanel in interface CyLayoutAlgorithm
Returns:
JPanel that will be used in the LayoutSettingsDialog. If this algorithm does not support a UI for settings, it should return null

revertSettings

public void revertSettings()
This method is used to ask the algorithm to revert its settings to some previous state. It is called from the settings dialog when the user presses the "Cancel" button. NOTE: AbstractLayout implements this on behalf of all its subclasses by using Java Preferences.

Specified by:
revertSettings in interface CyLayoutAlgorithm

updateSettings

public void updateSettings()
This method is used to ask the algorithm to get its settings from the seetings dialog. It is called from the settings dialog when the user presses the "Done" or the "Execute" buttons. NOTE: AbstractLayout implements this on behalf of all its subclasses by using Java Preferences.

Specified by:
updateSettings in interface CyLayoutAlgorithm

getSettings

public LayoutProperties getSettings()
This method is used to ask the algorithm to get all of its tunables and return them to the caller.

Specified by:
getSettings in interface CyLayoutAlgorithm
Returns:
the layout properties for this algorithm

lockNodes

public void lockNodes(NodeView[] nodes)
DOCUMENT ME!

Specified by:
lockNodes in interface CyLayoutAlgorithm
Parameters:
nodes - DOCUMENT ME!

lockNode

public void lockNode(NodeView v)
DOCUMENT ME!

Specified by:
lockNode in interface CyLayoutAlgorithm
Parameters:
v - DOCUMENT ME!

unlockNode

public void unlockNode(NodeView v)
DOCUMENT ME!

Specified by:
unlockNode in interface CyLayoutAlgorithm
Parameters:
v - DOCUMENT ME!

unlockAllNodes

public void unlockAllNodes()
DOCUMENT ME!

Specified by:
unlockAllNodes in interface CyLayoutAlgorithm

halt

public void halt()
DOCUMENT ME!

Specified by:
halt in interface CyLayoutAlgorithm

www.cytoscape.org