Search in sources :

Example 1 with CConditionBox

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox in project binnavi by google.

the class CCriteriumFunctionsTest method findNode.

@Test
public void findNode() {
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
    final List<ICriteriumCreator> criteria = cCriteriaFactory.getConditions();
    final CConditionBox box = new CConditionBox(criteria);
    final JCriteriumTree jtree = new JCriteriumTree(cCriteriumTree, criteria);
    final CColorCriterium colorado = new CColorCriterium(m_graph);
    final CCriteriumTreeNode child = new CCriteriumTreeNode(colorado);
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    final TreePath path = new TreePath(((JCriteriumTreeNode) jtree.getModel().getRoot()).getFirstChild());
    jtree.setSelectionPath(path);
    box.setSelectedIndex(6);
    CCriteriumFunctions.appendCriterium(jtree, cCriteriumTree, box);
    assertEquals(null, CCriteriumFunctions.findNode(cCriteriumTree.getRoot(), new CTextCriterium()));
    assertEquals(child, CCriteriumFunctions.findNode(cCriteriumTree.getRoot(), colorado));
}
Also used : JCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTree) TreePath(javax.swing.tree.TreePath) CConditionBox(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox) CTextCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CTextCriterium) CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriaFactory(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) ICriteriumCreator(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.ICriteriumCreator) Test(org.junit.Test)

Example 2 with CConditionBox

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox in project binnavi by google.

the class CCriteriumFunctionsTest method testAppendTwoNoPath.

@Test
public void testAppendTwoNoPath() {
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
    final List<ICriteriumCreator> criteria = cCriteriaFactory.getConditions();
    final CConditionBox box = new CConditionBox(criteria);
    final JCriteriumTree jtree = new JCriteriumTree(cCriteriumTree, criteria);
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    final TreePath path = new TreePath(((JCriteriumTreeNode) jtree.getModel().getRoot()).getFirstChild());
    jtree.setSelectionPath(path);
    box.setSelectedIndex(6);
    CCriteriumFunctions.appendCriterium(jtree, cCriteriumTree, box);
    assertTrue(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CSelectionCriterium);
    assertFalse(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CTagCriterium);
}
Also used : CSelectionCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CSelectionCriterium) JCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTree) TreePath(javax.swing.tree.TreePath) CConditionBox(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox) CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriaFactory(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) CTagCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Tag.CTagCriterium) ICriteriumCreator(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.ICriteriumCreator) Test(org.junit.Test)

Aggregations

CConditionBox (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox)2 CCriteriaFactory (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory)2 ICriteriumCreator (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.ICriteriumCreator)2 CColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium)2 CCriteriumTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree)2 CCriteriumTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode)2 JCriteriumTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTree)2 TreePath (javax.swing.tree.TreePath)2 Test (org.junit.Test)2 CSelectionCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Selection.CSelectionCriterium)1 CTagCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Tag.CTagCriterium)1 CTextCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Text.CTextCriterium)1