Class AbstractGraphElementComponent
java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
org.graffiti.plugin.view.GraphElementComponent
org.graffiti.plugins.views.defaults.AbstractGraphElementComponent
- All Implemented Interfaces:
 ImageObserver,MenuContainer,Serializable,GraphicAttributeConstants,GraffitiViewComponent,GraphElementComponentInterface
- Direct Known Subclasses:
 EdgeComponent,NodeComponent
public abstract class AbstractGraphElementComponent extends GraphElementComponent implements GraffitiViewComponent, GraphicAttributeConstants
Class that shares common members for all GraphElementComponents.
- Version:
 - $Revision: 1.16 $
 - See Also:
 - Serialized Form
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Component
Component.BaselineResizeBehavior - 
Field Summary
Fields inherited from class javax.swing.JComponent
TOOL_TIP_TEXT_KEY, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWFields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface org.graffiti.graphics.GraphicAttributeConstants
ABOVE, ABOVELEFT, ABOVERIGHT, ABSHOR, ABSVERT, ALIGNMENT, ALIGNSEGMENT, ANCHOR, ARROWHEAD, ARROWTAIL, AUTO_OUTSIDE, AXISCOLOR, BELOW, BELOWLEFT, BELOWRIGHT, BENDS, BENDS_PATH, BGIMAGE, BLUE, BORDER_BOTTOM_CENTER, BORDER_BOTTOM_LEFT, BORDER_BOTTOM_RIGHT, BORDER_LEFT_BOTTOM, BORDER_LEFT_CENTER, BORDER_LEFT_TOP, BORDER_RIGHT_BOTTOM, BORDER_RIGHT_CENTER, BORDER_RIGHT_TOP, BORDER_TOP_CENTER, BORDER_TOP_LEFT, BORDER_TOP_RIGHT, CATEGORY_BACKGROUND_A, CATEGORY_BACKGROUND_B, CATEGORY_BACKGROUND_C, CENTERED, CENTERED_FIT, CHARTBACKGROUNDCOLOR, CIRCLE_CLASSNAME, COLOR, COMMON, COORD_PATH, COORDINATE, COORDX_PATH, COORDY_PATH, CUBICSPLINE, CUBICSPLINE_CLASSNAME, DEFAULT_CAP_B, DEFAULT_CAP_R, DEFAULT_JOIN, DEFAULT_MITER, DIM_PATH, DIMENSION, DIMH_PATH, DIMW_PATH, DOCKING, DOCKING_PATH, ELLIPSE_CLASSNAME, FILLCOLOR, FILLCOLOR_PATH, FONTNAME, FONTSIZE, FONTSTYLE, FRAMECOLOR, FRAMETHICKNESS, FRAMETHICKNESS_PATH, GRADIENT, GRAPHICS, GREEN, GRIDCOLOR, HEATMAP_LOWER_COL, HEATMAP_MIDDLE_COL, HEATMAP_UPPER_COL, HEIGHT, HIDDEN, IMAGE, IN, INSIDEBOTTOM, INSIDEBOTTOMLEFT, INSIDEBOTTOMRIGHT, INSIDELEFT, INSIDERIGHT, INSIDETOP, INSIDETOPLEFT, INSIDETOPRIGHT, LABEL, LABEL_ATTRIBUTE_PATH, LABEL_DISTANCE, LABELGRAPHICS, LABELOFFSET, LEFT, LINEMODE, LINETYPE, LINEWIDTH_PATH, LOCALALIGN, MAXIMIZE, NAME, NEARSOURCE, NEARTARGET, OPAC, OUT, OUTLINE_PATH, POLYCLOSED_CLASSNAME, POLYLINE, POLYLINE_CLASSNAME, PORT, PORTS, PORTS_PATH, POSITION, RECTANGLE_CLASSNAME, RED, REF, RELALIGN, RELHOR, RELVERT, RIGHT, ROUNDING, SHADOWCOLOR, SHADOWOFFSET, SHAPE, SHAPE_DESC_PATH, SHAPE_PATH, SHAPEDESCRIPTION, SMOOTH_CLASSNAME, SMOOTHLINE, SOURCE, SQUARESPLINE, SQUARESPLINE_CLASSNAME, STRAIGHTLINE, STRAIGHTLINE_CLASSNAME, TARGET, TEXTCOLOR, THICKNESS, TILED, WIDTH, X, YFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH - 
Method Summary
Modifier and Type Method Description voidaddAttributeComponent(Attribute attr, GraffitiViewComponent ac)Adds anAttributeand itsGraffitiViewComponentto the list of registered attributes that can be displayed.voidaddDependentComponent(GraphElementComponent comp)Adds aGraphElementComponentto the list of dependentGraphElementComponents.voidattributeChanged(Attribute attr)Called when an attribute of the GraphElement represented by this component has changed.voidclearAttributeComponentList()Removes all entries in the attributeComponent list.voidclearDependentComponentList()Removes aGraphElementComponentfrom the list of dependentGraphElementComponents.booleancontains(int x, int y)Returns whether the given coordinates lie within this component and within its encapsulated shape.voidcreateNewShape(CoordinateSystem coordSys)Called to initialize the shape of the NodeComponent correctly.abstract voidcreateStandardShape()Called to initialize and draw a standard shape, if the specified shape class could not be found.AttributeComponentgetAttributeComponent(Attribute attr)Returns the attributeComponents of given attribute.Iterator<GraffitiViewComponent>getAttributeComponentIterator()Returns the attributeComponents of given attribute.Collection<GraffitiViewComponent>getAttributeComponents()List<GraphElementComponent>getDependentGraphElementComponents()GraphElementgetGraphElement()Returns the graphElement.GraphElementShapegetShape()Returns GraphElementShape objectvoidgraphicAttributeChanged(Attribute attr)Called when a graphic attribute of the GraphElement represented by this component has changed.voidnonGraphicAttributeChanged(Attribute attr)Called when a non-graphic attribute of the GraphElement represented by this component has changed.voidpaintComponent(Graphics g)Paints the graph element contained in this component.voidremoveAttributeComponent(Attribute attr)Removes aGraffitiViewComponentof anAttributefrom collection of attribute components.voidremoveDependentComponent(GraphElementComponent comp)Removes aGraphElementComponentfrom the list of dependentGraphElementComponents.voidrepaint(long tm, int x, int y, int width, int height)Overrides the original method to deal with zoomable containers It will not call the original repaint, which will call the repaintmanager with unzoomed coordinates and local coordinates relativ to this graphcomponent so x and y are always 0 to create the correct repaint region we call the parent frame with new coordinates, which regard the zoom the parent will then call its repaintmanager, which will have then the correct coordinates to paint.Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, 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, getUI, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, 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, updateUIMethods 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, transferFocusDownCycle, validateMethods 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, getAccessibleContext, 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, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, 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, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle 
- 
Method Details
- 
getShape
Returns GraphElementShape object- Specified by:
 getShapein interfaceGraphElementComponentInterface- Returns:
 - DOCUMENT ME!
 
 - 
addAttributeComponent
Adds anAttributeand itsGraffitiViewComponentto the list of registered attributes that can be displayed. This attribute is then treated as dependent on the position, size etc. of thisGraphElement.- Specified by:
 addAttributeComponentin interfaceGraphElementComponentInterface- Parameters:
 attr- the attribute that is registered as being able to be displayed.ac- the component that will be used to display the attribute.
 - 
addDependentComponent
Adds aGraphElementComponentto the list of dependentGraphElementComponents. These will nearly always beEdgeComponents that are dependent on their source or target nodes.- Specified by:
 addDependentComponentin interfaceGraphElementComponentInterface- Parameters:
 comp- theGraphElementComponentthat is added to the list of dependent components.
 - 
getDependentGraphElementComponents
 - 
attributeChanged
Called when an attribute of the GraphElement represented by this component has changed.- Specified by:
 attributeChangedin interfaceGraffitiViewComponent- Specified by:
 attributeChangedin interfaceGraphElementComponentInterface- Parameters:
 attr- the attribute that has triggered the event.- Throws:
 ShapeNotFoundException- DOCUMENT ME!
 - 
clearDependentComponentList
public void clearDependentComponentList()Removes aGraphElementComponentfrom the list of dependentGraphElementComponents.- Specified by:
 clearDependentComponentListin interfaceGraphElementComponentInterface
 - 
createNewShape
Called to initialize the shape of the NodeComponent correctly. Also callsrepaint().- Specified by:
 createNewShapein interfaceGraffitiViewComponent- Specified by:
 createNewShapein interfaceGraphElementComponentInterface- Parameters:
 coordSys- TODO- Throws:
 ShapeNotFoundException- thrown when the shape class couldn't be resolved.
 - 
createStandardShape
public abstract void createStandardShape()Called to initialize and draw a standard shape, if the specified shape class could not be found.- Specified by:
 createStandardShapein interfaceGraphElementComponentInterface
 - 
getAttributeComponent
Returns the attributeComponents of given attribute.- Specified by:
 getAttributeComponentin interfaceGraphElementComponentInterface- Parameters:
 attr-- Returns:
 - Map
 
 - 
getAttributeComponentIterator
Returns the attributeComponents of given attribute.- Specified by:
 getAttributeComponentIteratorin interfaceGraphElementComponentInterface- Returns:
 - Map
 
 - 
getAttributeComponents
- Specified by:
 getAttributeComponentsin interfaceGraphElementComponentInterface
 - 
getGraphElement
Returns the graphElement.- Specified by:
 getGraphElementin interfaceGraphElementComponentInterface- Returns:
 - GraphElement
 
 - 
clearAttributeComponentList
public void clearAttributeComponentList()Removes all entries in the attributeComponent list.- Specified by:
 clearAttributeComponentListin interfaceGraphElementComponentInterface
 - 
contains
public boolean contains(int x, int y)Returns whether the given coordinates lie within this component and within its encapsulated shape. The coordinates are assumed to be relative to the coordinate system of this component.- Overrides:
 containsin classGraphElementComponent- See Also:
 Component.contains(int, int)
 - 
graphicAttributeChanged
Called when a graphic attribute of the GraphElement represented by this component has changed.- Specified by:
 graphicAttributeChangedin interfaceGraphElementComponentInterface- Parameters:
 attr- the graphic attribute that has triggered the event.- Throws:
 ShapeNotFoundException- DOCUMENT ME!
 - 
nonGraphicAttributeChanged
Called when a non-graphic attribute of the GraphElement represented by this component has changed.- Specified by:
 nonGraphicAttributeChangedin interfaceGraphElementComponentInterface- Parameters:
 attr- the attribute that has triggered the event.- Throws:
 ShapeNotFoundException- DOCUMENT ME!
 - 
paintComponent
Paints the graph element contained in this component.- Overrides:
 paintComponentin classGraphElementComponent- Parameters:
 g- the graphics context in which to paint.- See Also:
 JComponent.paintComponent(Graphics)
 - 
removeAttributeComponent
Removes aGraffitiViewComponentof anAttributefrom collection of attribute components.- Specified by:
 removeAttributeComponentin interfaceGraphElementComponentInterface- Parameters:
 attr- the attribute that has to be removed
 - 
removeDependentComponent
Removes aGraphElementComponentfrom the list of dependentGraphElementComponents.- Specified by:
 removeDependentComponentin interfaceGraphElementComponentInterface- Parameters:
 comp- theGraphElementComponentthat is removed from the list of dependent components.
 - 
repaint
public void repaint(long tm, int x, int y, int width, int height)Overrides the original method to deal with zoomable containers It will not call the original repaint, which will call the repaintmanager with unzoomed coordinates and local coordinates relativ to this graphcomponent so x and y are always 0 to create the correct repaint region we call the parent frame with new coordinates, which regard the zoom the parent will then call its repaintmanager, which will have then the correct coordinates to paint. This component will then be repainted, because it falls in the clipping bounds with regard to the current zoom- Overrides:
 repaintin classJComponent
 
 -