Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jgraph.graph
Class PortView

    java.lang.Object
      |
      +--org.jgraph.graph.AbstractCellView
            |
            +--org.jgraph.graph.PortView

All Implemented Interfaces:
  CellView, Serializable

public class PortView
extends AbstractCellView

The default implementation of a port view.

See Also:
  Serialized Form

Field Summary
`protected CellView` | `lastParent` Cache of the last valid parent.
`static PortRenderer` | `renderer` Renderer for the class.
`protected static int` | `size` Default size for all ports is 6.

Fields inherited from class org.jgraph.graph.AbstractCellView
`allAttributes, attributes, cell, cellEditor, childViews, graph, mapper, parent`

Constructor Summary
`PortView(Object cell, JGraph graph, CellMapper mapper)` Constructs a view that holds a reference to the specified cell, anchor and parent vertex.

Method Summary
`Rectangle2D` | `getBounds()` Returns the bounds for the port view.
`protected Point2D` | `getEdgePoint(EdgeView view, int index)` Returns the point of `edge` at index `index`.
`CellHandle` | `getHandle(GraphContext context)` Returns `null`.
`Point2D` | `getLocation(EdgeView edge)` Returns the point that the port represents with respect to `edge`.
`protected Point2D` | `getNextPoint(EdgeView edge)` Returns the point that is closest to the port view on `edge`.
`CellView` | `getParentView()` This method ensures a non-null value.
`CellViewRenderer` | `getRenderer()` Returns a renderer for the class.

Methods inherited from class org.jgraph.graph.AbstractCellView
`childUpdated, getAllAttributes, getAttributes, getBounds, getCell, getChildViews, getDescendantViews, getEditor, getGraph, getMapper, getModel, getRendererComponent, intersects, isLeaf, refresh, removeFromParent, scale, setAttributes, setBounds, translate, update, updateAllAttributes`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### size

    protected static int size

  Default size for all ports is 6.

### renderer

    public static PortRenderer renderer

  Renderer for the class.

### lastParent

    protected transient CellView lastParent

  Cache of the last valid parent. //FIX: Better solution?

Constructor Detail

### PortView

    public PortView(Object cell,
                    JGraph graph,
                    CellMapper mapper)

  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 Detail

### getParentView

    public CellView 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 interface `CellView`
  Overrides:
    `getParentView` in class `AbstractCellView`

### getBounds

    public Rectangle2D getBounds()

  Returns the bounds for the port view.

  Specified by:
    `getBounds` in interface `CellView`
  Specified by:
    `getBounds` in class `AbstractCellView`

### getRenderer

    public CellViewRenderer getRenderer()

  Returns a renderer for the class.

  Specified by:
    `getRenderer` in class `AbstractCellView`

### getHandle

    public CellHandle getHandle(GraphContext context)

  Returns `null`.

  Specified by:
    `getHandle` in interface `CellView`
  Specified by:
    `getHandle` in class `AbstractCellView`

### getLocation

    public Point2D getLocation(EdgeView edge)

  Returns the point that the port represents with respect to `edge`. `edge` may be `null`.

### getNextPoint

    protected Point2D getNextPoint(EdgeView edge)

  Returns the point that is closest to the port view on `edge`. Returns `null` if `edge` has less than 2 points.

### getEdgePoint

    protected Point2D getEdgePoint(EdgeView view,
                                   int index)

  Returns the point of `edge` at index `index`. Avoids calling `getLocation` on the opposite port of `edge` (possible infinite recursion).

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| JGraph v5.0
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) 2003-2004 Gaudenz Alder. All rights reserved.