fbench.graph
Class GraphElement

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by fbench.graph.GraphElement
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable
Direct Known Subclasses:
AlgorithmComponent, GraphEdge, GraphNode, VersionInfo

public abstract class GraphElement
extends javax.swing.JComponent

A component representing the node or edge of a directed graph corresponding to an Element of the DOM of an IEC 61499 LibraryElement.

Version:
20070130/JP - Selection highlight colour has been changed from Yellow to light blue., 20051109/JHC - Removed ItemSelectable implementation; all notifications now via DOM Events model., 20051012/JHC - Made getScaledAtt() result an int ; moved component to front in layer when selected in setSelected()., 20050811/JHC - Made ItemSelectable., 20050802/JHC
Author:
JHC, JP
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
static javax.swing.border.Border emborder
          The empty border.
 
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
GraphElement()
           
 
Method Summary
 void addVisibleParameters(ViewModel view)
          Adds the visible parameters of this element (if any) to the given GraphView.
static GraphElement forElement(org.w3c.dom.Element el)
          Returns a GraphElement encapsulating the given DOM Element, or null if no such GraphElement exists.
static java.awt.Point getCenter(java.awt.Rectangle r)
          Returns the center point of the given Rectangle.
 java.awt.Component getComponentNamed(java.lang.String compname)
          Returns the contained component with the given name or null if no component with the given name is found.
static java.awt.Component getComponentNamed(java.lang.String compname, java.awt.Container cont)
          Returns the component with the given name in the given Container or null if no component with the given name is found.
 org.w3c.dom.Element getElement()
          Returns the DOM element represented by the receiver.
abstract  java.awt.Rectangle getPreferredBounds()
          Returns the preferred bounds of the graph element or null if the bounds cannot be computed.
abstract  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).
 int getScaledAtt(java.lang.String attname)
          Get the named attribute, e.g.
 boolean hasVisibleParameters()
          Returns true if the graph element has parameters that are visible on a graph containing the element, or false (the default value) if not.
 boolean isSelected()
          Returns the selection state.
 void processMousePress(java.awt.event.MouseEvent evt)
           
 void setElement(org.w3c.dom.Element el)
          Sets the DOM Element represented by this component and updates its contents.
 void setSelected(boolean newState)
          Sets the selection state.
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, 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
 

Field Detail

emborder

public static final javax.swing.border.Border emborder
The empty border.

Constructor Detail

GraphElement

public GraphElement()
Method Detail

getPreferredBounds

public abstract java.awt.Rectangle getPreferredBounds()
Returns the preferred bounds of the graph element or null if the bounds cannot be computed.


setElement

public void setElement(org.w3c.dom.Element el)
Sets the DOM Element represented by this component and updates its contents.


getElement

public org.w3c.dom.Element getElement()
Returns the DOM element represented by the receiver.


setSelected

public void setSelected(boolean newState)
Sets the selection state.


isSelected

public boolean isSelected()
Returns the selection state.


getCenter

public static java.awt.Point getCenter(java.awt.Rectangle r)
Returns the center point of the given Rectangle.

Returns:
The center point, or null if the given Rectangle is null

forElement

public static GraphElement forElement(org.w3c.dom.Element el)
Returns a GraphElement encapsulating the given DOM Element, or null if no such GraphElement exists.


processMousePress

public void processMousePress(java.awt.event.MouseEvent evt)

getScaledAtt

public int getScaledAtt(java.lang.String attname)
Get the named attribute, e.g. "x" from the element, scaled per IEC 61499-2. If no such number exists, return 0.


getPreferredLayer

public abstract 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).


hasVisibleParameters

public boolean hasVisibleParameters()
Returns true if the graph element has parameters that are visible on a graph containing the element, or false (the default value) if not.


addVisibleParameters

public void addVisibleParameters(ViewModel view)
Adds the visible parameters of this element (if any) to the given GraphView.


getComponentNamed

public java.awt.Component getComponentNamed(java.lang.String compname)
Returns the contained component with the given name or null if no component with the given name is found.


getComponentNamed

public static java.awt.Component getComponentNamed(java.lang.String compname,
                                                   java.awt.Container cont)
Returns the component with the given name in the given Container or null if no component with the given name is found.