Search in sources :

Example 1 with JCriteriumTreeModel

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel 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 2 with JCriteriumTreeModel

use of com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel 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 3 with JCriteriumTreeModel

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

the class JCriteriumTreeModelTest method testEmpty.

@Test
public void testEmpty() {
    final JTree tree = new JTree();
    final CCriteriumTree cCriteriumTree = new CCriteriumTree();
    final CCriteriaFactory cCriteriaFactory = new CCriteriaFactory(m_graph, null, null);
    @SuppressWarnings("unused") final JCriteriumTreeModel jCriterumTreeModel = new JCriteriumTreeModel(tree, cCriteriumTree, cCriteriaFactory.getConditions());
}
Also used : JTree(javax.swing.JTree) JCriteriumTreeModel(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel) CCriteriaFactory(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory) CCriteriumTree(com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree) Test(org.junit.Test)

Example 4 with JCriteriumTreeModel

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

the class JCriteriumTreeModelTest method testInsertNode.

@Test
public void testInsertNode() {
    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);
    assertEquals(1, ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildCount());
    assertEquals(child2.getCriterium(), ((JCriteriumTreeNode) ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildAt(0)).getCriterium());
    assertEquals(child.getCriterium(), ((JCriteriumTreeNode) ((JCriteriumTreeNode) ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildAt(0)).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 5 with JCriteriumTreeModel

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

the class JCriteriumTreeModelTest method testRemoveAll.

@Test
public void testRemoveAll() {
    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.clear();
    assertEquals(0, ((JCriteriumTreeNode) jCriterumTreeModel.getRoot()).getChildCount());
}
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) 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

CCriteriaFactory (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.CCriteriaFactory)5 CCriteriumTree (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTree)5 JCriteriumTreeModel (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeModel)5 JTree (javax.swing.JTree)5 Test (org.junit.Test)5 CColorCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.NodeColor.CColorCriterium)4 CCriteriumTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionModel.CCriteriumTreeNode)4 CAndCriterium (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.Conditions.And.CAndCriterium)3 JCriteriumTreeNode (com.google.security.zynamics.binnavi.Gui.CriteriaDialog.ExpressionTree.JCriteriumTreeNode)3