Cytoscape 2.8.0 API

cytoscape.layout
Class AbstractLayout

java.lang.Object
  extended by cytoscape.layout.AbstractLayout
All Implemented Interfaces:
CyLayoutAlgorithm
Direct Known Subclasses:
GridNodeLayout

public abstract class AbstractLayout
extends Object
implements CyLayoutAlgorithm

The AbstractLayout provides nice starting point for Layouts written for Cytoscape.


Field Summary
protected  boolean canceled
           
protected  Dimension currentSize
           
protected  String edgeAttribute
           
protected  CyNetwork network
           
protected  CyNetworkView networkView
           
protected  String nodeAttribute
           
protected static TaskMonitor nullTaskMonitor
           
protected  HashMap propertyMap
           
protected  String propertyPrefix
           
protected  HashMap savedPropertyMap
           
protected  boolean selectedOnly
           
protected  Set<NodeView> staticNodes
           
protected  TaskMonitor taskMonitor
           
 
Constructor Summary
AbstractLayout()
          The Constructor is null
 
Method Summary
abstract  void construct()
          These abstract methods must be overridden.
 void doLayout()
          doLayout on current network view.
 void doLayout(CyNetworkView nview)
          doLayout on specified network view.
 void doLayout(CyNetworkView nview, TaskMonitor monitor)
          doLayout on specified network view with specified monitor.
 List<String> getInitialAttributeList()
          This returns the list of "attributes" that are provided by an algorithm for internal purposes.
abstract  String getName()
          getName is used to construct property strings for this layout.
 LayoutProperties getSettings()
          Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.
 JPanel getSettingsPanel()
          Returns a JPanel to be used as part of the Settings dialog for this layout algorithm.
 void halt()
          Halt the algorithm.
protected  void initialize_local()
          Initializes all local information, and is called immediately within the initialize() process.
 void initialize()
          Initializer, calls intialize_local to start construction process.
protected  boolean isLocked(NodeView v)
           
 void lockNode(NodeView v)
          Lock this node (i.e.
 void lockNodes(NodeView[] nodes)
          Lock these nodes (i.e.
protected  void resetLabelPositions()
          Deletes labelPosition attribute of selected nodes (if selectedOnly) or all nodes This has the effect of moving labels back to their parent nodes position
 void revertSettings()
          Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.
 void setLayoutAttribute(String attributeName)
          Set the name of the attribute to use for attribute dependent layout algorithms.
 void setSelectedOnly(boolean selectedOnly)
          Set the flag that indicates that this algorithm should only operate on the currently selected nodes.
 byte[] supportsEdgeAttributes()
          Returns the types of edge attributes supported by this algorithm.
 byte[] supportsNodeAttributes()
          Returns the types of node attributes supported by this algorithm.
 boolean supportsSelectedOnly()
          These methods should be overridden
abstract  String toString()
          toString is used to get the user-visible name of the layout
 void unlockAllNodes()
          Unlock all nodes
 void unlockNode(NodeView v)
          Unlock this node
 void updateSettings()
          Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

staticNodes

protected Set<NodeView> staticNodes

networkView

protected CyNetworkView networkView

network

protected CyNetwork network

selectedOnly

protected boolean selectedOnly

edgeAttribute

protected String edgeAttribute

nodeAttribute

protected String nodeAttribute

canceled

protected boolean canceled

currentSize

protected Dimension currentSize

propertyMap

protected HashMap propertyMap

savedPropertyMap

protected HashMap savedPropertyMap

taskMonitor

protected TaskMonitor taskMonitor

nullTaskMonitor

protected static TaskMonitor nullTaskMonitor

propertyPrefix

protected String propertyPrefix
Constructor Detail

AbstractLayout

public AbstractLayout()
The Constructor is null

Method Detail

construct

public abstract void construct()
These abstract methods must be overridden.


getName

public abstract String getName()
getName is used to construct property strings for this layout.

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

toString

public abstract String toString()
toString is used to get the user-visible name of the layout

Overrides:
toString in class Object

supportsSelectedOnly

public boolean supportsSelectedOnly()
These methods should be overridden

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

setSelectedOnly

public void setSelectedOnly(boolean selectedOnly)
Set the flag that indicates that this algorithm should only operate on the currently selected nodes.

Specified by:
setSelectedOnly in interface CyLayoutAlgorithm
Parameters:
selectedOnly - set to "true" if the algorithm should only apply to selected nodes only

supportsNodeAttributes

public byte[] supportsNodeAttributes()
Returns the types of node attributes supported by this algorithm. This should be overloaded by the specific algorithm

Specified by:
supportsNodeAttributes in interface CyLayoutAlgorithm
Returns:
the list of supported attribute types, or null if node attributes are not supported

supportsEdgeAttributes

public byte[] supportsEdgeAttributes()
Returns the types of edge attributes supported by this algorithm. This should be overloaded by the specific algorithm

Specified by:
supportsEdgeAttributes in interface CyLayoutAlgorithm
Returns:
the list of supported attribute types, or null if edge attributes are not supported

setLayoutAttribute

public void setLayoutAttribute(String attributeName)
Set the name of the attribute to use for attribute dependent layout algorithms.

Specified by:
setLayoutAttribute in interface CyLayoutAlgorithm
Parameters:
attributeName - The name of the attribute

getInitialAttributeList

public List<String> getInitialAttributeList()
This returns the list of "attributes" that are provided by an algorithm for internal purposes. For example, an edge-weighted algorithmn might seed the list of attributes with "unweighted". This should be overloaded by algorithms that intend to return custom attributes.

Specified by:
getInitialAttributeList in interface CyLayoutAlgorithm
Returns:
A (possibly empty) list of attributes

getSettingsPanel

public JPanel getSettingsPanel()
Returns a JPanel to be used as part of the Settings dialog for this layout 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()
Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.

Specified by:
revertSettings in interface CyLayoutAlgorithm

updateSettings

public void updateSettings()
Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.

Specified by:
updateSettings in interface CyLayoutAlgorithm

getSettings

public LayoutProperties getSettings()
Property handling -- these must be overridden by any algorithms that want to use properties or have a settings UI.

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

doLayout

public void doLayout()
doLayout on current network view.

Specified by:
doLayout in interface CyLayoutAlgorithm

doLayout

public void doLayout(CyNetworkView nview)
doLayout on specified network view.

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

doLayout

public void doLayout(CyNetworkView nview,
                     TaskMonitor monitor)
doLayout on specified network view with specified monitor.

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

initialize

public void initialize()
Initializer, calls intialize_local to start construction process.


initialize_local

protected void initialize_local()
Initializes all local information, and is called immediately within the initialize() process. The user is responsible for overriding this method to do any construction that may be necessary: for example, to initialize local per-edge or graph-wide data.


lockNodes

public void lockNodes(NodeView[] nodes)
Lock these nodes (i.e. prevent them from moving).

Specified by:
lockNodes in interface CyLayoutAlgorithm
Parameters:
nodes - An array of NodeView's to lock

lockNode

public void lockNode(NodeView v)
Lock this node (i.e. prevent it from moving).

Specified by:
lockNode in interface CyLayoutAlgorithm
Parameters:
v - A NodeView to lock

unlockNode

public void unlockNode(NodeView v)
Unlock this node

Specified by:
unlockNode in interface CyLayoutAlgorithm
Parameters:
v - A NodeView to unlock

isLocked

protected boolean isLocked(NodeView v)

unlockAllNodes

public void unlockAllNodes()
Unlock all nodes

Specified by:
unlockAllNodes in interface CyLayoutAlgorithm

halt

public void halt()
Halt the algorithm.

Specified by:
halt in interface CyLayoutAlgorithm

resetLabelPositions

protected void resetLabelPositions()
Deletes labelPosition attribute of selected nodes (if selectedOnly) or all nodes This has the effect of moving labels back to their parent nodes position


Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.