org.tigris.gef.base
Class LayerPerspective

java.lang.Object
  extended by org.tigris.gef.base.Layer
      extended by org.tigris.gef.base.LayerDiagram
          extended by org.tigris.gef.base.LayerPerspective
All Implemented Interfaces:
java.io.Serializable, java.util.EventListener, GraphListener
Direct Known Subclasses:
LayerPerspectiveMutable

public class LayerPerspective
extends LayerDiagram
implements GraphListener

A Layer like found in many drawing applications. It contains a collection of Figs, ordered from back to front. Each LayerPerspective contains part of the overall picture that the user is drawing. LayerPerspective is different from LayerDiagram in that it assumes that you are drawing a connected graph that is represented in a GraphModel and controlled by a GraphController.

See Also:
Serialized Form

Field Summary
protected  java.util.Vector _allowedNetClasses
          Classes of NetNodes and NetEdges that are to be visualized in this perspective.
protected  java.util.Hashtable _nodeTypeRegions
          Rectangles of where to place nodes that are automatically added.
static int GAP
          The space between node FigNodes that are automatically places.
 
Fields inherited from class org.tigris.gef.base.LayerDiagram
_nextLayerNumbered
 
Fields inherited from class org.tigris.gef.base.Layer
_editors, _onMenu
 
Constructor Summary
LayerPerspective(java.lang.String name, GraphModel gm)
          Construct a new LayerPerspective with the given name, and add it to the menu of layers.
LayerPerspective(java.lang.String name, GraphModel gm, GraphController controller)
           
 
Method Summary
 void addNodeTypeRegion(java.lang.Class nodeClass, java.awt.Rectangle region)
          Remove the given Fig from this layer.
 void allowNetClass(java.lang.Class c)
          Add a node class of NetNodes or NetEdges to what will be shown in this perspective.
 void bumpOffOtherNodesIn(Fig newFig, java.awt.Rectangle bounds, boolean stagger, boolean vertical)
           
 void edgeAdded(GraphEvent ge)
           
 void edgeRemoved(GraphEvent ge)
           
 GraphController getGraphController()
          Reply the GraphController of the underlying connected graph.
 GraphEdgeRenderer getGraphEdgeRenderer()
           
 GraphModel getGraphModel()
          Reply the GraphModel of the underlying connected graph.
 GraphNodeRenderer getGraphNodeRenderer()
           
 void graphChanged(GraphEvent ge)
           
 void nodeAdded(GraphEvent ge)
           
 void nodeRemoved(GraphEvent ge)
           
 void putInPosition(Fig f)
           
 void setGraphController(GraphController controller)
           
 void setGraphEdgeRenderer(GraphEdgeRenderer rend)
           
 void setGraphModel(GraphModel gm)
           
 void setGraphNodeRenderer(GraphNodeRenderer rend)
           
 boolean shouldShow(java.lang.Object obj)
          Test to determine if a given NetNode should have a FigNode in this layer.
 
Methods inherited from class org.tigris.gef.base.LayerDiagram
add, bringForward, bringInFrontOf, bringToFront, elements, getContents, getContents, getPortFig, hit, indexOf, insertAt, numberWordFor, paintContents, paintContents, postLoad, postSave, preSave, presentationCountFor, presentationFor, remove, removeAll, reorder, sendBackward, sendToBack
 
Methods inherited from class org.tigris.gef.base.Layer
addEditor, adjust, calcDrawingArea, clone, damageAll, deleted, elementsIn, getContentsEdgesOnly, getContentsNoEdges, getEditors, getGrayed, getHidden, getLocked, getName, getOnMenu, getPerspectiveType, getScale, isAlwaysOnTop, nodesIn, paint, paint, paintGrayContents, print, refreshEditors, removeEditor, setAlwaysOnTop, setGrayed, setHidden, setLocked, setName, setOnMenu, setPerspectiveType, setScale, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

GAP

public static final int GAP
The space between node FigNodes that are automatically places.

See Also:
Constant Field Values

_allowedNetClasses

protected java.util.Vector _allowedNetClasses
Classes of NetNodes and NetEdges that are to be visualized in this perspective.


_nodeTypeRegions

protected java.util.Hashtable _nodeTypeRegions
Rectangles of where to place nodes that are automatically added.

Constructor Detail

LayerPerspective

public LayerPerspective(java.lang.String name,
                        GraphModel gm)
Construct a new LayerPerspective with the given name, and add it to the menu of layers. Needs-More-Work: I have not implemented a menu of layers yet. I don't know if that is really the right user interface


LayerPerspective

public LayerPerspective(java.lang.String name,
                        GraphModel gm,
                        GraphController controller)
Method Detail

getGraphModel

public GraphModel getGraphModel()
Reply the GraphModel of the underlying connected graph.


setGraphModel

public void setGraphModel(GraphModel gm)

getGraphController

public GraphController getGraphController()
Reply the GraphController of the underlying connected graph.


setGraphController

public void setGraphController(GraphController controller)

getGraphNodeRenderer

public GraphNodeRenderer getGraphNodeRenderer()

setGraphNodeRenderer

public void setGraphNodeRenderer(GraphNodeRenderer rend)

getGraphEdgeRenderer

public GraphEdgeRenderer getGraphEdgeRenderer()

setGraphEdgeRenderer

public void setGraphEdgeRenderer(GraphEdgeRenderer rend)

allowNetClass

public void allowNetClass(java.lang.Class c)
Add a node class of NetNodes or NetEdges to what will be shown in this perspective.


addNodeTypeRegion

public void addNodeTypeRegion(java.lang.Class nodeClass,
                              java.awt.Rectangle region)
Remove the given Fig from this layer.


putInPosition

public void putInPosition(Fig f)

bumpOffOtherNodesIn

public void bumpOffOtherNodesIn(Fig newFig,
                                java.awt.Rectangle bounds,
                                boolean stagger,
                                boolean vertical)

nodeAdded

public void nodeAdded(GraphEvent ge)
Specified by:
nodeAdded in interface GraphListener

edgeAdded

public void edgeAdded(GraphEvent ge)
Specified by:
edgeAdded in interface GraphListener

nodeRemoved

public void nodeRemoved(GraphEvent ge)
Specified by:
nodeRemoved in interface GraphListener

edgeRemoved

public void edgeRemoved(GraphEvent ge)
Specified by:
edgeRemoved in interface GraphListener

graphChanged

public void graphChanged(GraphEvent ge)
Specified by:
graphChanged in interface GraphListener

shouldShow

public boolean shouldShow(java.lang.Object obj)
Test to determine if a given NetNode should have a FigNode in this layer. Normally checks NetNode class against a list of allowable classes. For more sophisticated rules, override this method. FEATURE: multiple_perspectives