de.saar.chorus.ubench
Class JDomGraph

Object
  extended by Component
      extended by Container
          extended by JComponent
              extended by JGraph
                  extended by ImprovedJGraph<NodeType,NodeData,EdgeType,EdgeData>
                      extended by JDomGraph
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Cloneable, Accessible, Scrollable, CellViewFactory

public class JDomGraph
extends ImprovedJGraph<NodeType,NodeData,EdgeType,EdgeData>
implements Cloneable

A Swing component that represents a labelled dominance graph.

Author:
Alexander Koller, Michaela Regneri
See Also:
ImprovedJGraph, Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class ImprovedJGraph
ImprovedJGraph.EdgeSortingComparator
 
Nested classes/interfaces inherited from class JGraph
JGraph.EmptySelectionModel
 
Nested classes/interfaces inherited from class JComponent
JComponent.AccessibleJComponent
 
Field Summary
 
Fields inherited from class JGraph
ANTIALIASED_PROPERTY, CROSS_GRID_MODE, DOT_GRID_MODE, EDITABLE_PROPERTY, GRAPH_LAYOUT_CACHE_PROPERTY, GRAPH_MODEL_PROPERTY, GRID_SIZE_PROPERTY, GRID_VISIBLE_PROPERTY, INVOKES_STOP_CELL_EDITING_PROPERTY, LINE_GRID_MODE, MARQUEE_HANDLER_PROPERTY, PORTS_VISIBLE_PROPERTY, SCALE_PROPERTY, SELECTION_MODEL_PROPERTY, VERSION
 
Fields inherited from class JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JDomGraph(DomGraph origin)
          Sets up an empty dominance graph.
 
Method Summary
 void addPopupListener(DomGraphPopupListener listener)
          Add a popup listener.
 void addSampleData()
          Add some sample nodes and edges to the graph.
 void addSampleFragmentMenus()
          Once the fragments have been computed, add some sample menu items to them.
 void clear()
          Remove all nodes and edges in the graph.
 void clearDominanceEdges()
          Removes all dominance edges from this graph.
 JDomGraph clone()
          Clones this graph.
 void computeFragments()
          Group the nodes of the graph into the maximal fragments.
 void computeLayout()
          Apply a layout algorithm to this graph.
 Fragment findFragment(DefaultGraphCell cell)
          Return the fragment a node or edge belongs to.
 Rectangle getBoundingBox()
           
 Set<DefaultEdge> getDominanceEdges()
           
 Set<Fragment> getFragments()
          Get the set of all fragments.
 Fragment getSourceFragment(DefaultEdge edge)
          Returns the fragment the source node of an edge belongs to.
 Fragment getTargetFragment(DefaultEdge edge)
          Returns the fragment the target node of an edge belongs to.
 Set<Fragment> getWccFragments(Set<DefaultGraphCell> wcc)
          Computes the Fragments contained in a wcc.
 List<Set<DefaultGraphCell>> getWccs()
           
 boolean isFragLeaf(DefaultGraphCell node)
          Determines whether a given node is a leaf in its fragment.
 boolean isFragRoot(DefaultGraphCell node)
          Determines wheter a given node is the root of its fragment.
 boolean isHnc()
           
 void printPositions()
          prints position and dimensions of all fragments and their node on screen.
 void removePopupListener(DomGraphPopupListener listener)
          Remove a popup listener.
 void setBoundingBox(Rectangle boundingBox)
           
 void setShowLabels(boolean b)
          Changing the preferences for displaying node labels
 
Methods inherited from class ImprovedJGraph
addEdge, addNode, addToMapList, adjustNodeWidths, computeAdjacency, computeNodeHeight, computeNodeWidth, findNodeOrEdgeAt, getChildren, getEdgeData, getEdges, getInEdges, getName, getNodeData, getNodeForName, getNodes, getOutEdges, getParents, getRightSibling, getSortedEdges, getSourceNode, getTargetNode, getToolTipText, isForest, isLeaf, isRelativeLeaf, isRelativeRoot, isRoot, setName
 
Methods inherited from class JGraph
addGraphSelectionListener, addSampleData, addSelectionCell, addSelectionCells, cancelEditing, clearSelection, cloneCells, convertValueToString, createBounds, createView, fromScreen, fromScreen, getCellBounds, getCellBounds, getDescendantList, getDescendants, getEditClickCount, getEditingCell, getFirstCellForLocation, getGraphLayoutCache, getGridColor, getGridMode, getGridSize, getHandleColor, getHandleSize, getHighlightColor, getInvokesStopCellEditing, getLockedHandleColor, getMarqueeColor, getMarqueeHandler, getMinimumMove, getModel, getNextCellForLocation, getNextViewAt, getNextViewAt, getPortForLocation, getPortViewAt, getPreferredScrollableViewportSize, getRoots, getRoots, getScale, getScrollableBlockIncrement, getScrollableTracksViewportHeight, getScrollableTracksViewportWidth, getScrollableUnitIncrement, getSelectionCell, getSelectionCells, getSelectionCount, getSelectionModel, getTolerance, getUI, getUIClassID, graphDidChange, isAntiAliased, isBendable, isCellEditable, isCellSelected, isCloneable, isConnectable, isDisconnectable, isDisconnectOnMove, isDragEnabled, isDropEnabled, isEditable, isEditing, isGridEnabled, isGridVisible, isMoveable, isMoveBelowZero, isPortsVisible, isSelectionEmpty, isSelectNewCells, isSizeable, main, removeGraphSelectionListener, removeSelectionCell, scrollCellToVisible, scrollPointToVisible, setAntiAliased, setBendable, setCloneable, setConnectable, setDisconnectable, setDisconnectOnMove, setDragEnabled, setDropEnabled, setEditable, setEditClickCount, setGraphLayoutCache, setGridColor, setGridEnabled, setGridMode, setGridSize, setGridVisible, setHandleColor, setHandleSize, setHighlightColor, setInvokesStopCellEditing, setLockedHandleColor, setMarqueeColor, setMarqueeHandler, setMinimumMove, setModel, setMoveable, setMoveBelowZero, setPortsVisible, setScale, setSelectionCell, setSelectionCells, setSelectionModel, setSelectNewCells, setSizeable, setTolerance, setUI, snap, snap, startEditingAtCell, stopEditing, toScreen, toScreen, updateAutoSize, updateUI
 
Methods inherited from class JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Accessible
getAccessibleContext
 

Constructor Detail

JDomGraph

public JDomGraph(DomGraph origin)
Sets up an empty dominance graph.

Parameters:
origin - the DomGraph represented here.
Method Detail

clear

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

Overrides:
clear in class ImprovedJGraph<NodeType,NodeData,EdgeType,EdgeData>

addSampleData

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


addSampleFragmentMenus

public void addSampleFragmentMenus()
Once the fragments have been computed, add some sample menu items to them.


printPositions

public void printPositions()
prints position and dimensions of all fragments and their node on screen.


computeLayout

public void computeLayout()
Apply a layout algorithm to this graph. Before the first call of this method, the graph won't be display properly because all nodes will be in the same place.

Specified by:
computeLayout in class ImprovedJGraph<NodeType,NodeData,EdgeType,EdgeData>

computeFragments

public void computeFragments()
Group the nodes of the graph into the maximal fragments. A fragment is a set of nodes that are connected by solid edges. Maximal fragments are maximal elements with respect to node set inclusion. This method adds new cells to the graph, one for each fragment, and adds the nodes and solid edges that belong to the fragment to this cell (as a group).


getDominanceEdges

public Set<DefaultEdge> getDominanceEdges()
Returns:
Returns the dominanceEdges.

getFragments

public Set<Fragment> getFragments()
Get the set of all fragments.

Returns:
the fragments.

addPopupListener

public void addPopupListener(DomGraphPopupListener listener)
Add a popup listener. This listener will be called every time the user selects an item from a (node or fragment) popup menu.

Parameters:
listener -

removePopupListener

public void removePopupListener(DomGraphPopupListener listener)
Remove a popup listener.

Parameters:
listener -

findFragment

public Fragment findFragment(DefaultGraphCell cell)
Return the fragment a node or edge belongs to. This method is only meaningful after fragments have been computed.

Parameters:
cell - a node or edge in the graph
Returns:
the fragment it belongs to; null if it doesn't belong to any fragment (e.g. a dominance edge)

getSourceFragment

public Fragment getSourceFragment(DefaultEdge edge)
Returns the fragment the source node of an edge belongs to.

Parameters:
edge - the edge
Returns:
the fragment of the edge's source node

getTargetFragment

public Fragment getTargetFragment(DefaultEdge edge)
Returns the fragment the target node of an edge belongs to.

Parameters:
edge - the edge
Returns:
the fragment of the edge's target node

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

isFragLeaf

public boolean isFragLeaf(DefaultGraphCell node)
Determines whether a given node is a leaf in its fragment.

Parameters:
node - the node
Returns:
true if there are no outgoing solid edges

isFragRoot

public boolean isFragRoot(DefaultGraphCell node)
Determines wheter a given node is the root of its fragment.

Parameters:
node - the node
Returns:
true if there are no incoming solid edges

setShowLabels

public void setShowLabels(boolean b)
Changing the preferences for displaying node labels

Parameters:
b - indicating whether or not to show labels (insted of names, default is true)

clearDominanceEdges

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


getWccFragments

public Set<Fragment> getWccFragments(Set<DefaultGraphCell> wcc)
Computes the Fragments contained in a wcc. In principle, this works for an abitrary Set of nodes (not just for wccs); it will return a Set of all fragments of which at least one node was in the node set.

Parameters:
wcc - a Set of nodes
Returns:
the Set of fragments represented by the argument node set

isHnc

public boolean isHnc()
Returns:
true if this graph is hypernormally connected

getWccs

public List<Set<DefaultGraphCell>> getWccs()
Returns:
the node sets representing this graph's weakly connected components