Search in sources :

Example 1 with CColorCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium in project binnavi by google.

the class CCriteriumFunctionsTest method testInsertCriterium.

@Test
public void testInsertCriterium() {
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    CCriteriumFunctions.insertCriterium(cCriteriumTree, cCriteriumTree.getRoot(), new COrCriterium());
    assertTrue(cCriteriumTree.getRoot().getChildren().get(0).getCriterium() instanceof COrCriterium);
}
Also used : CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) COrCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.COrCriterium) Test(org.junit.Test)

Example 2 with CColorCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium in project binnavi by google.

the class CCriteriumFunctionsTest method testRemoveAll.

@Test
public void testRemoveAll() {
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    final CCriteriumTreeNode child2 = new CCriteriumTreeNode(new COrCriterium());
    cCriteriumTree.appendNode(child, child2);
    CCriteriumFunctions.removeAll(cCriteriumTree);
    assertEquals(0, cCriteriumTree.getRoot().getChildren().size());
}
Also used : CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) COrCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.COrCriterium) Test(org.junit.Test)

Example 3 with CColorCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium in project binnavi by google.

the class JCriteriumTreeModelTest method testRemoveNode.

@Test
public void testRemoveNode() {
    final JTree tree = new JTree();
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
    final JCriteriumTreeModel jCriterumTreeModel = new JCriteriumTreeModel(tree, cCriteriumTree, cCriteriaFactory.getConditions());
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    final CCriteriumTreeNode child2 = new CCriteriumTreeNode(new CAndCriterium());
    cCriteriumTree.insertNode(cCriteriumTree.getRoot(), child2);
    final CCriteriumTreeNode child3 = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(child2, child3);
    cCriteriumTree.remove(child);
    assertEquals(1, ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildCount());
    assertEquals(1, ((JCriteriumTreeNode) ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildAt(0)).getChildCount());
    assertEquals(child2.getCriterium(), ((JCriteriumTreeNode) ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildAt(0)).getCriterium());
}
Also used : JTree(javax.swing.JTree) JCriteriumTreeModel(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel) CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriaFactory(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory) CAndCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CAndCriterium) JCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeNode) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) Test(org.junit.Test)

Example 4 with CColorCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium in project binnavi by google.

the class JCriteriumTreeModelTest method testAppendNode.

@Test
public void testAppendNode() {
    final JTree tree = new JTree();
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
    final JCriteriumTreeModel jCriterumTreeModel = new JCriteriumTreeModel(tree, cCriteriumTree, cCriteriaFactory.getConditions());
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    assertEquals(1, ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildCount());
    assertEquals(child.getCriterium(), ((JCriteriumTreeNode) ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildAt(0)).getCriterium());
}
Also used : JTree(javax.swing.JTree) JCriteriumTreeModel(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel) CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CCriteriaFactory(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory) JCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeNode) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) Test(org.junit.Test)

Example 5 with CColorCriterium

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium in project binnavi by google.

the class CCriteriumFunctionsTest method testAppendOne.

@Test
public void testAppendOne() {
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriumTreeNode child = new CCriteriumTreeNode(new CColorCriterium(m_graph));
    cCriteriumTree.appendNode(cCriteriumTree.getRoot(), child);
    CCriteriumFunctions.appendCriterium(cCriteriumTree, cCriteriumTree.getRoot().getChildren().get(0), new CAndCriterium());
    assertTrue(cCriteriumTree.getRoot().getChildren().get(0).getChildren().get(0).getCriterium() instanceof CAndCriterium);
}
Also used : CColorCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium) CAndCriterium(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CAndCriterium) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) CCriteriumTreeNode(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode) Test(org.junit.Test)

Aggregations

CColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium)10 CCriteriumTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree)10 CCriteriumTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode)10 Test (org.junit.Test)10 CCriteriaFactory (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory)6 CAndCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CAndCriterium)4 JCriteriumTreeModel (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel)4 JTree (javax.swing.JTree)4 COrCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.Or.COrCriterium)3 JCriteriumTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeNode)3 CConditionBox (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CConditionBox)2 ICriteriumCreator (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.ICriteriumCreator)2 JCriteriumTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTree)2 TreePath (javax.swing.tree.TreePath)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