|
1 /* |
|
2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved. |
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
|
4 * |
|
5 * This code is free software; you can redistribute it and/or modify it |
|
6 * under the terms of the GNU General Public License version 2 only, as |
|
7 * published by the Free Software Foundation. |
|
8 * |
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
|
13 * accompanied this code). |
|
14 * |
|
15 * You should have received a copy of the GNU General Public License version |
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 * |
|
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, |
|
20 * CA 95054 USA or visit www.sun.com if you need additional information or |
|
21 * have any questions. |
|
22 * |
|
23 */ |
|
24 package com.sun.hotspot.igv.controlflow; |
|
25 |
|
26 import com.sun.hotspot.igv.data.InputBlockEdge; |
|
27 import com.sun.hotspot.igv.layout.Link; |
|
28 import com.sun.hotspot.igv.layout.Port; |
|
29 import java.awt.Point; |
|
30 import java.util.ArrayList; |
|
31 import java.util.List; |
|
32 import org.netbeans.api.visual.widget.ConnectionWidget; |
|
33 |
|
34 /** |
|
35 * |
|
36 * @author Thomas Wuerthinger |
|
37 */ |
|
38 public class BlockConnectionWidget extends ConnectionWidget implements Link { |
|
39 |
|
40 private BlockWidget from; |
|
41 private BlockWidget to; |
|
42 private Port inputSlot; |
|
43 private Port outputSlot; |
|
44 private List<Point> points; |
|
45 private InputBlockEdge edge; |
|
46 |
|
47 public BlockConnectionWidget(ControlFlowScene scene, InputBlockEdge edge) { |
|
48 super(scene); |
|
49 |
|
50 this.edge = edge; |
|
51 this.from = (BlockWidget) scene.findWidget(edge.getFrom()); |
|
52 this.to = (BlockWidget) scene.findWidget(edge.getTo()); |
|
53 inputSlot = to.getInputSlot(); |
|
54 outputSlot = from.getOutputSlot(); |
|
55 points = new ArrayList<Point>(); |
|
56 } |
|
57 |
|
58 public InputBlockEdge getEdge() { |
|
59 return edge; |
|
60 } |
|
61 |
|
62 public Port getTo() { |
|
63 return inputSlot; |
|
64 } |
|
65 |
|
66 public Port getFrom() { |
|
67 return outputSlot; |
|
68 } |
|
69 |
|
70 public void setControlPoints(List<Point> p) { |
|
71 this.points = p; |
|
72 } |
|
73 |
|
74 @Override |
|
75 public List<Point> getControlPoints() { |
|
76 return points; |
|
77 } |
|
78 |
|
79 @Override |
|
80 public String toString() { |
|
81 return "Connection[ " + from.toString() + " - " + to.toString() + "]"; |
|
82 } |
|
83 } |