Search in sources :

Example 1 with IZyNodeRealizer

use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer in project binnavi by google.

the class ClipboardCopier method copyToClipboard.

/**
   * Copies the text content of a node to the clip board.
   * 
   * @param node The node to copy to the clip board.
   */
public static void copyToClipboard(final ZyGraphNode<?> node) {
    Preconditions.checkNotNull(node, "Error: Node argument can not be null");
    final IZyNodeRealizer realizer = node.getRealizer();
    final ZyLabelContent content = realizer.getNodeContent();
    if (content.isSelectable()) {
        final ZyLabelContent zyContent = content;
        final StringBuilder textBuilder = new StringBuilder();
        for (final ZyLineContent zyLineContent : zyContent) {
            textBuilder.append(zyLineContent.getText());
            //$NON-NLS-1$
            textBuilder.append("\n");
        }
        ClipboardHelpers.copyToClipboard(textBuilder.toString());
    }
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)

Example 2 with IZyNodeRealizer

use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer in project binnavi by google.

the class CEditNodeHelper method select.

public static void select(final AbstractZyGraph<?, ?> graph, final Node node, final MouseEvent event) {
    final double mouseX = graph.getEditMode().translateX(event.getX());
    final double mouseY = graph.getEditMode().translateY(event.getY());
    final IZyNodeRealizer realizer = (IZyNodeRealizer) graph.getGraph().getRealizer(node);
    final ZyLabelContent labelContent = realizer.getNodeContent();
    final CDefaultLabelEventHandler labelEventHandler = graph.getEditMode().getLabelEventHandler();
    if (labelContent.isSelectable()) {
        final double zoom = graph.getView().getZoom();
        final double nodeX = realizer.getRealizer().getX();
        final double nodeY = realizer.getRealizer().getY();
        labelEventHandler.handleMouseDraggedEvent(nodeX, nodeY, mouseX, mouseY, zoom);
    }
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) CDefaultLabelEventHandler(com.google.security.zynamics.zylib.gui.zygraph.CDefaultLabelEventHandler) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer)

Example 3 with IZyNodeRealizer

use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer in project binnavi by google.

the class CEditNodeHelper method setCaretStart.

public static void setCaretStart(final AbstractZyGraph<?, ?> graph, final Node node, final MouseEvent event) {
    final double mouseX = graph.getEditMode().translateX(event.getX());
    final double mouseY = graph.getEditMode().translateY(event.getY());
    final IZyNodeRealizer realizer = (IZyNodeRealizer) graph.getGraph().getRealizer(node);
    final ZyLabelContent labelContent = realizer.getNodeContent();
    final CDefaultLabelEventHandler labelEventHandler = graph.getEditMode().getLabelEventHandler();
    graph.getEditMode().getLabelEventHandler().activateLabelContent(labelContent, new ZyRegenerateableNodeRealizer(realizer));
    if (labelContent.isSelectable()) {
        final double zoom = graph.getView().getZoom();
        final double nodeX = realizer.getRealizer().getX();
        final double nodeY = realizer.getRealizer().getY();
        labelEventHandler.handleMousePressedEvent(nodeX, nodeY, mouseX, mouseY, zoom);
    }
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) CDefaultLabelEventHandler(com.google.security.zynamics.zylib.gui.zygraph.CDefaultLabelEventHandler) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) ZyRegenerateableNodeRealizer(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyRegenerateableNodeRealizer)

Example 4 with IZyNodeRealizer

use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer in project binnavi by google.

the class ZoomFunctions method zoomToNode.

public static <NodeType extends ZyGraphNode<?>> void zoomToNode(final AbstractZyGraph<NodeType, ?> graph, final NodeType node, final int line, final boolean animate) {
    Preconditions.checkNotNull(node, "Error: Node argument can't be null");
    final IZyNodeRealizer realizer = node.getRealizer();
    Preconditions.checkNotNull(realizer, "Error: Node does not belong to the graph");
    final double offset = realizer.getNodeContent().getLineHeight() * line;
    final Point2D oldViewPoint = graph.getView().getViewPoint2D();
    graph.getView().setCenter(realizer.getCenterX(), (realizer.getCenterY() - (realizer.getHeight() / 2)) + offset);
    if (animate) {
        final Point2D newCenter = graph.getView().getCenter();
        graph.getView().setViewPoint((int) oldViewPoint.getX(), (int) oldViewPoint.getY());
        graph.getView().focusView(graph.getView().getZoom(), newCenter, graph.getSettings().getLayoutSettings().getAnimateLayout());
    }
    graph.updateViews();
}
Also used : Point2D(java.awt.geom.Point2D) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer)

Example 5 with IZyNodeRealizer

use of com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer in project binnavi by google.

the class CNaviNodeFactory method get.

public static NaviNode get() {
    final Graph2D graph = new Graph2D();
    final CTextNode node = CTextNodeFactory.get();
    final ZyLabelContent content = ZyTextNodeBuilder.buildContent(node);
    final IZyNodeRealizer realizer = new ZyNormalNodeRealizer<NaviNode>(content);
    return new NaviNode(graph.createNode(), realizer, node);
}
Also used : ZyLabelContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent) ZyNormalNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyNormalNodeRealizer) IZyNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) CTextNode(com.google.security.zynamics.binnavi.disassembly.CTextNode) Graph2D(y.view.Graph2D)

Aggregations

IZyNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer)13 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)10 CDefaultLabelEventHandler (com.google.security.zynamics.zylib.gui.zygraph.CDefaultLabelEventHandler)3 ZyLineContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)3 CTextNode (com.google.security.zynamics.binnavi.disassembly.CTextNode)2 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)2 CGroupNode (com.google.security.zynamics.binnavi.disassembly.CGroupNode)1 INaviCodeNode (com.google.security.zynamics.binnavi.disassembly.INaviCodeNode)1 INaviFunctionNode (com.google.security.zynamics.binnavi.disassembly.INaviFunctionNode)1 INaviGroupNode (com.google.security.zynamics.binnavi.disassembly.INaviGroupNode)1 INaviViewNode (com.google.security.zynamics.binnavi.disassembly.INaviViewNode)1 Pair (com.google.security.zynamics.zylib.general.Pair)1 ICodeNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.ICodeNode)1 IFunctionNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IFunctionNode)1 IViewNode (com.google.security.zynamics.zylib.gui.zygraph.nodes.IViewNode)1 ZyRegenerateableNodeRealizer (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyRegenerateableNodeRealizer)1 ZyNormalNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyNormalNodeRealizer)1 ZyProximityNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyProximityNodeRealizer)1 Point2D (java.awt.geom.Point2D)1 Rectangle2D (java.awt.geom.Rectangle2D)1