gumbo.visualize.data.impl.swing
Class SwingListViewFactory

java.lang.Object
  |
  +--gumbo.visualize.data.AbstractDataViewFactory
        |
        +--gumbo.visualize.data.impl.swing.SwingListViewFactory
All Implemented Interfaces:
DataViewFactory

public class SwingListViewFactory
extends AbstractDataViewFactory

A data view factory for a list data presentation implemented using Swing native graphics. In a list view, list entries correspond to vertex models, with the order specified by the edge models, in a GraphModel. The initial list if formed by starting with the first source vertex in the whole view's graph model, followed by the vertex at the head end of the first edge of each subsequent vertex, ending when a loop or a sink node is found. All other part models in the whole model are ignored. The whole and part view graphic views will be registered automatically as spatial targets of the factory Swing sensors.

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

Constructor Summary
SwingListViewFactory(MouseSensor mouse, KeyboardSensor keyboard)
          Creates and instance.
 
Method Summary
protected  java.util.Collection addPartViews(java.util.Collection partModels, java.util.Collection retVal)
          Default implementation: For each part model, in iterator order: If an edge model, and the tail end vertex is the list tail, appends its head end vertex and forward sublist to the list, otherwise ignores it; if a vertex model, and the native model root is null, sets it as the head node, otherwise ignores it (and waits for an edge).
protected  void createdPartView(PartView view)
          Default implementation: Calls the super method, then adds the part view's graphic view as a sensor target.
protected  void createdWholeView()
          Default implementation: Adds the whole view's graphic view as a sensor target, then adds the sublist of the first source vertex in the whole model as the view list.
 void disposeWholeView(WholeView wholeView)
          Default implementation: Clears the graphic model, then calls the super method.
protected  GraphicView newPartViewGraphic(PartView view)
          Default implementation: If view is of a VertexModel, returns a SwingListEntry shape; otherwise, returns a NullGraphicView.
 WholeView newWholeView(WholeModel wholeModel)
          Default implementation: Throws an exception if the whole model is not a GraphModel, then calls the super method.
protected  GraphicView newWholeViewGraphic()
          Default implementation: If view is of a WholeModel, returns a SwingListView; otherwise, throws an exception.
protected  void removePartViews(java.util.Collection partModels)
          Default implementation: For each part model, in iterator order: If an edge model, removes its head end vertex and forward sublist; if a vertex model, removes it and its forward sublist.
 
Methods inherited from class gumbo.visualize.data.AbstractDataViewFactory
getAddedPartModelIn, getRemovingPartModelIn, getWholeView, newPartView
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwingListViewFactory

public SwingListViewFactory(MouseSensor mouse,
                            KeyboardSensor keyboard)
Creates and instance. Sensors should be able to handle targets with Swing/AWT native graphics.

Parameters:
mouse - Reference to the mouse sensor. Null if none.
keyboard - Reference to the keyboard sensor. Null if none.
Method Detail

newWholeViewGraphic

protected GraphicView newWholeViewGraphic()
Default implementation: If view is of a WholeModel, returns a SwingListView; otherwise, throws an exception.

Overrides:
newWholeViewGraphic in class AbstractDataViewFactory
Returns:
Reference to the whole view graphic. Never null.

createdWholeView

protected void createdWholeView()
Default implementation: Adds the whole view's graphic view as a sensor target, then adds the sublist of the first source vertex in the whole model as the view list.

Overrides:
createdWholeView in class AbstractDataViewFactory

newPartViewGraphic

protected GraphicView newPartViewGraphic(PartView view)
Default implementation: If view is of a VertexModel, returns a SwingListEntry shape; otherwise, returns a NullGraphicView.

Overrides:
newPartViewGraphic in class AbstractDataViewFactory
Parameters:
view - The part view. Never null.
Returns:
The part view graphic. Never null.

createdPartView

protected void createdPartView(PartView view)
Default implementation: Calls the super method, then adds the part view's graphic view as a sensor target.

Overrides:
createdPartView in class AbstractDataViewFactory
Parameters:
view - The part view. Never null.

addPartViews

protected java.util.Collection addPartViews(java.util.Collection partModels,
                                            java.util.Collection retVal)
Default implementation: For each part model, in iterator order: If an edge model, and the tail end vertex is the list tail, appends its head end vertex and forward sublist to the list, otherwise ignores it; if a vertex model, and the native model root is null, sets it as the head node, otherwise ignores it (and waits for an edge). Finally, calls prepare and realize on the whole graphic view to update the view presentation. Throws an exception if a part model is not a VertexModel or an EdgeModel in the whole view's whole model. Ignores duplicate part models

Overrides:
addPartViews in class AbstractDataViewFactory
Parameters:
partModels - The part model group (PartModel). Never null.
retVal - Return value object. The added part views (PartView) in iterator order. Null if none.
Returns:
Reference to retVal. Null if none.

removePartViews

protected void removePartViews(java.util.Collection partModels)
Default implementation: For each part model, in iterator order: If an edge model, removes its head end vertex and forward sublist; if a vertex model, removes it and its forward sublist. If a vertex corresponds to the list head, its node is removed as the head. Finally, calls prepare and realize on the whole graphic view to update the view presentation. Throws an exception if a part model is not a VertexModel or an EdgeModel in the whole view's whole model. Ignores missing part models.

Overrides:
removePartViews in class AbstractDataViewFactory
Parameters:
partModels - The part model group (PartModel). Never null.

newWholeView

public WholeView newWholeView(WholeModel wholeModel)
Default implementation: Throws an exception if the whole model is not a GraphModel, then calls the super method.

Specified by:
newWholeView in interface DataViewFactory
Overrides:
newWholeView in class AbstractDataViewFactory
Parameters:
wholeModel - The whole model. Never null.
Returns:
A new whole view. Never null.

disposeWholeView

public void disposeWholeView(WholeView wholeView)
Default implementation: Clears the graphic model, then calls the super method. Throws an exception if whole view is not the current one being managed by this factory.

Specified by:
disposeWholeView in interface DataViewFactory
Overrides:
disposeWholeView in class AbstractDataViewFactory
Parameters:
wholeView - The whole view. Never null.