dk.klafbang.tincpn.animation.plugin
Class Graph

java.lang.Object
  extended by dk.klafbang.tincpn.gui.sheet.Sheet
      extended by dk.klafbang.tincpn.animation.AnimationSheet
          extended by dk.klafbang.tincpn.animation.plugin.Graph
All Implemented Interfaces:
dk.klafbang.tincpn.gui.sheet.hook.ScrollWrap

@Note(value="This was previously called GraphSheet")
public class Graph
extends dk.klafbang.tincpn.animation.AnimationSheet
implements dk.klafbang.tincpn.gui.sheet.hook.ScrollWrap

Graph is meant to draw 2D graphs.

This feature is used to visualise state-spaces, but the interface is general enough, it can be used for other things as well.

You may also want to take a look at this animation object's 3D counterpart, Graph3D

Since:
1.0
Author:
Michael Westergaard
See Also:
Dining Philosophers example, Distributed Database example, Graph3D

Constructor Summary
Graph(java.lang.String name, java.lang.String id)
          Constructs a Graph object.
 
Method Summary
 javax.swing.JComponent createAnimation()
           
 void createEdge(java.lang.String source, java.lang.String target, java.lang.String label)
          Create a new edge from source to target with the specified label.
 void createEdge2(java.lang.String source, java.lang.String target)
          Create a new edge from source to target with no label.
 void createEdges(java.lang.String[] sources, java.lang.String[] targets, java.lang.String[] labels)
           
 void createEdges2(java.lang.String[] sources, java.lang.String[] targets)
           
 void createVertex(java.lang.String name)
          Create a new vertex with the given name.
 void createVertexes(java.lang.String[] names)
           
 void doLayout()
          Layout the graph.
 java.awt.Dimension getPreferredSize()
           
 
Methods inherited from class dk.klafbang.tincpn.animation.AnimationSheet
canCoexistWith, getComponentImpl
 
Methods inherited from class dk.klafbang.tincpn.gui.sheet.Sheet
addSheetHook, getComponent, getIndexNode, getText, removeComponent, setText
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Graph

public Graph(java.lang.String name,
             java.lang.String id)
Constructs a Graph object.

Parameters:
name - name of the Graph
id -
Method Detail

getPreferredSize

public java.awt.Dimension getPreferredSize()
Specified by:
getPreferredSize in class dk.klafbang.tincpn.gui.sheet.Sheet
See Also:
Sheet.getPreferredSize()

createAnimation

public javax.swing.JComponent createAnimation()
Specified by:
createAnimation in class dk.klafbang.tincpn.animation.AnimationSheet
See Also:
AnimationSheet.createAnimation()

createVertex

public void createVertex(java.lang.String name)
Create a new vertex with the given name.

Parameters:
name - the name

createVertexes

public void createVertexes(java.lang.String[] names)
Parameters:
names -

createEdge

public void createEdge(java.lang.String source,
                       java.lang.String target,
                       java.lang.String label)
                throws java.lang.Exception
Create a new edge from source to target with the specified label.

Parameters:
source - the source
target - the target
label - the label
Throws:
java.lang.Exception

createEdges

public void createEdges(java.lang.String[] sources,
                        java.lang.String[] targets,
                        java.lang.String[] labels)
                 throws java.lang.Exception
Parameters:
sources -
targets -
labels -
Throws:
java.lang.Exception

createEdge2

public void createEdge2(java.lang.String source,
                        java.lang.String target)
Create a new edge from source to target with no label.

Parameters:
source - the source
target - the target

createEdges2

public void createEdges2(java.lang.String[] sources,
                         java.lang.String[] targets)
                  throws java.lang.Exception
Parameters:
sources -
targets -
Throws:
java.lang.Exception

doLayout

public void doLayout()
Layout the graph.