Class JDomGraph

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.jgraph.JGraph
de.saar.chorus.ubench.jdomgraph.JDomGraph
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Cloneable, Accessible, Scrollable

public class JDomGraph extends org.jgraph.JGraph implements Cloneable
A Swing component that represents a labelled dominance graph.
Author:
Alexander Koller, Michaela Regneri
See Also:
  • Constructor Details

    • JDomGraph

      public JDomGraph()
      Sets up an empty dominance graph.
      Parameters:
      origin - the DomGraph represented here.
  • Method Details

    • getUpperBoundFont

      public Font getUpperBoundFont()
    • setLayoutType

      public void setLayoutType(Preferences.LayoutType lt)
    • getLayoutType

      public Preferences.LayoutType getLayoutType()
    • clear

      public void clear()
      Remove all nodes and edges in the graph.
    • defaultNodeAttributes

      protected org.jgraph.graph.AttributeMap defaultNodeAttributes(NodeType type)
      Compute JGraph attributes for a node of the given type. (So far, the type is ignored.)
      Parameters:
      type - the node type.
      Returns:
      an AttributeMap object with reasonable style information.
    • addFragment

      public Fragment addFragment(Fragment fragment)
    • defaultEdgeAttributes

      protected org.jgraph.graph.AttributeMap defaultEdgeAttributes(EdgeType type)
      Compute JGraph attributes for a node of the given type.
      Parameters:
      type - the edge type.
      Returns:
      an AttributeMap object with reasonable style information.
    • addNode

      public org.jgraph.graph.DefaultGraphCell addNode(String name, NodeData data)
      Adds a new node to the graph (and the underlying model). The attributes of the new node are computed automatically from the node data.
      Parameters:
      data - the data for the new node.
      Returns:
      a new DefaultGraphCell object in this graph.
    • addSampleData

      public void addSampleData()
      Add some sample nodes and edges to the graph.
    • addEdge

      public org.jgraph.graph.DefaultEdge addEdge(EdgeData data, org.jgraph.graph.DefaultGraphCell src, org.jgraph.graph.DefaultGraphCell tgt)
      Adds a new edge to the graph (and the underlying model). The edge goes from the 0-th port of the node src to the 0-th port of the node tgt. The style attributes of the new edge are computed automatically from the edge data.
      Parameters:
      data - the data for the new edge.
      src - the node cell at which the edge should start.
      tgt - the node cell at which the edge should end.
      Returns:
      a new DefaultEdge object in this graph.
    • getDominanceEdges

      public Set<org.jgraph.graph.DefaultEdge> getDominanceEdges()
      Returns:
      Returns the dominanceEdges.
    • getBoundingBox

      public Rectangle getBoundingBox()
      Returns:
      Returns the boundingBox.
    • setBoundingBox

      public void setBoundingBox(Rectangle boundingBox)
      Parameters:
      boundingBox - The boundingBox to set.
    • clone

      public JDomGraph clone()
      Clones this graph.
      Overrides:
      clone in class Object
      Returns:
      the clone
    • getSourceNode

      public org.jgraph.graph.DefaultGraphCell getSourceNode(org.jgraph.graph.DefaultEdge edge)
      Returns the source node of an edge.
      Parameters:
      edge - the edge
      Returns:
      the edge's source node
    • getTargetNode

      public org.jgraph.graph.DefaultGraphCell getTargetNode(org.jgraph.graph.DefaultEdge edge)
      Returns the target node of and edge.
      Parameters:
      edge - the edge
      Returns:
      the edge's target node
    • clearDominanceEdges

      public void clearDominanceEdges()
      Removes all dominance edges from this graph.
    • getNodeData

      public NodeData getNodeData(org.jgraph.graph.DefaultGraphCell node)
      Get the node data of a node cell.
      Parameters:
      node -
      Returns:
      the node data.
    • getEdgeData

      public EdgeData getEdgeData(org.jgraph.graph.DefaultEdge edge)
      Get the edge data of an edge cell.
      Parameters:
      edge -
      Returns:
      the edge data.
    • getNodeForName

      public org.jgraph.graph.DefaultGraphCell getNodeForName(String name)
      Look up the node with the specified name.
      Parameters:
      name -
      Returns:
      that node.
    • getLabeltype

      public LayoutOptions.LabelType getLabeltype()
    • setLabeltype

      public void setLabeltype(LayoutOptions.LabelType labeltype)
    • getEdges

      public Set<org.jgraph.graph.DefaultEdge> getEdges()
    • setEdges

      public void setEdges(Set<org.jgraph.graph.DefaultEdge> edges)
    • getLayouttype

      public Preferences.LayoutType getLayouttype()
    • setLayouttype

      public void setLayouttype(Preferences.LayoutType layouttype)
    • getName

      public String getName()
      Overrides:
      getName in class Component
    • setName

      public void setName(String name)
      Overrides:
      setName in class Component
    • getNodes

      public Set<org.jgraph.graph.DefaultGraphCell> getNodes()
    • setNodes

      public void setNodes(Set<org.jgraph.graph.DefaultGraphCell> nodes)
    • setDominanceEdges

      public void setDominanceEdges(Set<org.jgraph.graph.DefaultEdge> dominanceEdges)
    • getOutEdges

      public List<org.jgraph.graph.DefaultEdge> getOutEdges(org.jgraph.graph.DefaultGraphCell node)
      Compute the outgoing edges for a node. The returned list lists the complete edges (with types). The list is sorted before returning by the EdgeSortingComparator
      Parameters:
      node - the node to compute the outgoing edges for
      Returns:
      the sorted list of out-edges
    • setUpperBoundFont

      public void setUpperBoundFont(Font upperBoundFont)
    • getToolTipText

      public String getToolTipText(MouseEvent e)
      This overrides the getToolTipText(MouseEvent) method of JGraph. As JGraph overwrites the original Component method but ignores the tooltips returned by the user objects of its cells, the tooltips are reconfigured here.
      Overrides:
      getToolTipText in class org.jgraph.JGraph
      Returns:
      the tooltip text of the recent node
      See Also:
      • JGraph.getToolTipText(MouseEvent)