com.sun.hotspot.igv.graph.Figure Java Examples

The following examples show how to use com.sun.hotspot.igv.graph.Figure. 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: ColorFilter.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
private void applyRule(ColorRule rule, Figure f) {
    if (rule.getColor() != null) {
        f.setColor(rule.getColor());
    }
    Color color = rule.getLineColor();
    ConnectionStyle style = rule.getLineStyle();

    for (OutputSlot s : f.getOutputSlots()) {
        for (Connection c : s.getConnections()) {
            if (color != null) {
                c.setColor(color);
            }

            if (style != null) {
                c.setStyle(style);
            }
        }
    }
}
 
Example #2
Source File: EditorTopComponent.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void expandSuccessors() {
    Set<Figure> oldSelection = getModel().getSelectedFigures();
    Set<Figure> figures = new HashSet<>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure succ : f.getPredecessors()) {
                if (oldSelection.contains(succ)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    getModel().showAll(figures);
}
 
Example #3
Source File: SplitFilter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void apply(Diagram d) {
    List<Figure> list = selector.selected(d);

    for (Figure f : list) {
        for (OutputSlot os : f.getOutputSlots()) {
            for (Connection c : os.getConnections()) {
                InputSlot is = c.getInputSlot();
                is.setName(f.getProperties().get("dump_spec"));
                String s = f.getProperties().get("short_name");
                if (s != null) {
                    is.setShortName(s);
                }
            }
        }

        d.removeFigure(f);
    }
}
 
Example #4
Source File: ColorFilter.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
private void applyRule(ColorRule rule, Figure f) {
    if (rule.getColor() != null) {
        f.setColor(rule.getColor());
    }
    Color color = rule.getLineColor();
    ConnectionStyle style = rule.getLineStyle();

    for (OutputSlot s : f.getOutputSlots()) {
        for (Connection c : s.getConnections()) {
            if (color != null) {
                c.setColor(color);
            }

            if (style != null) {
                c.setStyle(style);
            }
        }
    }
}
 
Example #5
Source File: ColorFilter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
private void applyRule(ColorRule rule, Figure f) {
    if (rule.getColor() != null) {
        f.setColor(rule.getColor());
    }
    Color color = rule.getLineColor();
    ConnectionStyle style = rule.getLineStyle();

    for (OutputSlot s : f.getOutputSlots()) {
        for (Connection c : s.getConnections()) {
            if (color != null) {
                c.setColor(color);
            }

            if (style != null) {
                c.setStyle(style);
            }
        }
    }
}
 
Example #6
Source File: EditorTopComponent.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void expandSuccessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure succ : f.getPredecessors()) {
                if (oldSelection.contains(succ)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #7
Source File: DiagramScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void gotoFigure(final Figure f) {

        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);
            selectionUpdated();
        }
    }
 
Example #8
Source File: DiagramScene.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
public void gotoFigure(final Figure f) {

        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);
            selectionUpdated();
        }
    }
 
Example #9
Source File: FindPanel.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void updateComboBox(List<Figure> figures) {

        String sel = (String) nameComboBox.getSelectedItem();
        SortedSet<String> propertyNames = new TreeSet<String>();

        for (Figure f : figures) {
            Properties prop = f.getProperties();
            for (Property p : prop) {
                if (!propertyNames.contains(p.getName())) {
                    propertyNames.add(p.getName());
                }
            }
        }

        for (String s : propertyNames) {
            nameComboBox.addItem(s);
        }
        nameComboBox.setSelectedItem(sel);
    }
 
Example #10
Source File: GraalEdgeColorFilter.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
@Override
public void apply(Diagram d) {
    List<Figure> figures = d.getFigures();
    for (Figure f : figures) {
        for (InputSlot is : f.getInputSlots()) {
            for (Connection c : is.getConnections()) {
                String type = c.getType();
                if (type == "Association" && "EndNode".equals(c.getOutputSlot().getFigure().getProperties().get("class"))) {
                    type = "Successor";
                }

                if (type != null) {
                    Color typeColor = usageColor.get(type);
                    if (typeColor == null) {
                        c.setColor(otherUsageColor);
                    } else {
                        c.setColor(typeColor);
                    }
                    if (c.getStyle() != ConnectionStyle.DASHED && type == "Successor") {
                        c.setStyle(ConnectionStyle.BOLD);
                    }
                }
            }
        }
    }
}
 
Example #11
Source File: EditorTopComponent.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
public void expandPredecessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure pred : f.getSuccessors()) {
                if (oldSelection.contains(pred)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #12
Source File: DiagramScene.java    From openjdk-8 with GNU General Public License v2.0 6 votes vote down vote up
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 {
                overall = overall.union(r2);
            }
        }
    }
    if (overall != null) {
        centerRectangle(overall);
    }
}
 
Example #13
Source File: ColorFilter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
private void applyRule(ColorRule rule, Figure f) {
    if (rule.getColor() != null) {
        f.setColor(rule.getColor());
    }
    Color color = rule.getLineColor();
    ConnectionStyle style = rule.getLineStyle();

    for (OutputSlot s : f.getOutputSlots()) {
        for (Connection c : s.getConnections()) {
            if (color != null) {
                c.setColor(color);
            }

            if (style != null) {
                c.setStyle(style);
            }
        }
    }
}
 
Example #14
Source File: ConnectionFilter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
public void apply(Diagram diagram) {

        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(diagram.getFigures());
        for (ConnectionStyleRule rule : connectionStyleRules) {
            List<Figure> figures = null;
            if (rule.getSelector() != null) {
                figures = rule.getSelector().selected(diagram);
            } else {
                figures = diagram.getFigures();
            }

            for (Figure f : figures) {
                for (OutputSlot os : f.getOutputSlots()) {
                    for (Connection c : os.getConnections()) {
                        if (figures.contains(c.getInputSlot().getFigure())) {
                            c.setStyle(rule.getLineStyle());
                            c.setColor(rule.getLineColor());
                        }
                    }
                }
            }
        }
    }
 
Example #15
Source File: DiagramScene.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
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 {
                overall = overall.union(r2);
            }
        }
    }
    if (overall != null) {
        centerRectangle(overall);
    }
}
 
Example #16
Source File: FigureWidget.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void addFigureToSubMenu(JMenu subMenu, final Figure f, boolean successor, int depth) {
    Set<Figure> set = f.getPredecessorSet();
    if (successor) {
        set = f.getSuccessorSet();
    }

    int count = set.size();
    if (set.contains(f)) {
        count--;
    }

    for (Figure f2 : set) {
        if (f2 == f) {
            continue;
        }

        count--;
        addFigureToMenu(subMenu, f2, successor, depth - 1);
        if (count > 0) {
            subMenu.addSeparator();
        }
    }
}
 
Example #17
Source File: EditorTopComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void expandSuccessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure succ : f.getPredecessors()) {
                if (oldSelection.contains(succ)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #18
Source File: EditorTopComponent.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void expandPredecessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure pred : f.getSuccessors()) {
                if (oldSelection.contains(pred)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #19
Source File: DiagramScene.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void gotoFigure(final Figure f) {

        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);
            selectionUpdated();
        }
    }
 
Example #20
Source File: EditorTopComponent.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void expandPredecessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure pred : f.getSuccessors()) {
                if (oldSelection.contains(pred)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #21
Source File: ColorFilter.java    From hottub with GNU General Public License v2.0 6 votes vote down vote up
private void applyRule(ColorRule rule, Figure f) {
    if (rule.getColor() != null) {
        f.setColor(rule.getColor());
    }
    Color color = rule.getLineColor();
    ConnectionStyle style = rule.getLineStyle();

    for (OutputSlot s : f.getOutputSlots()) {
        for (Connection c : s.getConnections()) {
            if (color != null) {
                c.setColor(color);
            }

            if (style != null) {
                c.setStyle(style);
            }
        }
    }
}
 
Example #22
Source File: SplitFilter.java    From openjdk-jdk8u with GNU General Public License v2.0 6 votes vote down vote up
public void apply(Diagram d) {
    List<Figure> list = selector.selected(d);

    for (Figure f : list) {
        for (OutputSlot os : f.getOutputSlots()) {
            for (Connection c : os.getConnections()) {
                InputSlot is = c.getInputSlot();
                is.setName(f.getProperties().get("dump_spec"));
                String s = f.getProperties().get("short_name");
                if (s != null) {
                    is.setShortName(s);
                }
            }
        }

        d.removeFigure(f);
    }
}
 
Example #23
Source File: FigureWidget.java    From openjdk-8-source with GNU General Public License v2.0 6 votes vote down vote up
public void addFigureToSubMenu(JMenu subMenu, final Figure f, boolean successor, int depth) {
    Set<Figure> set = f.getPredecessorSet();
    if (successor) {
        set = f.getSuccessorSet();
    }

    int count = set.size();
    if (set.contains(f)) {
        count--;
    }

    for (Figure f2 : set) {
        if (f2 == f) {
            continue;
        }

        count--;
        addFigureToMenu(subMenu, f2, successor, depth - 1);
        if (count > 0) {
            subMenu.addSeparator();
        }
    }
}
 
Example #24
Source File: EditorTopComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
public void expandPredecessors() {
    Set<Figure> oldSelection = scene.getSelectedFigures();
    Set<Figure> figures = new HashSet<Figure>();

    for (Figure f : this.getDiagramModel().getDiagramToView().getFigures()) {
        boolean ok = false;
        if (oldSelection.contains(f)) {
            ok = true;
        } else {
            for (Figure pred : f.getSuccessors()) {
                if (oldSelection.contains(pred)) {
                    ok = true;
                    break;
                }
            }
        }

        if (ok) {
            figures.add(f);
        }
    }

    scene.showAll(figures);
}
 
Example #25
Source File: DiagramScene.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
private boolean isVisible(Figure f) {
    for (Integer n : f.getSource().getSourceNodesAsSet()) {
        if (getModel().getHiddenNodes().contains(n)) {
            return false;
        }
    }
    return true;
}
 
Example #26
Source File: DiagramScene.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void showFigures(Collection<Figure> f) {
    HashSet<Integer> newHiddenNodes = new HashSet<Integer>(getModel().getHiddenNodes());
    for (Figure fig : f) {
        newHiddenNodes.removeAll(fig.getSource().getSourceNodesAsSet());
    }
    updateHiddenNodes(newHiddenNodes, true);
}
 
Example #27
Source File: DiagramScene.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public Action createGotoAction(final Figure f) {
    final DiagramScene diagramScene = this;
    Action a = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            diagramScene.gotoFigure(f);
        }
    };

    a.setEnabled(true);
    a.putValue(Action.SMALL_ICON, new ColorIcon(f.getColor()));
    String name = f.getLines()[0];

    name += " (";

    if (f.getCluster() != null) {
        name += "B" + f.getCluster().toString();
    }
    if (!this.getFigureWidget(f).isVisible()) {
        if (f.getCluster() != null) {
            name += ", ";
        }
        name += "hidden";
    }
    name += ")";
    a.putValue(Action.NAME, name);
    return a;
}
 
Example #28
Source File: EditorTopComponent.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void setSelection(PropertyMatcher matcher) {

        Properties.PropertySelector<Figure> selector = new Properties.PropertySelector<Figure>(scene.getModel().getDiagramToView().getFigures());
        List<Figure> list = selector.selectMultiple(matcher);
        boolean b = scene.getUndoRedoEnabled();
        scene.setUndoRedoEnabled(false);
        scene.gotoFigures(list);
        scene.setUndoRedoEnabled(b);
        scene.setSelection(list);
    }
 
Example #29
Source File: DiagramScene.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void setSelection(Set<Integer> nodes) {
    clearSelection();
    for (Figure f : getModel().getDiagramToView().getFigures()) {
        if (doesIntersect(f.getSource().getSourceNodesAsSet(), nodes)) {
            addToSelection(f);
        }
    }
    selectionUpdated();
    this.validate();
}
 
Example #30
Source File: DiagramScene.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
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;
}