gumbo.visualize.data.impl.swing
Class SwingGraphVertex

java.lang.Object
  |
  +--gumbo.util.AbstractDisposable
        |
        +--gumbo.util.relation.AbstractTreeNodeDelegator
              |
              +--gumbo.graphic.space.AbstractSpaceNode
                    |
                    +--gumbo.graphic.impl.swing.SwingSpaceNode
                          |
                          +--gumbo.graphic.impl.swing.SwingShape
                                |
                                +--gumbo.visualize.data.impl.swing.SwingDataShape
                                      |
                                      +--gumbo.visualize.data.impl.swing.SwingGraphVertex
All Implemented Interfaces:
AxisBound3Boundable, AxisLayoutGraphic, BoundableGraphic, DataModelListener, Disposable, Graphic, GraphicGeometry, GraphicPresence, GraphicResource, GraphicView, InteractableGraphic, Interactor, IntersectableGraphic, LinkableGraphic, java.io.Serializable, SpaceNode, TransformNode, TranslationNode

public class SwingGraphVertex
extends SwingDataShape
implements LinkableGraphic

A default graph vertex implemented using a JPanel, and a JLabel for the auto-label. Intended for use with SwingGraphView and a layout engine, such as GraphLayoutEngine, which control layout.

Version:
$Revision: 1.1 $
Author:
Jon Barrilleaux (jonb@jmbaai.com) of JMB and Associates Inc.
See Also:
Serialized Form

Field Summary
static java.awt.Color BODY_COLOR
          Default shape body color (0-1).
static float BODY_OPACITY
          Default shape body opacity (0-1).
static java.awt.Dimension BODY_SIZE
          Default shape body size (pixels).
static java.awt.Font TEXT_FONT
          Default label text font.
 
Constructor Summary
SwingGraphVertex(PartView view)
           
 
Method Summary
protected  void drawBorder(java.awt.Color color)
          Called by the system to build and realize the graphic's border.
 Point3 getGraphicLinkCenter(Point3 retVal)
          Gets the "center" point to be used by a linking graphic's shape.
 Point3 getGraphicLinkEdge(Point3 point, Point3 retVal)
          In Swing, drawn shapes have a (+.5, -.5) bias.
protected  void implDispose()
          Disposes the super, then self.
 boolean isAutoSized()
          Called by system to determine if the graphic shape should be automatically sized to fit its contents, including the label (see getLabel()).
 void prepareGraphicPresence()
          Informs this graphic entity that, in anticipation of realization, it should update as needed those aspects of its graphic state (geometry, appearance) and that of any dependents (siblings, descendants) that can affect its presentation.
 void realizeGraphicPresence()
          Informs this graphic entity that external (sibling, ancestor) and internal (self, descendant) state changes that can affect its presentation are complete and assumed valid, and that it should update its presentation as needed to be consistent with its graphic state.
protected  void updateFeedback()
          Default implementation: Calls drawBorder(), with the color determined by DataFeedback.INSTANCE.feedbackColor().
 
Methods inherited from class gumbo.visualize.data.impl.swing.SwingDataShape
clientDataChanged, getAutoLabel, getDataView, initSwingDataShape
 
Methods inherited from class gumbo.graphic.impl.swing.SwingShape
getInteractorState, initSwingShape, newTreeNodeDelegate
 
Methods inherited from class gumbo.graphic.impl.swing.SwingSpaceNode
canIntersectGraphic, getGraphic, getGraphicAxisBound3, getGraphicLocalSpace, getGraphicTransform, getGraphicTranslation, initSwingSpaceNode, intersectGraphic, isSpaceTransforming, setGraphicTranslation
 
Methods inherited from class gumbo.graphic.space.AbstractSpaceNode
getGraphicSpaceTree
 
Methods inherited from class gumbo.util.relation.AbstractTreeNodeDelegator
getTreeNodeDelegate
 
Methods inherited from class gumbo.util.AbstractDisposable
dispose, isDisposed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gumbo.graphic.Graphic
getGraphic
 
Methods inherited from interface gumbo.util.Disposable
dispose, isDisposed
 
Methods inherited from interface gumbo.graphic.probe.AxisBound3Boundable
getGraphicAxisBound3
 
Methods inherited from interface gumbo.graphic.space.GraphicGeometry
getGraphicLocalSpace
 
Methods inherited from interface gumbo.graphic.space.TranslationNode
getGraphicTranslation, setGraphicTranslation
 
Methods inherited from interface gumbo.graphic.space.TransformNode
getGraphicTransform, isSpaceTransforming
 
Methods inherited from interface gumbo.graphic.space.SpaceNode
getGraphicSpaceTree
 

Field Detail

BODY_OPACITY

public static final float BODY_OPACITY
Default shape body opacity (0-1).

See Also:
Constant Field Values

BODY_COLOR

public static final java.awt.Color BODY_COLOR
Default shape body color (0-1).


BODY_SIZE

public static final java.awt.Dimension BODY_SIZE
Default shape body size (pixels).


TEXT_FONT

public static final java.awt.Font TEXT_FONT
Default label text font.

Constructor Detail

SwingGraphVertex

public SwingGraphVertex(PartView view)
Method Detail

isAutoSized

public boolean isAutoSized()
Called by system to determine if the graphic shape should be automatically sized to fit its contents, including the label (see getLabel()). Default implementation: Returns true (auto-sized).

Returns:
The behavior.

drawBorder

protected void drawBorder(java.awt.Color color)
Called by the system to build and realize the graphic's border. By convention, border color is used exclusively for interaction feedback. Default implementation: Builds a new contrasting border, and sets and realizes it with graphic.setBorder().

Parameters:
color - The dominant border color. Never null.

updateFeedback

protected void updateFeedback()
Default implementation: Calls drawBorder(), with the color determined by DataFeedback.INSTANCE.feedbackColor().

Overrides:
updateFeedback in class SwingShape

prepareGraphicPresence

public void prepareGraphicPresence()
Description copied from interface: GraphicPresence
Informs this graphic entity that, in anticipation of realization, it should update as needed those aspects of its graphic state (geometry, appearance) and that of any dependents (siblings, descendants) that can affect its presentation. Does not actually affect the presentation (see realizeGraphicDisplay()). Allows for efficient batching of graphic state changes.

Specified by:
prepareGraphicPresence in interface GraphicPresence
Overrides:
prepareGraphicPresence in class SwingSpaceNode

realizeGraphicPresence

public void realizeGraphicPresence()
Description copied from interface: GraphicPresence
Informs this graphic entity that external (sibling, ancestor) and internal (self, descendant) state changes that can affect its presentation are complete and assumed valid, and that it should update its presentation as needed to be consistent with its graphic state. Allows for efficient batching of graphic state realizations.

Specified by:
realizeGraphicPresence in interface GraphicPresence
Overrides:
realizeGraphicPresence in class SwingSpaceNode

getGraphicLinkCenter

public Point3 getGraphicLinkCenter(Point3 retVal)
Description copied from interface: LinkableGraphic
Gets the "center" point to be used by a linking graphic's shape. May not be the actual geometric center of this graphic's shape.

Specified by:
getGraphicLinkCenter in interface LinkableGraphic
Parameters:
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.

getGraphicLinkEdge

public Point3 getGraphicLinkEdge(Point3 point,
                                 Point3 retVal)
In Swing, drawn shapes have a (+.5, -.5) bias.

Specified by:
getGraphicLinkEdge in interface LinkableGraphic
Parameters:
point - Some point in space (inside, on, or outside this graphic's shape). Never null.
retVal - Return value object. Never null.
Returns:
Reference to retVal. Never null.

implDispose

protected void implDispose()
Disposes the super, then self.

Overrides:
implDispose in class SwingDataShape