01: /*
02: * $Id: JGraphpadPortView.java,v 1.1.1.1 2005/08/04 11:21:58 gaudenz Exp $
03: * Copyright (c) 2001-2005, Gaudenz Alder
04: *
05: * All rights reserved.
06: *
07: * See LICENSE file for license details. If you are unable to locate
08: * this file please contact info (at) jgraph (dot) com.
09: */
10: package com.jgraph.pad.graph;
11:
12: import org.jgraph.graph.EdgeView;
13: import org.jgraph.graph.PortView;
14:
15: /**
16: * Port view that blocks port magic (optimized locations) for non-rectangular
17: * parents
18: */
19: public class JGraphpadPortView extends PortView {
20:
21: /**
22: * Empty constructor for persistence.
23: */
24: public JGraphpadPortView() {
25: super ();
26: }
27:
28: /**
29: * Constructs a new port view for the specified cell.
30: *
31: * @param cell
32: * The cell to create the port view for.
33: */
34: public JGraphpadPortView(Object cell) {
35: super (cell);
36: }
37:
38: /**
39: * Avoids port magic for non-rectangular shapes.
40: */
41: protected boolean shouldInvokePortMagic(EdgeView edge) {
42: int shape = JGraphpadGraphConstants
43: .getVertexShape(getParentView().getAllAttributes());
44: if (shape != JGraphpadVertexRenderer.SHAPE_RECTANGLE
45: && shape != JGraphpadVertexRenderer.SHAPE_ROUNDED
46: && shape != JGraphpadVertexRenderer.SHAPE_CYLINDER)
47: return false;
48: return super.shouldInvokePortMagic(edge);
49: }
50:
51: }
|