Cytoscape 2.8.0 API

cytoscape.render.stateful
Class CustomGraphic

java.lang.Object
  extended by cytoscape.render.stateful.CustomGraphic

public class CustomGraphic
extends Object

Represents all the information needed to define a custom graphic for a given NodeView.

Deprecation Note

The use of CustomGraphic replaces the entire old index-based custom graphic API. This includes all the NodeDetails methods (and their overridden implementations) that refer to custom graphics using indices:
   public int graphicCount(int node)
   public Shape graphicShape(int node, int graphicInx)
   public Paint graphicPaint(int node, int graphicInx)
   public byte graphicNodeAnchor(int node, int graphicInx)
 
To keep things completetly backwards compatible and to avoid introducing bugs, the new API methods are completely independent from the the old API methods. Thus, a custom graphic added using the new API will not be accessible from the old API and visa versa.

The reason for the deprecation is:

  1. Complexity in managing the indices.

    In order for multiple plugins to use the old API, each must monitor deletions to custom graphics and update their saved indices, since the indices will shift down as graphics are deleted. This management isn't even possible with the old API because there's no event mechanism to inform plugins when the indices change. Also, each plugin must keep a list of all indices for all graphics added, since the indices may not be contiguous.

  2. There is no way to ensure that an index you want to use will not be used by another plugin by the time you attempt to assign it (thread safety).

    Using indices forces the need for a locking mechanism to ensure you are guaranteed a unique and correct index independent of any other plugins.

For more information, see Mantis Bug 1500.

Author:
Michael L. Creech

Constructor Summary
CustomGraphic(Shape shape, Paint paint, byte anchor)
          Deprecated. 
CustomGraphic(Shape shape, PaintFactory factory)
          Constructor
 
Method Summary
 byte getAnchor()
          Deprecated. 
 Paint getPaint()
          Return the Paint that makes up this CustomGraphic.
 Paint getPaint(Rectangle2D bound)
           
 PaintFactory getPaintFactory()
           
 Shape getShape()
          Return the Shape that makes up this CustomGraphic.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CustomGraphic

public CustomGraphic(Shape shape,
                     PaintFactory factory)
Constructor

Parameters:
shape -
factory -

CustomGraphic

@Deprecated
public CustomGraphic(Shape shape,
                                Paint paint,
                                byte anchor)
Deprecated. 

Will be removed March 2011.

Parameters:
shape -
paint -
anchor -
Method Detail

getShape

public Shape getShape()
Return the Shape that makes up this CustomGraphic.


getPaint

public Paint getPaint()
Return the Paint that makes up this CustomGraphic.


getPaint

public Paint getPaint(Rectangle2D bound)

getPaintFactory

public PaintFactory getPaintFactory()

getAnchor

@Deprecated
public byte getAnchor()
Deprecated. 

Return the anchor for this CustomGraphic. This specifies where on the node's extents rectangle the graphic anchor point lies. The shape is rendered at a location which is equal to this anchor point plus the offset vector.


Cytoscape 2.8.0 API

Copyright 2010 Cytoscape Consortium. All rights reserved.