org.jgraph.graph

Class VertexView

Implemented Interfaces:
CellView, Serializable

public class VertexView
extends AbstractCellView

The default implementation of a vertex view.

Nested Class Summary

static class
VertexView.SizeHandle

Field Summary

protected Rectangle2D
bounds
Reference to the bounds attribute
static Rectangle2D
defaultBounds
static int[]
defaultCursors
Array that holds the cursors for the different control points.
static VertexRenderer
renderer
Renderer for the class.
static int[]
xCursors
Array that holds the cursors for the different control points.
static int[]
yCursors
Array that holds the cursors for the different control points.

Fields inherited from class org.jgraph.graph.AbstractCellView

allAttributes, attributes, cell, cellEditor, childViews, groupBounds, parent

Constructor Summary

VertexView()
Constructs an empty vertex view.
VertexView(Object cell)
Constructs a vertex view for the specified model object and the specified child views.

Method Summary

Rectangle2D
getBounds()
Returns the cached bounds for the vertex.
Rectangle2D
getCachedBounds()
Point2D
getCenterPoint()
Deprecated. replaced by AbstractCellView.getCenterPoint(CellView vertex)
CellHandle
getHandle(GraphContext context)
Returns a cell handle for the view, if the graph and the view are sizeable.
Point2D
getPerimeterPoint(Point2D source, Point2D p)
Deprecated. replaced by getPerimeterPoint(EdgeView edge, Point2D source, Point2D p)
Point2D
getPerimeterPoint(EdgeView edge, Point2D source, Point2D p)
Returns the intersection of the bounding rectangle and the straight line between the source and the specified point p.
CellViewRenderer
getRenderer()
Returns a renderer for the class.
void
setCachedBounds(Rectangle2D bounds)
void
update(GraphLayoutCache cache)
Overrides the parent method to udpate the cached points.

Methods inherited from class org.jgraph.graph.AbstractCellView

changeAttributes, childUpdated, createAttributeMap, getAllAttributes, getAttributes, getBounds, getBounds, getCell, getCellAttributes, getCenterPoint, getChildViews, getDescendantViews, getEditor, getHandle, getParentView, getPerimeterPoint, getRenderer, getRendererComponent, includeInGroupBounds, intersects, isLeaf, mergeAttributes, refresh, removeFromParent, scale, setAttributes, setBounds, setCell, translate, update, updateGroupBounds

Field Details

bounds

protected Rectangle2D bounds
Reference to the bounds attribute

defaultBounds

public static final Rectangle2D defaultBounds

defaultCursors

public static int[] defaultCursors
Array that holds the cursors for the different control points.

renderer

public static VertexRenderer renderer
Renderer for the class.

xCursors

public static int[] xCursors
Array that holds the cursors for the different control points.

yCursors

public static int[] yCursors
Array that holds the cursors for the different control points.

Constructor Details

VertexView

public VertexView()
Constructs an empty vertex view.

VertexView

public VertexView(Object cell)
Constructs a vertex view for the specified model object and the specified child views.
Parameters:
cell - reference to the model object

Method Details

getBounds

public Rectangle2D getBounds()
Returns the cached bounds for the vertex.
Specified by:
getBounds in interface CellView
Overrides:
getBounds in interface AbstractCellView

getCachedBounds

public Rectangle2D getCachedBounds()

getCenterPoint

public Point2D getCenterPoint()

Deprecated. replaced by AbstractCellView.getCenterPoint(CellView vertex)

Returns:
the center point of this vertex

getHandle

public CellHandle getHandle(GraphContext context)
Returns a cell handle for the view, if the graph and the view are sizeable.
Specified by:
getHandle in interface CellView
Overrides:
getHandle in interface AbstractCellView

getPerimeterPoint

public Point2D getPerimeterPoint(Point2D source,
                                 Point2D p)

Deprecated. replaced by getPerimeterPoint(EdgeView edge, Point2D source, Point2D p)


getPerimeterPoint

public Point2D getPerimeterPoint(EdgeView edge,
                                 Point2D source,
                                 Point2D p)
Returns the intersection of the bounding rectangle and the straight line between the source and the specified point p. The specified point is expected not to intersect the bounds. Note: You must override this method if you use a different renderer. This is because this method relies on the VertexRenderer interface, which can not be safely assumed for subclassers.
Specified by:
getPerimeterPoint in interface CellView
Overrides:
getPerimeterPoint in interface AbstractCellView

getRenderer

public CellViewRenderer getRenderer()
Returns a renderer for the class.
Overrides:
getRenderer in interface AbstractCellView

setCachedBounds

public void setCachedBounds(Rectangle2D bounds)

update

public void update(GraphLayoutCache cache)
Overrides the parent method to udpate the cached points.
Specified by:
update in interface CellView
Overrides:
update in interface AbstractCellView

Copyright (C) 2001-2006 Gaudenz Alder. All rights reserved.