Examples of FigureWidget


Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

            Collection<InputBlock> newBlocks = new ArrayList<InputBlock>(s.schedule(d.getGraph()));
            d.schedule(newBlocks);
        }

        for (Figure f : d.getFigures()) {
            FigureWidget w = new FigureWidget(f, this, mainLayer);
            w.getActions().addAction(selectAction);
            w.getActions().addAction(hoverAction);
            w.getActions().addAction(ActionFactory.createPopupMenuAction(w));
            w.getActions().addAction(new DoubleClickAction(w));
            w.setVisible(false);

            figureWidgets.put(f, w);

            for (InputSlot s : f.getInputSlots()) {
                SlotWidget sw = new InputSlotWidget(s, this, slotLayer, w);
                slotWidgets.put(s, sw);
                sw.getActions().addAction(selectAction);
            }

            for (OutputSlot s : f.getOutputSlots()) {
                SlotWidget sw = new OutputSlotWidget(s, this, slotLayer, w);
                slotWidgets.put(s, sw);
                sw.getActions().addAction(selectAction);
            }
        }

        if (getModel().getShowBlocks()) {
            for (InputBlock bn : d.getGraph().getBlocks()) {
                BlockWidget w = new BlockWidget(this, d, bn);
                w.setVisible(false);
                blockWidgets.put(bn, w);
                blockLayer.addChild(w);
            }
        }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

        this.setUndoRedoEnabled(b);
        this.validate();
    }

    private boolean isVisible(Connection c) {
        FigureWidget w1 = figureWidgets.get(c.getInputSlot().getFigure());
        FigureWidget w2 = figureWidgets.get(c.getOutputSlot().getFigure());

        if (w1.isVisible() && w2.isVisible()) {
            return true;
        }

        return false;
    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

        Diagram diagram = getModel().getDiagramToView();

        HashSet<Figure> figures = new HashSet<Figure>();

        for (Figure f : diagram.getFigures()) {
            FigureWidget w = figureWidgets.get(f);
            if (w.isVisible()) {
                figures.add(f);
            }
        }

        HashSet<Connection> edges = new HashSet<Connection>();

        for (Connection c : diagram.getConnections()) {
            if (isVisible(c)) {
                edges.add(c);
            }
        }

        if (getModel().getShowBlocks()) {
            HierarchicalClusterLayoutManager m = new HierarchicalClusterLayoutManager(OldHierarchicalLayoutManager.Combine.SAME_OUTPUTS);
            HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS);
            manager.setMaxLayerLength(9);
            manager.setMinLayerDifference(3);
            m.setManager(manager);
            m.setSubManager(new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS));
            m.doLayout(new LayoutGraph(edges, figures));

        } else {
            HierarchicalLayoutManager manager = new HierarchicalLayoutManager(HierarchicalLayoutManager.Combine.SAME_OUTPUTS);
            manager.setMaxLayerLength(10);
            manager.doLayout(new LayoutGraph(edges, figures));
        }

        int maxX = -BORDER_SIZE;
        int maxY = -BORDER_SIZE;
        for (Figure f : diagram.getFigures()) {
            FigureWidget w = figureWidgets.get(f);
            if (w.isVisible()) {
                Point p = f.getPosition();
                Dimension d = f.getSize();
                maxX = Math.max(maxX, p.x + d.width);
                maxY = Math.max(maxY, p.y + d.height);
            }
        }

        for (Connection c : diagram.getConnections()) {
            List<Point> points = c.getControlPoints();
            FigureWidget w1 = figureWidgets.get((Figure) c.getTo().getVertex());
            FigureWidget w2 = figureWidgets.get((Figure) c.getFrom().getVertex());
            if (w1.isVisible() && w2.isVisible()) {
                for (Point p : points) {
                    if (p != null) {
                        maxX = Math.max(maxX, p.x);
                        maxY = Math.max(maxY, p.y);
                    }
                }
            }
        }

        if (getModel().getShowBlocks()) {
            for (Block b : diagram.getBlocks()) {
                BlockWidget w = blockWidgets.get(b.getInputBlock());
                if (w != null && w.isVisible()) {
                    Rectangle r = b.getBounds();
                    maxX = Math.max(maxX, r.x + r.width);
                    maxY = Math.max(maxY, r.y + r.height);
                }
            }
        }

        bottomRight.setPreferredLocation(new Point(maxX + BORDER_SIZE, maxY + BORDER_SIZE));
        int offx = 0;
        int offy = 0;
        int curWidth = maxX + 2 * BORDER_SIZE;
        int curHeight = maxY + 2 * BORDER_SIZE;

        Rectangle bounds = this.getScrollPane().getBounds();
        if (curWidth < bounds.width) {
            offx = (bounds.width - curWidth) / 2;
        }

        if (curHeight < bounds.height) {
            offy = (bounds.height - curHeight) / 2;
        }

        final int offx2 = offx;
        final int offy2 = offy;

        SceneAnimator animator = this.getSceneAnimator();
        connectionLayer.removeChildren();
        int visibleFigureCount = 0;
        for (Figure f : diagram.getFigures()) {
            if (figureWidgets.get(f).isVisible()) {
                visibleFigureCount++;
            }
        }

        for (Figure f : diagram.getFigures()) {
            for (OutputSlot s : f.getOutputSlots()) {
                SceneAnimator anim = animator;
                if (visibleFigureCount > ANIMATION_LIMIT) {
                    anim = null;
                }
                processOutputSlot(s, s.getConnections(), 0, null, null, offx2, offy2, anim);
            }
        }

        for (Figure f : diagram.getFigures()) {
            FigureWidget w = figureWidgets.get(f);
            if (w.isVisible()) {
                Point p = f.getPosition();
                Point p2 = new Point(p.x + offx2, p.y + offy2);
                Rectangle r = new Rectangle(p.x + offx2, p.y + offy2, f.getSize().width, f.getSize().height);
                if (oldVisibleWidgets.contains(w)) {
                    if (visibleFigureCount > ANIMATION_LIMIT) {
                        w.setPreferredLocation(p2);
                    } else {
                        animator.animatePreferredLocation(w, p2);
                    }
                } else {
                    w.setPreferredLocation(p2);
                }
            }
        }

        if (getModel().getShowBlocks()) {
            for (Block b : diagram.getBlocks()) {
                BlockWidget w = blockWidgets.get(b.getInputBlock());
                if (w != null && w.isVisible()) {
                    Point location = new Point(b.getBounds().x + offx2, b.getBounds().y + offy2);
                    Rectangle r = new Rectangle(location.x, location.y, b.getBounds().width, b.getBounds().height);
                    if (oldVisibleWidgets.contains(w)) {
                        if (visibleFigureCount > ANIMATION_LIMIT) {
                            w.setPreferredBounds(r);
                        } else {
                            animator.animatePreferredBounds(w, r);
                        }
                    } else {
                        w.setPreferredBounds(r);
                    }
                }
            }
        }
    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

    public void gotoFigures(final List<Figure> figures) {
        Rectangle overall = null;
        showFigures(figures);
        for (Figure f : figures) {

            FigureWidget fw = getFigureWidget(f);
            if (fw != null) {
                Rectangle r = fw.getBounds();
                Point p = fw.getLocation();
                Rectangle r2 = new Rectangle(p.x, p.y, r.width, r.height);

                if (overall == null) {
                    overall = r2;
                } else {
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

            getScrollPane().getViewport().setViewPosition(calcCenter(r2));
        }
    }

    private void addToSelection(Figure f) {
        FigureWidget w = getFigureWidget(f);
        addToSelection(w);
    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

    public Set<Figure> getSelectedFigures() {
        Set<Figure> result = new HashSet<Figure>();
        for (Widget w : selectedWidgets) {
            if (w instanceof FigureWidget) {
                FigureWidget fw = (FigureWidget) w;
                if (fw.getState().isSelected()) {
                    result.add(fw.getFigure());
                }
            }
        }
        return result;
    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

    public Set<Integer> getSelectedNodes() {
        Set<Integer> result = new HashSet<Integer>();
        for (Widget w : selectedWidgets) {
            if (w instanceof FigureWidget) {
                FigureWidget fw = (FigureWidget) w;
                if (fw.getState().isSelected()) {
                    result.addAll(fw.getFigure().getSource().getSourceNodesAsSet());
                }
            }
        }
        return result;
    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

        assert diagram != null;

        Set<Widget> oldVisibleWidgets = new HashSet<Widget>();

        for (Figure f : diagram.getFigures()) {
            FigureWidget w = figureWidgets.get(f);
            if (w.isVisible()) {
                oldVisibleWidgets.add(w);
            }
        }

        if (getModel().getShowBlocks()) {
            for (InputBlock b : diagram.getGraph().getBlocks()) {
                BlockWidget w = blockWidgets.get(b);
                if (w.isVisible()) {
                    oldVisibleWidgets.add(w);
                }
            }
        }

        for (Figure f : diagram.getFigures()) {
            boolean hiddenAfter = doesIntersect(f.getSource().getSourceNodesAsSet(), newHiddenNodes);

            FigureWidget w = this.figureWidgets.get(f);
            w.setBoundary(false);
            if (!hiddenAfter) {
                // Figure is shown
                w.setVisible(true);
                for (InputNode n : f.getSource().getSourceNodes()) {
                    visibleBlocks.add(diagram.getGraph().getBlock(n));
                }
            } else {
                // Figure is hidden
                w.setVisible(false);
            }
        }

        if (getModel().getShowNodeHull()) {
            List<FigureWidget> boundaries = new ArrayList<FigureWidget>();
            for (Figure f : diagram.getFigures()) {
                FigureWidget w = this.figureWidgets.get(f);
                if (!w.isVisible()) {
                    Set<Figure> set = new HashSet<Figure>(f.getPredecessorSet());
                    set.addAll(f.getSuccessorSet());

                    boolean b = false;
                    for (Figure neighbor : set) {
                        FigureWidget neighborWidget = figureWidgets.get(neighbor);
                        if (neighborWidget.isVisible()) {
                            b = true;
                            break;
                        }
                    }
View Full Code Here

Examples of com.sun.hotspot.igv.view.widgets.FigureWidget

        if (!isVisible(f)) {
            showFigure(f);
        }

        FigureWidget fw = getFigureWidget(f);
        if (fw != null) {
            Rectangle r = fw.getBounds();
            Point p = fw.getLocation();
            centerRectangle(new Rectangle(p.x, p.y, r.width, r.height));

            // Select figure
            clearSelection();
            addToSelection(fw);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.