net.clackrouter.router.graph
Class RouterGraph

java.lang.Object
  extended by JGraph
      extended by net.clackrouter.router.graph.RouterGraph

public class RouterGraph
extends JGraph

The extension of JGraph to display a modular Clack router.

This is essentially a GPGraph from JGraphpad with some minor modifications. There is little Clack specific code in here, save tooltips


Nested Class Summary
static class RouterGraph.ScaledVertexRenderer
           
 class RouterGraph.ScaledVertexView
           
 
Field Summary
protected  java.awt.Image background
           
protected  java.awt.Color defaultBorderColor
           
protected  boolean displayelements
           
protected  java.awt.print.PageFormat pageFormat
           
protected  boolean pagevisible
           
static VertexRenderer renderer
           
 
Constructor Summary
RouterGraph()
           
RouterGraph(GraphModel model)
           
RouterGraph(GraphModel model, GraphLayoutCache view)
           
 
Method Summary
static void addSampleData(GraphModel model)
           
protected  EdgeView createEdgeView(JGraph graph, CellMapper mapper, java.lang.Object cell)
           
protected  VertexView createVertexView(JGraph graph, CellMapper cm, java.lang.Object v)
          Creates and returns a default GraphView.
 java.lang.Object[] getAll()
           
 java.awt.Image getBackgroundImage()
           
 java.lang.Object[] getEdges(java.lang.Object[] cells)
           
 java.lang.Object[] getEdgesBetween(java.lang.Object vertex1, java.lang.Object vertex2)
           
static GPUserObject getGPUserObject(java.lang.Object cell)
           
 java.lang.Object getNeighbour(java.lang.Object edge, java.lang.Object vertex)
           
 CellView getNextSelectableViewAt(CellView c, double x, double y)
           
 java.awt.print.PageFormat getPageFormat()
           
 java.lang.Object[] getSelectionEdges()
           
 java.lang.Object[] getSelectionVertices()
           
 java.lang.Object getSourceVertex(java.lang.Object edge)
           
 CellView getSourceView(java.lang.Object edge)
           
 java.lang.Object getTargetVertex(java.lang.Object edge)
           
 CellView getTargetView(java.lang.Object edge)
           
 java.lang.String getToolTipText(java.awt.event.MouseEvent event)
          Overrides JComponent'buttonSelect getToolTipText method in order to allow the graph controller to create a tooltip for the topmost cell under the mousepointer.
 java.lang.Object[] getVertices(java.lang.Object[] cells)
           
 boolean isDisplayElements()
           
 boolean isEdge(java.lang.Object object)
           
 boolean isGroup(java.lang.Object cell)
          Returns true if object is a vertex, that is, if it is not an instance of Port or Edge, and all of its children are ports, or it has no children.
 boolean isNeighbour(java.lang.Object v1, java.lang.Object v2)
          Returns true if the given vertices are conntected by a single edge in this document.
 boolean isPageVisible()
           
 boolean isPort(java.lang.Object object)
           
 boolean isVertex(java.lang.Object object)
          Returns true if object is a vertex, that is, if it is not an instance of Port or Edge, and all of its children are ports, or it has no children.
 void setBackgroundImage(java.awt.Image img)
           
 void setDisplayElements(boolean flag)
           
 void setPageFormat(java.awt.print.PageFormat format)
           
 void setPageVisible(boolean flag)
           
 void updateUI()
          Notification from the UIManager that the L&F has changed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pagevisible

protected boolean pagevisible

displayelements

protected boolean displayelements

pageFormat

protected transient java.awt.print.PageFormat pageFormat

background

protected java.awt.Image background

defaultBorderColor

protected transient java.awt.Color defaultBorderColor

renderer

public static VertexRenderer renderer
Constructor Detail

RouterGraph

public RouterGraph()

RouterGraph

public RouterGraph(GraphModel model)

RouterGraph

public RouterGraph(GraphModel model,
                   GraphLayoutCache view)
Method Detail

getGPUserObject

public static GPUserObject getGPUserObject(java.lang.Object cell)

addSampleData

public static void addSampleData(GraphModel model)

setPageFormat

public void setPageFormat(java.awt.print.PageFormat format)

getPageFormat

public java.awt.print.PageFormat getPageFormat()

setDisplayElements

public void setDisplayElements(boolean flag)

isDisplayElements

public boolean isDisplayElements()

setPageVisible

public void setPageVisible(boolean flag)

isPageVisible

public boolean isPageVisible()

setBackgroundImage

public void setBackgroundImage(java.awt.Image img)

getBackgroundImage

public java.awt.Image getBackgroundImage()

createEdgeView

protected EdgeView createEdgeView(JGraph graph,
                                  CellMapper mapper,
                                  java.lang.Object cell)

createVertexView

protected VertexView createVertexView(JGraph graph,
                                      CellMapper cm,
                                      java.lang.Object v)
Creates and returns a default GraphView.

Returns:
the default GraphView

isGroup

public boolean isGroup(java.lang.Object cell)
Returns true if object is a vertex, that is, if it is not an instance of Port or Edge, and all of its children are ports, or it has no children.


isVertex

public boolean isVertex(java.lang.Object object)
Returns true if object is a vertex, that is, if it is not an instance of Port or Edge, and all of its children are ports, or it has no children.


isPort

public boolean isPort(java.lang.Object object)

isEdge

public boolean isEdge(java.lang.Object object)

getSelectionVertices

public java.lang.Object[] getSelectionVertices()

getVertices

public java.lang.Object[] getVertices(java.lang.Object[] cells)

getSelectionEdges

public java.lang.Object[] getSelectionEdges()

getAll

public java.lang.Object[] getAll()

getEdges

public java.lang.Object[] getEdges(java.lang.Object[] cells)

getNeighbour

public java.lang.Object getNeighbour(java.lang.Object edge,
                                     java.lang.Object vertex)

getSourceVertex

public java.lang.Object getSourceVertex(java.lang.Object edge)

getTargetVertex

public java.lang.Object getTargetVertex(java.lang.Object edge)

getSourceView

public CellView getSourceView(java.lang.Object edge)

getTargetView

public CellView getTargetView(java.lang.Object edge)

getEdgesBetween

public java.lang.Object[] getEdgesBetween(java.lang.Object vertex1,
                                          java.lang.Object vertex2)

getToolTipText

public java.lang.String getToolTipText(java.awt.event.MouseEvent event)
Overrides JComponent'buttonSelect getToolTipText method in order to allow the graph controller to create a tooltip for the topmost cell under the mousepointer. This differs from JTree where the renderers tooltip is used.

NOTE: For JGraph to properly display tooltips of its renderers, JGraph must be a registered component with the ToolTipManager. This can be done by invoking ToolTipManager.sharedInstance().registerComponent(graph). This is not done automatically!

Parameters:
event - the MouseEvent that initiated the ToolTip display
Returns:
a string containing the tooltip or null if event is null

updateUI

public void updateUI()
Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager. Subclassers can override this to support different GraphUIs.

See Also:
JComponent.updateUI()

isNeighbour

public boolean isNeighbour(java.lang.Object v1,
                           java.lang.Object v2)
Returns true if the given vertices are conntected by a single edge in this document.


getNextSelectableViewAt

public CellView getNextSelectableViewAt(CellView c,
                                        double x,
                                        double y)