fbench.graph
Class GraphEdge

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by fbench.graph.GraphElement
                  extended by fbench.graph.GraphEdge
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
Connection, ECTransition, IOLink, Link, ServiceBounds, ServiceLink, WithLink

public abstract class GraphEdge
extends GraphElement

An edge of a directed graph.

Version:
20051010/JHC - Made path a polyline., 20050630/JHC
Author:
JHC
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
 
Fields inherited from class fbench.graph.GraphElement
emborder
 
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
GraphEdge()
          Initializes an edge of a directed graph corresponding to the given DOM Element.
 
Method Summary
 boolean contains(int x, int y)
          Returns true if the given point is within 3 units of the path from source to destination.
static java.awt.Rectangle getBounds(java.awt.Component c)
          Computes the bounds in graph space of the given Component, which may be contained in a hierarchy of GraphNodes.
 java.awt.Point getDestPoint()
          Returns the point from which to end drawing the edge.
 java.awt.Rectangle getPreferredBounds()
          Returns the preferred bounds of the graph element.
 java.lang.Integer getPreferredLayer()
          The preferred layer for plotting the receiver - one of the GraphView constants EDGE_LAYER (bottom), IO_LAYER or NODE_LAYER (top).
 java.awt.Point getSourcePoint()
          Returns the point from which to begin drawing the edge.
 void paintComponent(java.awt.Graphics g)
           
 void setElement(org.w3c.dom.Element el)
          Sets the DOM Element represented by this component and updates its contents.
 void updatePath()
          Updates the path used to draw the element.
 
Methods inherited from class fbench.graph.GraphElement
addVisibleParameters, forElement, getCenter, getComponentNamed, getComponentNamed, getElement, getScaledAtt, hasVisibleParameters, isSelected, processMousePress, setSelected
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, 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, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, 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, updateUI
 
Methods inherited from class java.awt.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 java.awt.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, getName, 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, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

GraphEdge

public GraphEdge()
Initializes an edge of a directed graph corresponding to the given DOM Element.

Method Detail

getSourcePoint

public java.awt.Point getSourcePoint()
Returns the point from which to begin drawing the edge. Default is the center of the source element, or null if the source does not exist.


getDestPoint

public java.awt.Point getDestPoint()
Returns the point from which to end drawing the edge. Default is the center of the destination element, or null if the destination does not exist.


getPreferredBounds

public java.awt.Rectangle getPreferredBounds()
Returns the preferred bounds of the graph element. Default is the bounds of the drawn path.

Specified by:
getPreferredBounds in class GraphElement

contains

public boolean contains(int x,
                        int y)
Returns true if the given point is within 3 units of the path from source to destination.

Overrides:
contains in class javax.swing.JComponent

paintComponent

public void paintComponent(java.awt.Graphics g)
Overrides:
paintComponent in class javax.swing.JComponent

updatePath

public void updatePath()
Updates the path used to draw the element. By default, this is a straight line from source to destination.


getPreferredLayer

public java.lang.Integer getPreferredLayer()
Description copied from class: GraphElement
The preferred layer for plotting the receiver - one of the GraphView constants EDGE_LAYER (bottom), IO_LAYER or NODE_LAYER (top).

Specified by:
getPreferredLayer in class GraphElement

setElement

public void setElement(org.w3c.dom.Element el)
Description copied from class: GraphElement
Sets the DOM Element represented by this component and updates its contents.

Overrides:
setElement in class GraphElement

getBounds

public static final java.awt.Rectangle getBounds(java.awt.Component c)
Computes the bounds in graph space of the given Component, which may be contained in a hierarchy of GraphNodes.

Returns:
The computed bounds, or null if the given Component is null.