anl.aida.viz.layout
Class KKLayout

java.lang.Object
  extended by anl.aida.viz.layout.KKLayout
All Implemented Interfaces:
Layout2D<TermNode>

public class KKLayout
extends java.lang.Object
implements Layout2D<TermNode>

Layout2D that wraps the jung KK layout.


Field Summary
private  edu.uci.ics.jung.algorithms.layout.KKLayout<TermNode,CGEdge> layout
           
 
Constructor Summary
KKLayout(ConceptGraph graph, java.awt.Dimension size)
           
 
Method Summary
 java.awt.geom.Point2D getLocation(TermNode obj)
          Gets the location of the object.
 void initialize()
          Initializes the layout.
 void initialize(java.awt.Dimension size)
          Initializes the layout with the specified size.
private  void initLayout(ConceptGraph graph, java.awt.Dimension size)
           
 void setLocation(TermNode node, double x, double y)
          Sets the location of the specified node.
 void sizeChanged(java.awt.Dimension size)
          Called when the display area size has changed.
 void swapGraph(ConceptGraph<TermNode> graph)
          Swaps the layouts current graph with the specified one.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

layout

private edu.uci.ics.jung.algorithms.layout.KKLayout<TermNode,CGEdge> layout
Constructor Detail

KKLayout

public KKLayout(ConceptGraph graph,
                java.awt.Dimension size)
Method Detail

initLayout

private void initLayout(ConceptGraph graph,
                        java.awt.Dimension size)

swapGraph

public void swapGraph(ConceptGraph<TermNode> graph)
Swaps the layouts current graph with the specified one. This assumes the graphs have equivalent term nodes and it preserves the locations.

Specified by:
swapGraph in interface Layout2D<TermNode>
Parameters:
graph - the graph to swap in.

setLocation

public void setLocation(TermNode node,
                        double x,
                        double y)
Sets the location of the specified node.

Specified by:
setLocation in interface Layout2D<TermNode>
Parameters:
node - the node whose location we want to set
x - the x coordinate
y - the y coordinate

initialize

public void initialize()
Initializes the layout. This should be called prior to calling getLocation.

Specified by:
initialize in interface Layout2D<TermNode>

initialize

public void initialize(java.awt.Dimension size)
Initializes the layout with the specified size.

Specified by:
initialize in interface Layout2D<TermNode>
Parameters:
size - the size

getLocation

public java.awt.geom.Point2D getLocation(TermNode obj)
Gets the location of the object.

Specified by:
getLocation in interface Layout2D<TermNode>
Parameters:
obj - the object whose location we want
Returns:
the location of the object.

sizeChanged

public void sizeChanged(java.awt.Dimension size)
Called when the display area size has changed.

Specified by:
sizeChanged in interface Layout2D<TermNode>
Parameters:
size - the new size