public abstract class AbstractCellView extends java.lang.Object implements CellView, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected AttributeMap |
allAttributes
Contains the complete set of attributes, including the cell's attributes.
|
protected AttributeMap |
attributes
Hashtable for attributes.
|
protected java.lang.Object |
cell
Reference to the cell for this view
|
static GraphCellEditor |
cellEditor
Editor for the cell.
|
protected java.util.List |
childViews
Cached child views.
|
protected java.awt.geom.Rectangle2D |
groupBounds
Cached bounds of all children if vertex is a group
|
protected CellView |
parent
Cached parent view
|
Constructor and Description |
---|
AbstractCellView()
Constructs an empty abstract cell view.
|
AbstractCellView(java.lang.Object cell)
Constructs a view for the specified model object, and invokes update on
the new instance.
|
Modifier and Type | Method and Description |
---|---|
java.util.Map |
changeAttributes(GraphLayoutCache cache,
java.util.Map change)
Applies
change to the attributes of the view and calls
update. |
void |
childUpdated()
Indicates to parent, if any, that this child has been updated.
|
protected AttributeMap |
createAttributeMap()
Hook for subclassers to avoid creating an empty AttributeMap during
construction of the instance.
|
AttributeMap |
getAllAttributes()
Returns the attributes of the view combined with the attributes of the
corresponding cell.
|
AttributeMap |
getAttributes()
Return the attributes of the view.
|
java.awt.geom.Rectangle2D |
getBounds()
Returns the cached bounds for the group if isleaf is false
|
static java.awt.geom.Rectangle2D |
getBounds(CellView[] views)
Returns the bounding box for the specified views.
|
java.lang.Object |
getCell()
Returns the model object that this view represents.
|
protected AttributeMap |
getCellAttributes(GraphModel model)
Hook for subclassers to avoid cloning the cell's attributes.
|
static java.awt.geom.Point2D |
getCenterPoint(CellView vertex) |
CellView[] |
getChildViews()
Returns the child views of this view.
|
static CellView[] |
getDescendantViews(CellView[] views)
Returns all views, including descendants that have a parent in
views without the PortViews. |
GraphCellEditor |
getEditor()
Returns a cell editor for the view.
|
abstract CellHandle |
getHandle(GraphContext context)
Returns a cell handle for the view.
|
CellView |
getParentView()
Returns the parent view for this view.
|
java.awt.geom.Point2D |
getPerimeterPoint(EdgeView edge,
java.awt.geom.Point2D source,
java.awt.geom.Point2D p)
Returns the intersection of the bounding rectangle and the straight line
between the source and the specified point p.
|
abstract CellViewRenderer |
getRenderer()
Obtains the renderer instance for this view
|
java.awt.Component |
getRendererComponent(JGraph graph,
boolean selected,
boolean focus,
boolean preview)
Returns a renderer component, configured for the view.
|
protected boolean |
includeInGroupBounds(CellView view)
This is used to exclude certain cell views from the group bounds
computation.
|
boolean |
intersects(JGraph graph,
java.awt.geom.Rectangle2D rect)
Returns true if the view intersects the given rectangle.
|
boolean |
isLeaf()
Returns
true if the view is a leaf. |
protected void |
mergeAttributes()
Implements the merging of the cell's attributes, initially stored in
allAttributes, and the location attributes.
|
void |
refresh(GraphLayoutCache cache,
CellMapper mapper,
boolean createDependentViews)
Create child views and reload properties for this view.
|
void |
removeFromParent()
Removes this view from the list of children of the parent.
|
void |
scale(double sx,
double sy,
java.awt.geom.Point2D origin)
Scale
view (group) by sx, sy . |
void |
setAttributes(AttributeMap attributes)
Sets the attributes of this view to the specified value
|
void |
setBounds(java.awt.geom.Rectangle2D bounds)
Sets the bounds of this
view . |
void |
setCell(java.lang.Object cell)
Sets the model object that this view represents to the specified cell
|
void |
translate(double dx,
double dy)
Translates
view (group) by dx, dy . |
void |
update(GraphLayoutCache cache)
Update attributes for this view and indicate to the parent this child has
been updated
|
protected void |
updateGroupBounds()
Updates the bounds of this view and its children
|
public static transient GraphCellEditor cellEditor
protected java.lang.Object cell
protected CellView parent
protected java.util.List childViews
protected AttributeMap allAttributes
attributes
.protected AttributeMap attributes
allAttributes
.protected transient java.awt.geom.Rectangle2D groupBounds
public AbstractCellView()
public AbstractCellView(java.lang.Object cell)
cell
- reference to the model objectprotected AttributeMap createAttributeMap()
public java.lang.Object getCell()
public void setCell(java.lang.Object cell)
cell
- the model object this view will representpublic void refresh(GraphLayoutCache cache, CellMapper mapper, boolean createDependentViews)
protected AttributeMap getCellAttributes(GraphModel model)
public void update(GraphLayoutCache cache)
protected void mergeAttributes()
public void childUpdated()
childUpdated
in interface CellView
public CellView getParentView()
getParentView
in interface CellView
public CellView[] getChildViews()
getChildViews
in interface CellView
public static CellView[] getDescendantViews(CellView[] views)
views
without the PortViews. Note: Iterative
Implementation using view.getChildViews. This returns the array in
inverse order, ie with the top most cell view at index 0.views
- the cell views whose descendants are to be returnedpublic void removeFromParent()
removeFromParent
in interface CellView
public boolean isLeaf()
true
if the view is a leaf.public AttributeMap getAttributes()
getAttributes
in interface CellView
attributes
of this viewpublic void setAttributes(AttributeMap attributes)
attributes
- the new attributes to setpublic AttributeMap getAllAttributes()
getAllAttributes
in interface CellView
public java.util.Map changeAttributes(GraphLayoutCache cache, java.util.Map change)
change
to the attributes of the view and calls
update.changeAttributes
in interface CellView
change
- a map of attribute changes to applypublic java.awt.geom.Rectangle2D getBounds()
public static java.awt.geom.Rectangle2D getBounds(CellView[] views)
views
- the views for whom the bounding box is to be determinedpublic void setBounds(java.awt.geom.Rectangle2D bounds)
view
. Calls translateView and
scaleView.bounds
- the new bounds for this cell viewprotected void updateGroupBounds()
protected boolean includeInGroupBounds(CellView view)
view
- the cell view to be included in the group bounds or notpublic void translate(double dx, double dy)
view
(group) by dx, dy
.dx
- the x-coordinate amount to translate bydy
- the y-coordinate amount to translate bypublic void scale(double sx, double sy, java.awt.geom.Point2D origin)
view
(group) by sx, sy
.sx
- the multiple by which the x coordinate position of the cell
view is to be scaledsy
- the multiple by which the y coordinate position of the cell
view is to be scaledorigin
- the origin point from which the scaling will calculatepublic boolean intersects(JGraph graph, java.awt.geom.Rectangle2D rect)
intersects
in interface CellView
graph
- the JGraph
instance of the viewrect
- the rectangle within which intersection is being checked forpublic java.awt.Component getRendererComponent(JGraph graph, boolean selected, boolean focus, boolean preview)
getRendererComponent
in interface CellView
graph
- the JGraph
instance of the viewselected
- whether or not this view is selectedfocus
- whether or not this view is the focuspreview
- whether or not it is a preview of the viewpublic abstract CellViewRenderer getRenderer()
public abstract CellHandle getHandle(GraphContext context)
public GraphCellEditor getEditor()
public static java.awt.geom.Point2D getCenterPoint(CellView vertex)
public java.awt.geom.Point2D getPerimeterPoint(EdgeView edge, java.awt.geom.Point2D source, java.awt.geom.Point2D p)
getPerimeterPoint
in interface CellView
Copyright (C) 2001-2009 JGraph Ltd. All rights reserved.