コード例 #1
0
 @Override
 protected void tearDown() throws Exception {
   myElementUpdate.clear();
   myElementUpdateHook = null;
   myStructure.setReValidator(null);
   super.tearDown();
 }
コード例 #2
0
  @Override
  protected void setUp() throws Exception {
    super.setUp();

    myComparator =
        new NodeDescriptor.NodeComparator.Delegate<>(
            new NodeDescriptor.NodeComparator<NodeDescriptor>() {
              @Override
              public int compare(NodeDescriptor o1, NodeDescriptor o2) {
                return AlphaComparator.INSTANCE.compare(o1, o2);
              }
            });

    mySortedParent.clear();

    myTreeModel = new DefaultTreeModel(new DefaultMutableTreeNode(null));
    myTreeModel.addTreeModelListener(
        new TreeModelListener() {
          @Override
          public void treeNodesChanged(TreeModelEvent e) {
            assertEdt();
          }

          @Override
          public void treeNodesInserted(TreeModelEvent e) {
            assertEdt();
          }

          @Override
          public void treeNodesRemoved(TreeModelEvent e) {
            assertEdt();
          }

          @Override
          public void treeStructureChanged(TreeModelEvent e) {
            assertEdt();
          }
        });

    myTree = new Tree(myTreeModel);
    myStructure = new MyStructure();
    myRoot = new Node(null, "/");

    initBuilder(new MyBuilder());

    myTree
        .getSelectionModel()
        .addTreeSelectionListener(
            new TreeSelectionListener() {
              @Override
              public void valueChanged(TreeSelectionEvent e) {
                assertEdt();
              }
            });

    myTree.addTreeExpansionListener(
        new TreeExpansionListener() {
          @Override
          public void treeExpanded(TreeExpansionEvent event) {
            assertEdt();
          }

          @Override
          public void treeCollapsed(TreeExpansionEvent event) {
            assertEdt();
          }
        });
  }