gumbo.visualize.data.impl.swing
Class SwingGraphView

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

public class SwingGraphView
extends SwingSpaceNode
implements GraphicView

A default graph view implemented using a JLayeredPane, which manages content shapes (vertices and edges) in layers. Shapes can be placed anywhere in the space, and can be overlapping. The client is responsible for view layout (see gumbo.visualize.data.layout). The default space tree delegate is an auto-node with a new relationship, wrapped as a root node.

In Swing, only content in the (+X, +Y) quadrant of the display space will be seen; and, the size of the display space (pane) effects the display scroll bar sensitivity. As such, the content bound is normalized during display validation so that it is in the visible quadrant and as close to the origin as possible; and, the space bound is set to the normalized content bound plus any border inset. Normalizing the content bound requires that all space tree children implement TranslationNode and AxisBound3Boundable.

Each child space node (vertex, edge) and its decorations (callouts, vertex ports), which collectively form the child shape, are contained in a separate pane layer. Within each shape layer the main shape is in the backmost position and any decorations should be in front of it. Vertex shapes, indicated as instances of SwingGraphVertex, are placed in front of all other shape types, which are assumed to be edge shapes.

The layout manager is set null since layout is intended to be performed by a view layout engine. The pane's preferred size is computed such that its contents is centered.

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

Field Summary
static java.lang.Integer LAYER_EDGE_BACK
          Backmost layer used for edge shapes and their callouts.
static java.lang.Integer LAYER_VERTEX_BACK
          Backmost layer used for vertex shapes and their callouts.
static javax.swing.border.Border VIEW_BORDER
          Default world space border.
static java.awt.Dimension VIEWPORT_SIZE
          Default viewport size, in pixels.
 
Constructor Summary
SwingGraphView(WholeView view)
           
 
Method Summary
 DataView getDataView()
          Gets the data view implemented by this graphic view.
 AxisBound3 getGraphicAxisBound3(AxisBound3 retVal)
          Default implementation: Returns the combination of all the space tree child bounds.
 void implDispose()
          Disposes the super, then disposes self.
protected  TreeNode newTreeNodeDelegate()
          Default implementation: Returns a new AbstractTreeNode.Auto() subclass with a new TreeNodes.Tree relationship, and wrapped as a root node.
 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.
 
Methods inherited from class gumbo.graphic.impl.swing.SwingSpaceNode
canIntersectGraphic, getGraphic, 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.space.SpaceNode
getGraphicSpaceTree
 

Field Detail

LAYER_VERTEX_BACK

public static final java.lang.Integer LAYER_VERTEX_BACK
Backmost layer used for vertex shapes and their callouts. Subsequent shape layers are in front and have a higher numerical value.


LAYER_EDGE_BACK

public static final java.lang.Integer LAYER_EDGE_BACK
Backmost layer used for edge shapes and their callouts. Subsequent shape layers are in front and have a higher numerical value.


VIEWPORT_SIZE

public static final java.awt.Dimension VIEWPORT_SIZE
Default viewport size, in pixels.


VIEW_BORDER

public static final javax.swing.border.Border VIEW_BORDER
Default world space border.

Constructor Detail

SwingGraphView

public SwingGraphView(WholeView view)
Method Detail

newTreeNodeDelegate

protected TreeNode newTreeNodeDelegate()
Default implementation: Returns a new AbstractTreeNode.Auto() subclass with a new TreeNodes.Tree relationship, and wrapped as a root node. Space tree child graphics are added to the layers of this graphic's layered pane, with vertices at the back. Child delegators must implement TranslationNode and AxisBound3Boundable, and their graphic must be a Component.

Specified by:
newTreeNodeDelegate in class AbstractTreeNodeDelegator
Returns:
Reference to the delegate. Never null.

getGraphicAxisBound3

public AxisBound3 getGraphicAxisBound3(AxisBound3 retVal)
Default implementation: Returns the combination of all the space tree child bounds.

Specified by:
getGraphicAxisBound3 in interface AxisBound3Boundable
Overrides:
getGraphicAxisBound3 in class SwingSpaceNode
Parameters:
retVal - Return value object. The bound. Never null.
Returns:
Reference to retVal. Never null.

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

getDataView

public DataView getDataView()
Description copied from interface: GraphicView
Gets the data view implemented by this graphic view.

Specified by:
getDataView in interface GraphicView
Returns:
Reference to the data view. Never null.

implDispose

public void implDispose()
Disposes the super, then disposes self.

Overrides:
implDispose in class SwingSpaceNode