use of javax.swing.tree.TreeModel in project zaproxy by zaproxy.
the class JCheckBoxTreeUnitTest method shouldFailToSetATreeModelWithChildNonDefaultMutableTreeNodes.
@Test(expected = ClassCastException.class)
public void shouldFailToSetATreeModelWithChildNonDefaultMutableTreeNodes() {
// Given
DefaultMutableTreeNode rootNode = new DefaultMutableTreeNode();
rootNode.add(new MutableTreeNodeImpl());
TreeModel treeModel = new DefaultTreeModel(rootNode);
JCheckBoxTree checkBoxTree = new JCheckBoxTree();
// When
checkBoxTree.setModel(treeModel);
// Then = ClassCastException
}
use of javax.swing.tree.TreeModel in project zaproxy by zaproxy.
the class JCheckBoxTreeUnitTest method shouldNotFailToSetAnUndefinedTreeModel.
@Test
public void shouldNotFailToSetAnUndefinedTreeModel() {
// Given
TreeModel undefinedTreeModel = null;
JCheckBoxTree checkBoxTree = new JCheckBoxTree();
// When
checkBoxTree.setModel(undefinedTreeModel);
// Then = No exception.
}
use of javax.swing.tree.TreeModel in project zaproxy by zaproxy.
the class JCheckBoxTreeUnitTest method shouldFailToSetATreeModelWithRootNonDefaultMutableTreeNode.
@Test(expected = ClassCastException.class)
public void shouldFailToSetATreeModelWithRootNonDefaultMutableTreeNode() {
// Given
TreeModel treeModel = new DefaultTreeModel(new TreeNodeImpl());
JCheckBoxTree checkBoxTree = new JCheckBoxTree();
// When
checkBoxTree.setModel(treeModel);
// Then = ClassCastException
}
use of javax.swing.tree.TreeModel in project intellij-community by JetBrains.
the class ProjectViewTestUtil method getNodeForElement.
public static DefaultMutableTreeNode getNodeForElement(PsiElement element, AbstractProjectViewPSIPane pane) {
JTree tree = pane.getTree();
TreeModel model = tree.getModel();
Object root = model.getRoot();
return getNodeForElement(root, model, element);
}
use of javax.swing.tree.TreeModel in project intellij-community by JetBrains.
the class TreeUpdater method dispose.
@Override
public void dispose() {
myTree.removePropertyChangeListener(JTree.TREE_MODEL_PROPERTY, myPropertyChangeListener);
TreeModel model = myTree.getModel();
if (model != null)
model.removeTreeModelListener(myTreeModelListener);
super.dispose();
}
Aggregations