Package org.jgraph.graph
Class PortView
java.lang.Object
org.jgraph.graph.AbstractCellView
org.jgraph.graph.PortView
- All Implemented Interfaces:
Serializable
,CellView
The default implementation of a port view.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic boolean
Controls if port magic should be allowed.protected CellView
Cache of the last valid parent.static PortRenderer
Renderer for the class.static int
Default size for all ports is 6.Fields inherited from class org.jgraph.graph.AbstractCellView
allAttributes, attributes, cell, cellEditor, childViews, groupBounds, parent
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the bounds for the port view.getHandle
(GraphContext context) Returnsnull
.Shortcut method to getLocation(null, null)getLocation
(EdgeView edge) For backwards compatibility.getLocation
(EdgeView edge, Point2D nearest) Returns the point that the port represents with respect toedge
andpoint
, which is the nearest point to this port view on the edge.This method ensures a non-null value.int
Returns a renderer for the class.void
setPortSize
(int size) protected boolean
Subclassers can override this to decide whether or not "port magic" should appear on a given edge.Methods inherited from class org.jgraph.graph.AbstractCellView
changeAttributes, childUpdated, createAttributeMap, getAllAttributes, getAttributes, getBounds, getCell, getCellAttributes, getCenterPoint, getChildViews, getDescendantViews, getEditor, getPerimeterPoint, getRendererComponent, includeInGroupBounds, intersects, isLeaf, mergeAttributes, refresh, removeFromParent, scale, setAttributes, setBounds, setCell, translate, update, updateGroupBounds
-
Field Details
-
SIZE
public static transient int SIZEDefault size for all ports is 6. -
renderer
Renderer for the class. -
allowPortMagic
public static boolean allowPortMagicControls if port magic should be allowed. Default is true. This is an easy switch to disable port magic for all instances of graphs. -
lastParent
Cache of the last valid parent. //FIX: Better solution?
-
-
Constructor Details
-
PortView
public PortView()Constructs an empty portview. -
PortView
Constructs a view that holds a reference to the specified cell, anchor and parent vertex.- Parameters:
cell
- reference to the cell in the model
-
-
Method Details
-
getParentView
This method ensures a non-null value. If the super method returns null then the last valid parent is returned. Note: If a vertex is removed, all ports will be replaced in connected edges. The ports are replaced by the center point of the last valid vertex view.- Specified by:
getParentView
in interfaceCellView
- Overrides:
getParentView
in classAbstractCellView
- Returns:
- the parent view for this view
-
getBounds
Returns the bounds for the port view.- Specified by:
getBounds
in interfaceCellView
- Overrides:
getBounds
in classAbstractCellView
-
getRenderer
Returns a renderer for the class.- Specified by:
getRenderer
in classAbstractCellView
- Returns:
- the renderer instance for this view
-
getHandle
Returnsnull
.- Specified by:
getHandle
in interfaceCellView
- Specified by:
getHandle
in classAbstractCellView
- Parameters:
context
- the context of this cell view (cells indirectly affected by it)- Returns:
- the cell handle for this view
-
getLocation
Shortcut method to getLocation(null, null) -
getLocation
For backwards compatibility. -
getLocation
Returns the point that the port represents with respect toedge
andpoint
, which is the nearest point to this port view on the edge.edge
andpoint
may benull
. -
shouldInvokePortMagic
Subclassers can override this to decide whether or not "port magic" should appear on a given edge. (Port magic means the port tries to make the edge horizontal or vertical if the closest control point lies within the bounds of the parent vertex.) -
getPortSize
public int getPortSize()- Returns:
- the port size
-
setPortSize
public void setPortSize(int size) - Parameters:
size
- the port size to set
-