com.sun.hotspot.igv.layout.Vertex Java Examples

The following examples show how to use com.sun.hotspot.igv.layout.Vertex. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClusterNode.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void setPosition(Point pos) {

        this.position = pos;
        for (Vertex n : subNodes) {
            Point cur = new Point(n.getPosition());
            cur.translate(pos.x + BORDER, pos.y + BORDER);
            n.setPosition(cur);
        }

        for (Link e : subEdges) {
            List<Point> arr = e.getControlPoints();
            ArrayList<Point> newArr = new ArrayList<Point>();
            for (Point p : arr) {
                if (p != null) {
                    Point p2 = new Point(p);
                    p2.translate(pos.x + BORDER, pos.y + BORDER);
                    newArr.add(p2);
                } else {
                    newArr.add(null);
                }
            }

            e.setControlPoints(newArr);
        }
    }
 
Example #2
Source File: HierarchicalGraphLayout.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
    this.node = node;
    this.graph = graph;
    final VertexWrapper vertex = this;
    this.slot = new Port() {

        public Vertex getVertex() {
            return vertex;
        }

        public Point getRelativePosition() {
            return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
        }
    };

    Widget w = graph.getScene().findWidget(node);
    this.position = w.getPreferredLocation();
}
 
Example #3
Source File: ClusterNode.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void setPosition(Point pos) {

        this.position = pos;
        for (Vertex n : subNodes) {
            Point cur = new Point(n.getPosition());
            cur.translate(pos.x + BORDER, pos.y + BORDER);
            n.setPosition(cur);
        }

        for (Link e : subEdges) {
            List<Point> arr = e.getControlPoints();
            ArrayList<Point> newArr = new ArrayList<Point>();
            for (Point p : arr) {
                if (p != null) {
                    Point p2 = new Point(p);
                    p2.translate(pos.x + BORDER, pos.y + BORDER);
                    newArr.add(p2);
                } else {
                    newArr.add(null);
                }
            }

            e.setControlPoints(newArr);
        }
    }
 
Example #4
Source File: HierarchicalGraphLayout.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
    this.node = node;
    this.graph = graph;
    final VertexWrapper vertex = this;
    this.slot = new Port() {

        public Vertex getVertex() {
            return vertex;
        }

        public Point getRelativePosition() {
            return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
        }
    };

    Widget w = graph.getScene().findWidget(node);
    this.position = w.getPreferredLocation();
}
 
Example #5
Source File: HierarchicalGraphLayout.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
    this.node = node;
    this.graph = graph;
    final VertexWrapper vertex = this;
    this.slot = new Port() {

        public Vertex getVertex() {
            return vertex;
        }

        public Point getRelativePosition() {
            return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
        }
    };

    Widget w = graph.getScene().findWidget(node);
    this.position = w.getPreferredLocation();
}
 
Example #6
Source File: ClusterNode.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void setPosition(Point pos) {

        this.position = pos;
        for (Vertex n : subNodes) {
            Point cur = new Point(n.getPosition());
            cur.translate(pos.x + BORDER, pos.y + BORDER);
            n.setPosition(cur);
        }

        for (Link e : subEdges) {
            List<Point> arr = e.getControlPoints();
            ArrayList<Point> newArr = new ArrayList<Point>(arr.size());
            for (Point p : arr) {
                if (p != null) {
                    Point p2 = new Point(p);
                    p2.translate(pos.x + BORDER, pos.y + BORDER);
                    newArr.add(p2);
                } else {
                    newArr.add(null);
                }
            }

            e.setControlPoints(newArr);
        }
    }
 
Example #7
Source File: HierarchicalGraphLayout.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public VertexWrapper(N node, UniversalGraph<N, E> graph) {
    this.node = node;
    this.graph = graph;
    final VertexWrapper vertex = this;
    this.slot = new Port() {

        public Vertex getVertex() {
            return vertex;
        }

        public Point getRelativePosition() {
            return new Point((int) (vertex.getSize().getWidth() / 2), (int) (vertex.getSize().getHeight() / 2));
        }
    };

    Widget w = graph.getScene().findWidget(node);
    this.position = w.getPreferredLocation();
}
 
Example #8
Source File: ClusterNode.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void setPosition(Point pos) {

        this.position = pos;
        for (Vertex n : subNodes) {
            Point cur = new Point(n.getPosition());
            cur.translate(pos.x + BORDER, pos.y + BORDER);
            n.setPosition(cur);
        }

        for (Link e : subEdges) {
            List<Point> arr = e.getControlPoints();
            ArrayList<Point> newArr = new ArrayList<Point>();
            for (Point p : arr) {
                if (p != null) {
                    Point p2 = new Point(p);
                    p2.translate(pos.x + BORDER, pos.y + BORDER);
                    newArr.add(p2);
                } else {
                    newArr.add(null);
                }
            }

            e.setControlPoints(newArr);
        }
    }
 
Example #9
Source File: ClusterNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public ClusterNode(Cluster cluster, String name) {
    this.subNodes = new HashSet<Vertex>();
    this.subEdges = new HashSet<Link>();
    this.cluster = cluster;
    position = new Point(0, 0);
    this.name = name;
}
 
Example #10
Source File: OldHierarchicalLayoutManager.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private int assignLayers(Set<Node<NodeData, EdgeData>> rootNodes, Set<? extends Vertex> firstLayerHints,
        Set<? extends Vertex> lastLayerHints) {
    this.maxLayerTemp = -1;
    for (Node<NodeData, EdgeData> n : graph.getNodes()) {
        n.getData().setLayer(-1);
    }

    Graph.BFSTraversalVisitor traverser = graph.new BFSTraversalVisitor() {

        @Override
        public void visitNode(Node<NodeData, EdgeData> n, int depth) {
            if (depth > n.getData().getLayer()) {
                n.getData().setLayer(depth);
                maxLayerTemp = Math.max(maxLayerTemp, depth);
            }
        }
    };

    for (Node<NodeData, EdgeData> n : rootNodes) {
        if (n.getData().getLayer() == -1) {
            this.graph.traverseBFS(n, traverser, true);
        }
    }

    for (Vertex v : firstLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(0);
    }

    for (Vertex v : lastLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(maxLayerTemp);
    }

    return maxLayerTemp;
}
 
Example #11
Source File: BlockWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #12
Source File: BlockWidget.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #13
Source File: ClusterNode.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void updateSize() {


        calculateSize();

        final ClusterNode widget = this;
        inputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, 0);
            }

            public Vertex getVertex() {
                return widget;
            }
        };

        outputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, size.height);
            }

            public Vertex getVertex() {
                return widget;
            }
        };
    }
 
Example #14
Source File: OldHierarchicalLayoutManager.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
private int assignLayers(Set<Node<NodeData, EdgeData>> rootNodes, Set<? extends Vertex> firstLayerHints,
        Set<? extends Vertex> lastLayerHints) {
    this.maxLayerTemp = -1;
    for (Node<NodeData, EdgeData> n : graph.getNodes()) {
        n.getData().setLayer(-1);
    }

    Graph.BFSTraversalVisitor traverser = graph.new BFSTraversalVisitor() {

        @Override
        public void visitNode(Node<NodeData, EdgeData> n, int depth) {
            if (depth > n.getData().getLayer()) {
                n.getData().setLayer(depth);
                maxLayerTemp = Math.max(maxLayerTemp, depth);
            }
        }
    };

    for (Node<NodeData, EdgeData> n : rootNodes) {
        if (n.getData().getLayer() == -1) {
            this.graph.traverseBFS(n, traverser, true);
        }
    }

    for (Vertex v : firstLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(0);
    }

    for (Vertex v : lastLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(maxLayerTemp);
    }

    return maxLayerTemp;
}
 
Example #15
Source File: OldHierarchicalLayoutManager.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private int assignLayers(Set<Node<NodeData, EdgeData>> rootNodes, Set<? extends Vertex> firstLayerHints,
        Set<? extends Vertex> lastLayerHints) {
    this.maxLayerTemp = -1;
    for (Node<NodeData, EdgeData> n : graph.getNodes()) {
        n.getData().setLayer(-1);
    }

    Graph.BFSTraversalVisitor traverser = graph.new BFSTraversalVisitor() {

        @Override
        public void visitNode(Node<NodeData, EdgeData> n, int depth) {
            if (depth > n.getData().getLayer()) {
                n.getData().setLayer(depth);
                maxLayerTemp = Math.max(maxLayerTemp, depth);
            }
        }
    };

    for (Node<NodeData, EdgeData> n : rootNodes) {
        if (n.getData().getLayer() == -1) {
            this.graph.traverseBFS(n, traverser, true);
        }
    }

    for (Vertex v : firstLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(0);
    }

    for (Vertex v : lastLayerHints) {
        assert nodeMap.containsKey(v);
        nodeMap.get(v).getData().setLayer(maxLayerTemp);
    }

    return maxLayerTemp;
}
 
Example #16
Source File: OldHierarchicalLayoutManager.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public NodeData(Vertex node) {
    reversePositions = new HashMap<Port, Integer>();
    layer = -1;
    this.node = node;
    assert node != null;

    if (VERTICAL_LAYOUT) {
        width = node.getSize().width;
    } else {
        width = node.getSize().height;
    }
}
 
Example #17
Source File: OldHierarchicalLayoutManager.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public NodeData(Vertex node) {
    reversePositions = new HashMap<Port, Integer>();
    layer = -1;
    this.node = node;
    assert node != null;

    if (VERTICAL_LAYOUT) {
        width = node.getSize().width;
    } else {
        width = node.getSize().height;
    }
}
 
Example #18
Source File: ClusterNode.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
public void updateSize() {


        calculateSize();

        final ClusterNode widget = this;
        inputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, 0);
            }

            public Vertex getVertex() {
                return widget;
            }
        };

        outputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, size.height);
            }

            public Vertex getVertex() {
                return widget;
            }
        };
    }
 
Example #19
Source File: ClusterNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void updateSize() {


        calculateSize();

        final ClusterNode widget = this;
        inputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, 0);
            }

            public Vertex getVertex() {
                return widget;
            }
        };

        outputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, size.height);
            }

            public Vertex getVertex() {
                return widget;
            }
        };
    }
 
Example #20
Source File: BlockWidget.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #21
Source File: ClusterNode.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void updateSize() {


        calculateSize();

        final ClusterNode widget = this;
        inputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, 0);
            }

            public Vertex getVertex() {
                return widget;
            }
        };

        outputSlot = new Port() {

            public Point getRelativePosition() {
                return new Point(size.width / 2, size.height);
            }

            public Vertex getVertex() {
                return widget;
            }
        };
    }
 
Example #22
Source File: ClusterNode.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public ClusterNode(Cluster cluster, String name) {
    this.subNodes = new HashSet<Vertex>();
    this.subEdges = new HashSet<Link>();
    this.cluster = cluster;
    position = new Point(0, 0);
    this.name = name;
}
 
Example #23
Source File: ClusterNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public ClusterNode(Cluster cluster, String name) {
    this.subNodes = new HashSet<Vertex>();
    this.subEdges = new HashSet<Link>();
    this.cluster = cluster;
    position = new Point(0, 0);
    this.name = name;
}
 
Example #24
Source File: BlockWidget.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #25
Source File: BlockWidget.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/** Creates a new instance of BlockWidget */
public BlockWidget(ControlFlowScene scene, InputBlock block) {
    super(scene);
    this.block = block;
    this.setLabel(block.getName());
    this.setForeground(NORMAL_FOREGROUND_COLOR);
    this.setBorder(BorderFactory.createLineBorder(1, NORMAL_FOREGROUND_COLOR));
    this.setMinimumSize(SIZE);
    this.setMaximumSize(SIZE);

    this.setFont(font);

    final BlockWidget widget = this;
    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point((int) (SIZE.getWidth() / 2), (int) (SIZE.getHeight() / 2));
        }

        public Vertex getVertex() {
            return widget;
        }
    };
}
 
Example #26
Source File: BlockWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int compareTo(Vertex o) {
    return toString().compareTo(o.toString());
}
 
Example #27
Source File: HierarchicalClusterLayoutManager.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
public void doLayout(LayoutGraph graph) {
    doLayout(graph, new HashSet<Vertex>(), new HashSet<Vertex>(), new HashSet<Link>());
}
 
Example #28
Source File: HierarchicalGraphLayout.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
public int compareTo(Vertex o) {
    VertexWrapper vw = (VertexWrapper) o;
    return node.toString().compareTo(vw.node.toString());
}
 
Example #29
Source File: ClusterOutputSlotNode.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
public ClusterOutputSlotNode(ClusterNode n, String id) {
    this.blockNode = n;
    this.id = id;

    n.addSubNode(this);

    final Vertex thisNode = this;
    final ClusterNode thisBlockNode = blockNode;

    inputSlot = new Port() {

        public Point getRelativePosition() {
            return new Point(0, 0);
        }

        public Vertex getVertex() {
            return thisNode;
        }

        @Override
        public String toString() {
            return "InPort of " + thisNode.toString();
        }
    };

    outputSlot = new Port() {

        public Point getRelativePosition() {
            Point p = new Point(thisNode.getPosition());
            p.x += ClusterNode.BORDER;
            p.y = thisBlockNode.getSize().height;
            return p;
        }

        public Vertex getVertex() {
            return thisBlockNode;
        }

        @Override
        public String toString() {
            return "OutPort of " + thisNode.toString();
        }
    };
}
 
Example #30
Source File: ClusterNode.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
public void addSubNode(Vertex v) {
    subNodes.add(v);
}