use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.
the class GraphSearcherTest method testSimpleNoResult.
@Test
public void testSimpleNoResult() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "mx");
searcher.getCursor().next();
assertNull(searcher.getCursor().current());
}
use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.
the class GraphSearcherTest method testAfterLast.
@Test
public void testAfterLast() {
final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
final GraphSearcher searcher = new GraphSearcher();
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "");
assertNull(searcher.getCursor().current());
m_content.addLineContent(new ZyLineContent("Hello my Test", null));
searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
assertFalse(searcher.getCursor().isAfterLast());
searcher.getCursor().next();
assertTrue(searcher.getCursor().isAfterLast());
searcher.getCursor().next();
assertTrue(searcher.getCursor().isAfterLast());
}
use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.
the class ZyGraphNode method setHighlighting.
public void setHighlighting(final int level, final int line, final int start, final int length, final Color color) {
final ZyLineContent lineContent = m_realizer.getNodeContent().getLineContent(line);
lineContent.setHighlighting(start, length, level, color);
updateViews();
}
use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.
the class ZyGraphNode method setBackgroundColor.
/**
* Colorizes a complete line of the node in a given color.
*
* @param line The index of the line.
* @param color The color of the line.
*/
public void setBackgroundColor(final int line, final Color color) {
final ZyLineContent lineContent = m_realizer.getNodeContent().getLineContent(line);
lineContent.setBackgroundColor(color);
updateViews();
}
use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.
the class ProximityNodeCreator method createProximityNode.
/**
* Creates a proximity browsing node.
*
* @param graph The graph where the proximity node is added to.
* @param attachedNode The graph node the proximity node is attached to.
* @param degree The edge degree of the attached node (this is the number shown in the proximity
* node).
* @param isIncoming True, to signal that the proximity node is incoming. False, if it is
* outcoming.
*
* @param <NodeType> Raw node type of the real (e.g. not proximity nodes) nodes in the graph.
*
* @return The created proximity node.
*/
public static <NodeType extends IViewNode<?>> ZyProximityNode<?> createProximityNode(final Graph2D graph, final ZyGraphNode<?> attachedNode, final int degree, final boolean isIncoming) {
Preconditions.checkNotNull(graph, "Graph argument can not be null");
Preconditions.checkNotNull(attachedNode, "Target node argument can not be null");
final ZyLabelContent labelcontent = new ZyLabelContent(null);
labelcontent.addLineContent(new ZyLineContent(String.valueOf(degree), new Font("New Courier", Font.PLAIN, 12), null));
final ZyProximityNodeRealizer<NodeType> r = new ZyProximityNodeRealizer<NodeType>(labelcontent);
final Node node = graph.createNode(r);
@SuppressWarnings("unchecked") final ZyProximityNode<NodeType> infoNode = new ZyProximityNode<NodeType>(node, r, (ZyGraphNode<NodeType>) attachedNode, isIncoming);
final ZyNodeData<ZyProximityNode<NodeType>> data = new ZyNodeData<ZyProximityNode<NodeType>>(infoNode);
r.setUserData(data);
return infoNode;
}
Aggregations