Search in sources :

Example 6 with NodeList

use of y.base.NodeList in project binnavi by google.

the class CSelectionMode method selectionBoxAction.

@Override
protected void selectionBoxAction(final Rectangle rect, final boolean shiftMode) {
    m_graph.getGraph().firePreEvent();
    final NodeList selectedNodes = new NodeList();
    for (final NodeCursor node = m_graph.getGraph().nodes(); node.ok(); node.next()) {
        final NodeType zyNode = m_graph.getNode(node.node());
        if ((zyNode == null) || (zyNode instanceof ZyProximityNode<?>)) {
            continue;
        }
        if (belongsToSelection(node.node(), rect)) {
            selectedNodes.add(node.node());
        }
    }
    if (((getLastDragEvent().getModifiersEx() & InputEvent.CTRL_DOWN_MASK) == 0) && ((getLastDragEvent().getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) == 0)) {
        m_graph.getGraph().unselectAll();
    }
    for (final Object nodeObject : selectedNodes) {
        final Node node = (Node) nodeObject;
        m_graph.getGraph().setSelected(node, true);
    }
    for (final EdgeCursor ec = m_graph.getGraph().selectedEdges(); ec.ok(); ec.next()) {
        final Edge e = ec.edge();
        final Node src = e.source();
        final Node dst = e.target();
        if (!m_graph.getGraph().getRealizer(src).isSelected() && !m_graph.getGraph().getRealizer(dst).isSelected()) {
            m_graph.getGraph().getRealizer(e).setSelected(false);
        }
    }
    m_graph.getGraph().firePostEvent();
    m_graph.getGraph().updateViews();
}
Also used : EdgeCursor(y.base.EdgeCursor) NodeList(y.base.NodeList) ZyGraphNode(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode) Node(y.base.Node) ZyProximityNode(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.proximity.ZyProximityNode) NodeCursor(y.base.NodeCursor) Edge(y.base.Edge) ZyProximityNode(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.proximity.ZyProximityNode)

Aggregations

NodeList (y.base.NodeList)6 EdgeCursor (y.base.EdgeCursor)3 NodeCursor (y.base.NodeCursor)3 HierarchyManager (y.view.hierarchy.HierarchyManager)3 ZyGraphNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.nodes.ZyGraphNode)2 Node (y.base.Node)2 Graph2D (y.view.Graph2D)2 Function (com.google.common.base.Function)1 ZyProximityNode (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.proximity.ZyProximityNode)1 Rectangle2D (java.awt.geom.Rectangle2D)1 HashSet (java.util.HashSet)1 Edge (y.base.Edge)1 Graph (y.base.Graph)1 YPoint (y.geom.YPoint)1