com.googlecode.sarasvati.visual
Class GraphToImageMapAdapter

java.lang.Object
  extended by com.googlecode.sarasvati.visual.GraphToImageMapAdapter
All Implemented Interfaces:
GraphToImageMap

public class GraphToImageMapAdapter
extends Object
implements GraphToImageMap

Provides default implementations for methods in the GraphToImageMap interface. All methods return null unless overridden except the iconForNode method, which returns either a RectangularNodeIcon or OvalNodeIcon depending on the type of the node passed in.

Author:
Paul Lorenz, chungonn

Constructor Summary
GraphToImageMapAdapter()
           
GraphToImageMapAdapter(String taskType)
           
 
Method Summary
 boolean drawArcLabels(Arc arc)
          Returns true unless overridden
 String getTaskType()
          TaskType default is "task".
 String hoverForArc(Arc arc)
          Returns null unless overridden.
 String hoverForNode(Node node)
          Returns null unless overridden.
 String hrefForArc(Arc arc)
          Returns null unless overridden.
 String hrefForNode(Node node)
          Returns null unless overridden.
 Icon iconForNode(Node node)
          Returns a RectangularNodeIcon for nodes with type of 'task' and a OvalNodeIcon for all other nodes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GraphToImageMapAdapter

public GraphToImageMapAdapter()

GraphToImageMapAdapter

public GraphToImageMapAdapter(String taskType)
Method Detail

drawArcLabels

public boolean drawArcLabels(Arc arc)
Returns true unless overridden

Specified by:
drawArcLabels in interface GraphToImageMap
Returns:
true if arc labels should be rendered, false otherwise
See Also:
GraphToImageMap.drawArcLabels(Arc)

getTaskType

public String getTaskType()
TaskType default is "task". It is used to determine the type of node icon returns by iconForNode(Node)


iconForNode

public Icon iconForNode(Node node)
Returns a RectangularNodeIcon for nodes with type of 'task' and a OvalNodeIcon for all other nodes.

Specified by:
iconForNode in interface GraphToImageMap
Parameters:
node - The graph node needing an icon
Returns:
An icon representing the given node.
See Also:
GraphToImageMap.iconForNode(com.googlecode.sarasvati.Node)

hoverForArc

public String hoverForArc(Arc arc)
Returns null unless overridden.

Specified by:
hoverForArc in interface GraphToImageMap
Parameters:
arc - The arc to generate the hover for.
Returns:
An String to display in a hover when the arc is moused over. May be null, in which case no hover will appear.

hoverForNode

public String hoverForNode(Node node)
Returns null unless overridden.

Specified by:
hoverForNode in interface GraphToImageMap
Parameters:
node - The node to generate the hover for.
Returns:
An String to display in a hover when the node is moused over. May be null, in which case no hover will appear.

hrefForArc

public String hrefForArc(Arc arc)
Returns null unless overridden.

Specified by:
hrefForArc in interface GraphToImageMap
Parameters:
arc - The arc to generate the HREF for
Returns:
An HREF for when the arc is clicked in the generated image. May be null, in which case no link is generated.

hrefForNode

public String hrefForNode(Node node)
Returns null unless overridden.

Specified by:
hrefForNode in interface GraphToImageMap
Parameters:
node - The node to generate the HREF for
Returns:
An HREF for when the node is clicked in the generated image. May be null, in which case no link is generated.


Copyright © 2012. All Rights Reserved.