Java 类javax.swing.event.TreeExpansionEvent 实例源码

项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Messaged if the tree expansion event (for which we will have already
 * constructed a TableModelEvent) was vetoed;  disposes of the constructed
 * TableModelEvent in that circumstance. */
@Override
public void treeExpansionVetoed(TreeExpansionEvent event, ExpandVetoException exception) {
    assert SwingUtilities.isEventDispatchThread();

    log ("treeExpansionVetoed", exception);

    //Make sure the event that was vetoed is the one we're interested in
    if (event == inProgressEvent) {
        //If so, delete the expansion event we thought we were going
        //to use in treeExpanded/treeCollapsed, so that it doesn't
        //stick around forever holding references to objects from the
        //model
        pendingExpansionEvent = null;
        inProgressEvent = null;
    }
}
项目:incubator-netbeans    文件:TreeModelRoot.java   
private Object initExpandCollapseNotify(TreeExpansionEvent event) {
    Node node = Visualizer.findNode(event.getPath ().getLastPathComponent());
    Object obj = node.getLookup().lookup(Object.class);
    Object actOn;
    node = node.getParentNode();
    if (node == null) {
        actOn = new Integer(0);
    } else {
        Children ch = node.getChildren();
        if (ch instanceof TreeModelNode.TreeModelChildren) {
            actOn = ((TreeModelNode.TreeModelChildren) ch).getTreeDepth();
        } else {
            actOn = ch;
        }
    }
    Models.CompoundModel model = getModel();
    if (model != null) {
        DefaultTreeExpansionManager.get(model).setChildrenToActOn(actOn);
    }
    return obj;
}
项目:incubator-netbeans    文件:DirectoryChooserUI.java   
@Override
public void treeExpanded(TreeExpansionEvent evt) {
    TreePath path = evt.getPath();
    DirectoryNode node = (DirectoryNode) path
            .getLastPathComponent();
    if(!node.isLoaded()) {
        expandNode(fileChooser, path);
    } else {
        // fixed #96954, to be able to add a new directory
        // when the node has been already loaded
        if(addNewDirectory) {
            addNewDirectory(path);
            addNewDirectory = false;
        }
        // Fix for IZ#123815 : Cannot refresh the tree content
        refreshNode( path , node );
    }
}
项目:Luyten4Forge    文件:Model.java   
@Override
public void treeExpanded(final TreeExpansionEvent event) {
    final TreePath treePath = event.getPath();

    final Object expandedTreePathObject = treePath.getLastPathComponent();
    if (!(expandedTreePathObject instanceof TreeNode)) {
        return;
    }

    final TreeNode expandedTreeNode = (TreeNode) expandedTreePathObject;
    if (expandedTreeNode.getChildCount() == 1) {
        final TreeNode descendantTreeNode = expandedTreeNode.getChildAt(0);

        if (descendantTreeNode.isLeaf()) {
            return;
        }

        final TreePath nextTreePath = treePath.pathByAddingChild(descendantTreeNode);
        tree.expandPath(nextTreePath);
    }
}
项目:orbit-image-analysis    文件:WindowsDirectoryChooserUI.java   
public void treeExpanded(TreeExpansionEvent event) {
  // ensure children gets expanded later
  if (event.getPath() != null) {
    Object lastElement = event.getPath().getLastPathComponent();
    if (lastElement instanceof FileTreeNode && useNodeQueue) {
      if (((FileTreeNode)lastElement).isLoaded()) {
        for (Enumeration e = ((FileTreeNode)lastElement).children();
          e.hasMoreElements();
          ) {
          //Object node = enum.nextElement();
          addToQueue((FileTreeNode)e.nextElement(), tree);
        }
      }
    }
  }
}
项目:taxonaut    文件:AlignerTreeSynchronizer.java   
public void treeCollapsed(TreeExpansionEvent event)
   {
Object source = event.getSource();
if(getEventSource() != null ||
   trees == null ||
   trees.isEmpty())
    return;

setEventSource(event.getSource());

Iterator<AlignerTree> t = trees.iterator();
while(t.hasNext()) {
    AlignerTree tree = t.next();

    if(getEventSource() == tree)
    continue;

    if(tree.isSynchronized()) {
    tree.collapsePath(event.getPath());
    }
}

setEventSource(null);
   }
项目:intellij-ce-playground    文件:FileChooserDialogImpl.java   
public void treeExpanded(TreeExpansionEvent event) {
  final Object[] path = event.getPath().getPath();
  if (path.length == 2) {
    // top node has been expanded => watch disk recursively
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path[1];
    Object userObject = node.getUserObject();
    if (userObject instanceof FileNodeDescriptor) {
      final VirtualFile file = ((FileNodeDescriptor)userObject).getElement().getFile();
      if (file != null && file.isDirectory()) {
        final String rootPath = file.getPath();
        if (myRequests.get(rootPath) == null) {
          final LocalFileSystem.WatchRequest watchRequest = LocalFileSystem.getInstance().addRootToWatch(rootPath, true);
          myRequests.put(rootPath, watchRequest);
        }
      }
    }
  }
}
项目:intellij-ce-playground    文件:InspectionTree.java   
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
  final InspectionTreeNode node = (InspectionTreeNode)event.getPath().getLastPathComponent();
  final Object userObject = node.getUserObject();
  //TODO: never re-sort
  if (node.isValid() && !myExpandedUserObjects.contains(userObject)) {
    sortChildren(node);
    nodeStructureChanged(node);
  }
  myExpandedUserObjects.add(userObject);
  // Smart expand
  if (node.getChildCount() == 1) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        expandPath(new TreePath(node.getPath()));
      }
    });
  }
}
项目:project-argon    文件:TreeListener.java   
private void doubleClickHandler(ActionEvent e) throws ParseException {
    logger.debug("-- double click --");
    TreePath[] paths = tree.getSelectionPaths();
    if (paths != null) {
        for (TreePath path : paths) {
            if (((TreeNode) path.getLastPathComponent()).getAllowsChildren()) {
                if (doubleClickExpandEnabled) {
                    try {
                        treeWillExpand(new TreeExpansionEvent(this, path));
                    } catch (ExpandVetoException eve) {
                        logger.debug("Expand Veto: ", eve.getMessage());
                    }
                }
            } else {
                doubleClickAction(path);
            }
        }
    }
}
项目:mindraider    文件:TrashJPanel.java   
/**
 * @see javax.swing.event.TreeWillExpandListener#treeWillExpand(javax.swing.event.TreeExpansionEvent)
 */
public void treeWillExpand(TreeExpansionEvent e) throws ExpandVetoException {
    logger.debug("Tree will expand " + e.getPath());

    /*
     * DefaultMutableTreeNode node = (DefaultMutableTreeNode)
     * tree.getLastSelectedPathComponent(); if (node == null) { return; }
     * logger.debug(""+node.getPath()[node.getLevel()]); // buttons
     * disabling switch(node.getLevel()) { case LEVEL_FOLDERS: // disconnect
     * childrens from the node Enumeration enumeration=node.children(); //
     * delete nodes itself while (enumeration.hasMoreElements()) { Object
     * object=enumeration.nextElement();
     * treeNodeToResourceUriMap.remove(object);
     * treeModel.removeNodeFromParent((MutableTreeNode)object); } // get
     * folder URI logger.debug("Expanding folder:
     * "+treeNodeToResourceUriMap.get(node)); FolderResource folder =new
     * FolderResource(MindRaider.folderCustodian.get((String)treeNodeToResourceUriMap.get(node)));
     * String[] notebookUris=folder.getNotebookUris(); if (notebookUris !=
     * null) { for (int i= 0; i < notebookUris.length; i++) {
     * NotebookResource notebook=new
     * NotebookResource(MindRider.notebookCustodian.get(notebookUris[i]));
     * addNotebookNode(node,notebook.resource.metadata.uri.toASCIIString(),notebook.getLabel()); } } }
     */
}
项目:DataCleaner    文件:SchemaTree.java   
public void treeWillExpand(final TreeExpansionEvent event) throws ExpandVetoException {
    final TreePath path = event.getPath();
    final DefaultMutableTreeNode lastTreeNode = (DefaultMutableTreeNode) path.getLastPathComponent();
    SwingWorker<?, ?> worker = null;
    if (lastTreeNode.getChildCount() == 1) {
        final DefaultMutableTreeNode firstChildNode = (DefaultMutableTreeNode) lastTreeNode.getChildAt(0);
        if (firstChildNode.getUserObject() == LOADING_TABLES_STRING) {
            // Load a schema's tables
            worker = new LoadTablesSwingWorker(lastTreeNode);
        } else if (firstChildNode.getUserObject() == LOADING_COLUMNS_STRING) {
            // Load a table's columns
            worker = new LoadColumnsSwingWorker(path, lastTreeNode);
        }
    }

    if (worker != null) {
        worker.execute();
    }
}
项目:findbugs-all-the-bugs    文件:MainFrameTree.java   
public void treeExpanded(TreeExpansionEvent event) {
    System.out.println("Tree expanded");
    TreePath path = event.getPath();
    Object lastPathComponent = path.getLastPathComponent();
    int children = tree.getModel().getChildCount(lastPathComponent);
    if (children == 1) {
        Object o = tree.getModel().getChild(lastPathComponent, 0);
        if (o instanceof BugAspects) {
            final TreePath p = path.pathByAddingChild(o);
            SwingUtilities.invokeLater(new Runnable() {

                public void run() {
                    try {
                        System.out.println("auto expanding " + p);
                        tree.expandPath(p);
                    } catch (Exception e) {
                        e.printStackTrace();
                    }

                }
            });
        }

    }
}
项目:tools-idea    文件:FileChooserDialogImpl.java   
public void treeExpanded(TreeExpansionEvent event) {
  final Object[] path = event.getPath().getPath();
  if (path.length == 2) {
    // top node has been expanded => watch disk recursively
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path[1];
    Object userObject = node.getUserObject();
    if (userObject instanceof FileNodeDescriptor) {
      final VirtualFile file = ((FileNodeDescriptor)userObject).getElement().getFile();
      if (file != null && file.isDirectory()) {
        final String rootPath = file.getPath();
        if (myRequests.get(rootPath) == null) {
          final LocalFileSystem.WatchRequest watchRequest = LocalFileSystem.getInstance().addRootToWatch(rootPath, true);
          myRequests.put(rootPath, watchRequest);
        }
      }
    }
  }
}
项目:tools-idea    文件:InspectionTree.java   
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
  final InspectionTreeNode node = (InspectionTreeNode)event.getPath().getLastPathComponent();
  final Object userObject = node.getUserObject();
  //TODO: never re-sort
  if (node.isValid() && !myExpandedUserObjects.contains(userObject)) {
    sortChildren(node);
    nodeStructureChanged(node);
  }
  myExpandedUserObjects.add(userObject);
  // Smart expand
  if (node.getChildCount() == 1) {
    ApplicationManager.getApplication().invokeLater(new Runnable() {
      @Override
      public void run() {
        expandPath(new TreePath(node.getPath()));
      }
    });
  }
}
项目:alien-ofelia-conet-ccnx    文件:ContentExplorer.java   
/**
 * Method to handle tree collapse events.  When a tree is collapsed, all name enumerations under
 * the collapsed node are canceled.
 *
 * @param event TreeExpansionEvent object for the event
 *
 * @return void
 */
public void treeCollapsed(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = getTreeNode(event.getPath());
    Name nodeName = getNameNode(node);
    Log.fine("nodeName: " + nodeName.toString());
    ContentName prefixToCancel = ContentName.ROOT;
    if (nodeName.path == null) {
        Log.fine("collapsed the tree at the root");
    } else {
        prefixToCancel = new ContentName(nodeName.path, nodeName.name);
        Log.fine("tree collapsed at: " + prefixToCancel.toString());
    }
    Log.fine("cancelling prefix: " + prefixToCancel);
    _nameEnumerator.cancelEnumerationsWithPrefix(prefixToCancel);

}
项目:Luyten    文件:Model.java   
@Override
public void treeExpanded(final TreeExpansionEvent event) {
    final TreePath treePath = event.getPath();

    final Object expandedTreePathObject = treePath.getLastPathComponent();
    if (!(expandedTreePathObject instanceof TreeNode)) {
        return;
    }

    final TreeNode expandedTreeNode = (TreeNode) expandedTreePathObject;
    if (expandedTreeNode.getChildCount() == 1) {
        final TreeNode descendantTreeNode = expandedTreeNode.getChildAt(0);

        if (descendantTreeNode.isLeaf()) {
            return;
        }

        final TreePath nextTreePath = treePath.pathByAddingChild(descendantTreeNode);
        tree.expandPath(nextTreePath);
    }
}
项目:FileTree    文件:FileTree.java   
private void folderTreeExpanded(TreeExpansionEvent event)
{
    TreePath path = event.getPath();
    if(path.getLastPathComponent() instanceof LinkTreeNode && path.getLastPathComponent() != getBiblioNode()){
        LinkTreeNode node = (LinkTreeNode)path.getLastPathComponent();
        if(node.getParent() == null){
            DefaultTreeModel model = (DefaultTreeModel)this.getModel();
            Debug.println("Node hovering nowhere, try to find the right one..");
            LinkTreeNode find = find((DefaultMutableTreeNode) model.getRoot(), node.getLinkDir());
            if(find == null){
                    Debug.println("No node found...");
                return;
            }
            node = find;
        }
        node.setHighPriority();
        loadNode(node, false, false);
    }
}
项目:consulo    文件:FileChooserDialogImpl.java   
public void treeExpanded(TreeExpansionEvent event) {
  final Object[] path = event.getPath().getPath();
  if (path.length == 2) {
    // top node has been expanded => watch disk recursively
    final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path[1];
    Object userObject = node.getUserObject();
    if (userObject instanceof FileNodeDescriptor) {
      final VirtualFile file = ((FileNodeDescriptor)userObject).getElement().getFile();
      if (file != null && file.isDirectory()) {
        final String rootPath = file.getPath();
        if (myRequests.get(rootPath) == null) {
          final LocalFileSystem.WatchRequest watchRequest = LocalFileSystem.getInstance().addRootToWatch(rootPath, true);
          myRequests.put(rootPath, watchRequest);
        }
      }
    }
  }
}
项目:android-packages-manager    文件:JFolderChoose.java   
public void treeExpanded(TreeExpansionEvent event) {
    final DefaultMutableTreeNode node = getTreeNode(event.getPath());
    final FileNode fnode = getFileNode(node);

    Thread runner = new Thread() {
        public void run() {
            if (fnode != null && fnode.expand(node)) {
                Runnable runnable = new Runnable() {
                    public void run() {
                        mModel.reload(node);
                    }
                };
                SwingUtilities.invokeLater(runnable);
            }
        }
    };
    runner.start();
}
项目:incubator-netbeans    文件:ResultsOutlineSupport.java   
@Override
public void treeExpanded(TreeExpansionEvent event) {
    if (!expansionListenerEnabled) {
        return;
    }
    Object lpc = event.getPath().getLastPathComponent();
    Node node = Visualizer.findNode(lpc);
    if (node != null) {
        expandOnlyChilds(node);
    }
}
项目:incubator-netbeans    文件:TreeView.java   
@Override
public void treeWillExpand(TreeExpansionEvent event)
throws ExpandVetoException {
    // prepare wait cursor and optionally show it
    TreePath path = event.getPath();
    prepareWaitCursor(DragDropUtilities.secureFindNode(path.getLastPathComponent()));
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Receives a TreeWillCollapse event and constructs a TableModelEvent
 * based on the pending changes while the model still reflects the unchanged
 * state */
@Override
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
    assert SwingUtilities.isEventDispatchThread();

    log ("treeWillCollapse", event);

    //Construct the TableModelEvent here, before data structures have
    //changed.  We will fire it from TreeCollapsed if the change is 
    //not vetoed.
    pendingExpansionEvent = translateEvent (event, false);
    log ("treeWillCollapse generated ", pendingExpansionEvent);
    inProgressEvent = event;
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Receives a TreeWillExpand event and constructs a TableModelEvent
 * based on the pending changes while the model still reflects the unchanged
 * state */
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
    assert SwingUtilities.isEventDispatchThread();

    log ("treeWillExpand", event);

    //Construct the TableModelEvent here, before data structures have
    //changed.  We will fire it from TreeExpanded if the change is not
    //vetoed
    pendingExpansionEvent = translateEvent (event, true);

    log ("treeWillExpand generated", pendingExpansionEvent);
    inProgressEvent = event;
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
@Override
public void treeCollapsed(TreeExpansionEvent event) {
    assert SwingUtilities.isEventDispatchThread();

    log ("treeCollapsed", event);

    //FixedHeightLayoutCache tests if the event is null.
    //Don't know how it could be, but there's probably a reason...
    if(event != null) {
        TreePath path = event.getPath();

        //Tell the layout about the change
        if(path != null && getTreePathSupport().isVisible(path)) {
            getLayout().setExpandedState(path, false);
        }
    }


    log ("about to fire", pendingExpansionEvent);

    //Now fire a change on the owning row so its display is updated (it
    //may have just become an expandable node)
    int row;
    if (event != null) {
        TreePath path = event.getPath();
        row = getLayout().getRowForPath(path);
    } else {
        row = -1;
    }
    TableModelEvent evt;
    if (row == -1) {
        evt = new TableModelEvent(getModel());
    } else {
        evt = new TableModelEvent(getModel(), row, row, 0, TableModelEvent.UPDATE);
    }
    fireTableChange(new TableModelEvent[] {evt, pendingExpansionEvent});

    pendingExpansionEvent = null;
    inProgressEvent = null;
}
项目:incubator-netbeans    文件:EventBroadcaster.java   
/** Updates the layout to mark the descendants of the events path as also
 * expanded if they were the last it was expanded, then fires a table change. */
@Override
public void treeExpanded(TreeExpansionEvent event) {
    assert SwingUtilities.isEventDispatchThread();

    log ("treeExpanded", event);

    //Mysterious how the event could be null, but JTree tests it
    //so we will too.
    if(event != null) {
        updateExpandedDescendants(event.getPath());
    }

    log ("about to fire", pendingExpansionEvent);

    //Now fire a change on the owning row so its display is updated (it
    //may have just become an expandable node)
    int row;
    if (event != null) {
        TreePath path = event.getPath();
        row = getLayout().getRowForPath(path);
    } else {
        row = -1;
    }
    TableModelEvent evt;
    if (row == -1) {
        evt = new TableModelEvent(getModel());
    } else {
        evt = new TableModelEvent(getModel(), row, row, 0, TableModelEvent.UPDATE);
    }
    fireTableChange(new TableModelEvent[] {evt, pendingExpansionEvent});

    pendingExpansionEvent = null;
    inProgressEvent = null;
}
项目:incubator-netbeans    文件:TreePathSupport.java   
private void fireTreeExpansion (TreeExpansionEvent e, boolean expanded) {
    int size = eListeners.size();

    TreeExpansionListener[] listeners = new TreeExpansionListener[size];
    synchronized (this) {
        listeners = eListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (expanded) {
            listeners[i].treeExpanded(e);
        } else {
            listeners[i].treeCollapsed(e);
        }
    }
}
项目:incubator-netbeans    文件:TreePathSupport.java   
private void fireTreeWillExpand (TreeExpansionEvent e, boolean expanded) throws ExpandVetoException {
    int size = weListeners.size();

    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (expanded) {
            listeners[i].treeWillExpand(e);
        } else {
            listeners[i].treeWillCollapse(e);
        }
    }
}
项目:incubator-netbeans    文件:TreePathSupport.java   
private void fireTreeExpansionVetoed (TreeExpansionEvent e, ExpandVetoException ex) {
    int size = weListeners.size();

    TreeWillExpandListener[] listeners = new TreeWillExpandListener[size];
    synchronized (this) {
        listeners = weListeners.toArray(listeners);
    }
    for (int i=0; i < listeners.length; i++) {
        if (listeners[i] instanceof ExtTreeWillExpandListener) {
            ((ExtTreeWillExpandListener) listeners[i]).treeExpansionVetoed(e,
                ex);
        }
    }
}
项目:incubator-netbeans    文件:Browser.java   
@Override
public void treeExpanded(TreeExpansionEvent event) {
    Object obj = event.getPath().getLastPathComponent();
    if(obj == null) return;
    Node n = Visualizer.findNode(obj);
    if(n instanceof RepositoryPathNode) {
        RepositoryPathNode node = (RepositoryPathNode) n;
        node.expand();
    }
}
项目:incubator-netbeans    文件:HistoryFileView.java   
@Override
public void treeExpanded(TreeExpansionEvent event) {
    Object obj = event.getPath().getLastPathComponent();
    if(obj == null) return;
    Node n = Visualizer.findNode(obj);
    if(HistoryRootNode.isLoadNext(n)) { // XXX move to lhrootnode
        loadNextAction.actionPerformed(null);
    }
}
项目:incubator-netbeans    文件:TreeModelRoot.java   
/**
  * Called whenever an item in the tree has been expanded.
  */
public void treeExpanded (TreeExpansionEvent event) {
    Models.CompoundModel model = getModel();
    if (model != null) {
        model.nodeExpanded (initExpandCollapseNotify(event));
    }
}
项目:incubator-netbeans    文件:TreeModelRoot.java   
/**
  * Called whenever an item in the tree has been collapsed.
  */
public void treeCollapsed (TreeExpansionEvent event) {
    Models.CompoundModel model = getModel();
    if (model != null) {
        model.nodeCollapsed (initExpandCollapseNotify(event));
    }
}
项目:rapidminer    文件:OperatorTree.java   
@Override
public void treeCollapsed(TreeExpansionEvent event) {
    Object last = event.getPath().getLastPathComponent();
    if (last instanceof Operator) {
        ((Operator) last).setExpanded(false);
    } else if (last instanceof ExecutionUnit) {
        ((ExecutionUnit) last).setExpanded(false);
    }
}
项目:rapidminer    文件:OperatorTree.java   
@Override
public void treeExpanded(TreeExpansionEvent event) {
    Object last = event.getPath().getLastPathComponent();
    if (last instanceof Operator) {
        ((Operator) last).setExpanded(true);
    } else if (last instanceof ExecutionUnit) {
        ((ExecutionUnit) last).setExpanded(true);
    }
}
项目:spring16project-Team-Laredo    文件:TaskTable.java   
public void treeCollapsed(TreeExpansionEvent e) {
    TreePath p = e.getPath();
    int index = p.getPathCount() - 1;
    Object collapsed = p.getLastPathComponent();

    Object[] components = expanded.toArray();
    for (Object component : components) {
        TreePath epath = (TreePath) component;
        if ((epath.getPathCount() > index) && (epath.getPathComponent(index).equals(collapsed))) {
            expanded.remove(epath);
        }
    }
}
项目:onagui    文件:MyTreeExpansionListener.java   
@Override
public void treeExpanded(TreeExpansionEvent event) {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) event.getPath().getLastPathComponent();
    Object userObject = node.getUserObject();
    if(userObject instanceof TreeNodeOntologyObject) {
        TreeNodeOntologyObject ontologyNodeObject = (TreeNodeOntologyObject)userObject;
        if(ontologyNodeObject.isExpanded()) return;

        // Save expanded state
        TreePath rootTreePath = new TreePath(((DefaultMutableTreeNode)tree.getModel().getRoot()).getPath());
        Enumeration<TreePath> expandedNodes = tree.getExpandedDescendants(rootTreePath);

        // Expand new node if needed
        ontologyNodeObject.expandNode(node);

        // Restore expanded state
        if (expandedNodes != null) {
            while (expandedNodes.hasMoreElements()) {
                tree.expandPath(expandedNodes.nextElement());
            }
        }

        // Expand new node
        DefaultMutableTreeNode firstChild = (DefaultMutableTreeNode) node.getChildAt(0);
        tree.scrollPathToVisible(new TreePath(firstChild.getPath()));

        // Refresh!
        view.refreshGUIFromModel();
    }
}
项目:spring16project-Modula-2    文件:TaskTable.java   
public void treeCollapsed(TreeExpansionEvent e) {
    TreePath p = e.getPath();
    int index = p.getPathCount() - 1;
    Object collapsed = p.getLastPathComponent();

    Object[] components = expanded.toArray();
    for(int i=0; i<components.length; i++){
        TreePath epath = (TreePath) components[i];
        if( (epath.getPathCount() > index) && (epath.getPathComponent(index).equals(collapsed))){
            expanded.remove(epath);
        }
    }
}
项目:spring16project-Modula-2    文件:DefectTable.java   
public void treeCollapsed(TreeExpansionEvent e) {
    TreePath p = e.getPath();
    int index = p.getPathCount() - 1;
    Object collapsed = p.getLastPathComponent();

    Object[] components = expanded.toArray();
    for(int i=0; i<components.length; i++){
        TreePath epath = (TreePath) components[i];
        if( (epath.getPathCount() > index) && (epath.getPathComponent(index).equals(collapsed))){
            expanded.remove(epath);
        }
    }
}
项目:taxonaut    文件:AlignerTreeSynchronizer.java   
public void treeExpanded(TreeExpansionEvent event)
   {
Object source = event.getSource();
synchronized (this) {
    if(getEventSource() != null ||
       trees == null ||
       trees.isEmpty())
    return;

    setEventSource(event.getSource());
}

Iterator<AlignerTree> t = trees.iterator();
while(t.hasNext()) {
    AlignerTree tree = t.next();
    /*
    if(getEventSource() == tree)
    continue;
    */
    if(tree.isSynchronized()) {
    tree.expandPath(event.getPath());
    }
}

synchronized (this) {
    setEventSource(null);
}
   }
项目:taxonaut    文件:AlignerTree.java   
public synchronized void treeWillCollapse(TreeExpansionEvent event)
   {
if(getEventSource() != null)
    return;

setEventSource(event.getSource());
TreeNode node = (TreeNode)event.getPath().getLastPathComponent();
node = getNodeFor(node);
if(node != null)
    setExpandedState(new TreePath(((DefaultMutableTreeNode)node).getPath()), false);
setEventSource(null);
   }