nz.ac.waikato.modeljunit.gui.visualisaton
Class JUNGHelper

java.lang.Object
  extended by nz.ac.waikato.modeljunit.gui.visualisaton.JUNGHelper

public class JUNGHelper
extends java.lang.Object

Author:
Jerramy Winchester

Nested Class Summary
static class JUNGHelper.LayoutType
           
 
Field Summary
static edu.uci.ics.jung.algorithms.layout.SpringLayout.LengthFunction<java.lang.Object> UNITLENGTHFUNCTION
           
 
Constructor Summary
JUNGHelper()
          Main Constructor to initialise class wide variables.
 
Method Summary
 EdgeInfo getEdge(Transition tr)
          This method will return an EdgeInfo object given a transition.
 edu.uci.ics.jung.graph.DirectedSparseMultigraph<java.lang.Object,java.lang.Object> getGraph()
          Get the JUNG graph.
static JUNGHelper getJUNGViewInstance()
          Get an instance of this class.
 edu.uci.ics.jung.algorithms.layout.Layout<java.lang.Object,java.lang.Object> getLayout(JUNGHelper.LayoutType type)
          This method will return the layout required for a visualisation viewer.
 javax.swing.tree.DefaultMutableTreeNode getRootTreeNode()
          This will return a root tree node.
 java.util.ArrayList<java.lang.Object> getVertices()
          This method will get all the vertices as an arraylist.
 void graphDoneReset(java.lang.String str)
          This is run when the graph is reset.
 void preExploredGraph(GraphListener graph)
          This is used to fully explore a graph.
 void resetRunTimeInformation()
          Reset JUNGView.
 void setEdgeDisplayed(Transition tr, boolean displayed)
          This will set the edge transition display value.
 void visitedEdge(Transition trans, boolean failed, java.lang.String failedMsg)
          This lets the visualisation panel know about any edges that have been visited and marks them as visited.
 void visitedVertex(java.lang.Object vertex, boolean failed)
          This method lets this panel know about vertexs that have been visited by the exploration algorythm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UNITLENGTHFUNCTION

public static final edu.uci.ics.jung.algorithms.layout.SpringLayout.LengthFunction<java.lang.Object> UNITLENGTHFUNCTION
Constructor Detail

JUNGHelper

public JUNGHelper()
Main Constructor to initialise class wide variables.

Method Detail

getJUNGViewInstance

public static JUNGHelper getJUNGViewInstance()
Get an instance of this class.

Returns:
A JUNGView instance.

getGraph

public edu.uci.ics.jung.graph.DirectedSparseMultigraph<java.lang.Object,java.lang.Object> getGraph()
Get the JUNG graph.

Returns:
The graph

setEdgeDisplayed

public void setEdgeDisplayed(Transition tr,
                             boolean displayed)
This will set the edge transition display value. This was implemented because the JUNG graph has limited ability to find edges efficiently.

Parameters:
tr - The transition we are looking for
displayed - whether or not it is displayed.

getEdge

public EdgeInfo getEdge(Transition tr)
This method will return an EdgeInfo object given a transition.

Parameters:
tr - The transition
Returns:
The EdgeInfo Object if it is found otherwise null.

getLayout

public edu.uci.ics.jung.algorithms.layout.Layout<java.lang.Object,java.lang.Object> getLayout(JUNGHelper.LayoutType type)
This method will return the layout required for a visualisation viewer.

Parameters:
type - The type of layout required.
Returns:
The desired layout.

preExploredGraph

public void preExploredGraph(GraphListener graph)
This is used to fully explore a graph.

Parameters:
graph - The GraphListener which contains the explored graph.

resetRunTimeInformation

public void resetRunTimeInformation()
Reset JUNGView. when a new graph is selected.


getRootTreeNode

public javax.swing.tree.DefaultMutableTreeNode getRootTreeNode()
This will return a root tree node.

Returns:
The root node of a JTree

getVertices

public java.util.ArrayList<java.lang.Object> getVertices()
This method will get all the vertices as an arraylist.

Returns:
The arraylist of vertecies.

graphDoneReset

public void graphDoneReset(java.lang.String str)
This is run when the graph is reset.

Parameters:
str -

visitedVertex

public void visitedVertex(java.lang.Object vertex,
                          boolean failed)
This method lets this panel know about vertexs that have been visited by the exploration algorythm.

Parameters:
vertex - The name of the vertex

visitedEdge

public void visitedEdge(Transition trans,
                        boolean failed,
                        java.lang.String failedMsg)
This lets the visualisation panel know about any edges that have been visited and marks them as visited.

Parameters:
failed -
action -
startState -
endState -


Copyright © 2009 ModelJUnit Project. All Rights Reserved.