gumbo.visualize.data.impl.swing
Class SwingDataShape

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
All Implemented Interfaces:
AxisBound3Boundable, AxisLayoutGraphic, BoundableGraphic, DataModelListener, Disposable, Graphic, GraphicGeometry, GraphicPresence, GraphicResource, GraphicView, InteractableGraphic, Interactor, IntersectableGraphic, java.io.Serializable, SpaceNode, TransformNode, TranslationNode
Direct Known Subclasses:
SwingGraphEdge, SwingGraphVertex, SwingListEntry

public abstract class SwingDataShape
extends SwingShape
implements GraphicView, DataModelListener

An adapter that converts a Swing JComponent into a GraphicView intended for use as a displayable leaf shape. The geometric origin of the graphic shape is the center of its bound. Includes capabilities for interaction feedback, axis-aligned layout, and global consistency management (see ConsistencyManager.getGlobalConsistencyManager()). Also includes support for automatically updating a graphic label if the associated data model's client data changes. The default space tree delegate is an auto-node with a null relationship, wrapped as a leaf node.

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

Constructor Summary
SwingDataShape(PartView view)
          Creates an instance.
 
Method Summary
 void clientDataChanged(java.lang.Object source, DataModel target)
          Default implementation: If getAutoLabel() is null or the client data is unknown, nothing happens; otherwise, calls getAutoLabel().clientDataChanged(), then updateFeedback().
protected  ClientLabelGraphic getAutoLabel()
          Called by the system to get this graphic view's label, which will be automatically updated if the associated data model's client data changes and is recognized (see clientDataChanged()).
 DataView getDataView()
          Gets the data view implemented by this graphic view.
protected  void implDispose()
          Removes this from the consistency and data model managers, then disposes the super.
protected  SwingDataShape initSwingDataShape(javax.swing.JComponent graphic, LabelGraphic label)
          Used by subclasses and serialization to initialize this object.
 
Methods inherited from class gumbo.graphic.impl.swing.SwingShape
getInteractorState, initSwingShape, newTreeNodeDelegate, updateFeedback
 
Methods inherited from class gumbo.graphic.impl.swing.SwingSpaceNode
canIntersectGraphic, getGraphic, getGraphicAxisBound3, getGraphicLocalSpace, getGraphicTransform, getGraphicTranslation, initSwingSpaceNode, intersectGraphic, isSpaceTransforming, prepareGraphicPresence, realizeGraphicPresence, 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.GraphicPresence
prepareGraphicPresence, realizeGraphicPresence
 
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
 

Constructor Detail

SwingDataShape

public SwingDataShape(PartView view)
Creates an instance. Must call initSwingDataShape() before using this object. Should call updateFeedback() at end of subclass init.

Throws:
java.lang.IllegalStateException - getGraphic() is not a JComponent.
Method Detail

initSwingDataShape

protected final SwingDataShape initSwingDataShape(javax.swing.JComponent graphic,
                                                  LabelGraphic label)
Used by subclasses and serialization to initialize this object. Throws an exception if the graphic or label are different from the initial ones.

Parameters:
graphic - Reference to a native graphic. Possibly this proxy but never null.
label - Reference to the label. Null if none.
Returns:
Reference to this object (which facilitates inline construction). Never null.

getAutoLabel

protected final ClientLabelGraphic getAutoLabel()
Called by the system to get this graphic view's label, which will be automatically updated if the associated data model's client data changes and is recognized (see clientDataChanged()).

Returns:
Reference to the label. Null if none.

clientDataChanged

public void clientDataChanged(java.lang.Object source,
                              DataModel target)
Default implementation: If getAutoLabel() is null or the client data is unknown, nothing happens; otherwise, calls getAutoLabel().clientDataChanged(), then updateFeedback().

Specified by:
clientDataChanged in interface DataModelListener
Parameters:
source - The source object sending the event. Never null.
target - The affected data model. Never null.

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

protected void implDispose()
Removes this from the consistency and data model managers, then disposes the super.

Overrides:
implDispose in class SwingShape