Mercurial > hg > truffle
comparison visualizer/View/src/com/sun/hotspot/igv/view/widgets/OutputSlotWidget.java @ 4512:015fb895586b
Moved visualizer to new directory.
author | Thomas Wuerthinger <thomas.wuerthinger@oracle.com> |
---|---|
date | Tue, 07 Feb 2012 22:41:09 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4511:6cb549627941 | 4512:015fb895586b |
---|---|
1 /* | |
2 * Copyright (c) 2008, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 * | |
23 */ | |
24 package com.sun.hotspot.igv.view.widgets; | |
25 | |
26 import com.sun.hotspot.igv.graph.Figure; | |
27 import com.sun.hotspot.igv.graph.OutputSlot; | |
28 import com.sun.hotspot.igv.view.scene.DiagramScene; | |
29 import java.awt.Point; | |
30 import java.util.List; | |
31 import org.netbeans.api.visual.widget.Widget; | |
32 | |
33 /** | |
34 * | |
35 * @author Thomas Wuerthinger | |
36 */ | |
37 public class OutputSlotWidget extends SlotWidget { | |
38 | |
39 private OutputSlot outputSlot; | |
40 | |
41 public OutputSlotWidget(OutputSlot slot, DiagramScene scene, Widget parent, FigureWidget fw) { | |
42 super(slot, scene, parent, fw); | |
43 outputSlot = slot; | |
44 //init(); | |
45 //getFigureWidget().getRightWidget().addChild(this); | |
46 Point p = outputSlot.getRelativePosition(); | |
47 p.y += getSlot().getFigure().getHeight() - Figure.SLOT_START; | |
48 p.x -= this.calculateClientArea().width / 2; | |
49 //p.x += this.calculateClientArea().width / 2; | |
50 this.setPreferredLocation(p); | |
51 } | |
52 | |
53 public OutputSlot getOutputSlot() { | |
54 return outputSlot; | |
55 } | |
56 | |
57 @Override | |
58 protected int calculateSlotWidth() { | |
59 | |
60 List<OutputSlot> slots = getSlot().getFigure().getOutputSlots(); | |
61 assert slots.contains(getSlot()); | |
62 return calculateWidth(slots.size()); | |
63 | |
64 } | |
65 /* | |
66 protected Point calculateRelativeLocation() { | |
67 if (getFigureWidget().getBounds() == null) { | |
68 return new Point(0, 0); | |
69 } | |
70 | |
71 double x = this.getFigureWidget().getBounds().width; | |
72 List<OutputSlot> slots = outputSlot.getFigure().getOutputSlots(); | |
73 assert slots.contains(outputSlot); | |
74 return new Point((int) x, (int) (calculateRelativeY(slots.size(), slots.indexOf(outputSlot)))); | |
75 }*/ | |
76 } |