Java 类javax.swing.tree.ExpandVetoException 实例源码

项目: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;
    }
}
项目:javify    文件:JTree.java   
public void expandPath(TreePath path)
{
  // Don't expand if path is null
  // or is already expanded.
  if (path == null || isExpanded(path))
    return;

  try
    {
      fireTreeWillExpand(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }

  setExpandedState(path, true);
  fireTreeExpanded(path);
}
项目: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()));
      }
    });
  }
}
项目:jvm-stm    文件:JTree.java   
public void expandPath(TreePath path)
{
  // Don't expand if path is null
  // or is already expanded.
  if (path == null || isExpanded(path))
    return;

  try
    {
      fireTreeWillExpand(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }

  setExpandedState(path, true);
  fireTreeExpanded(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();
    }
}
项目:cn1    文件:JTree.java   
private void doSetExpandedState(TreePath path, boolean state) {
    if (path == null) {
        return;
    }
    doSetExpandedState(path.getParentPath(), true);
    if (isExpanded(path) == state) {
        return;
    }
    try {
        if (state) {
            fireTreeWillExpand(path);
        } else {
            fireTreeWillCollapse(path);
        }
    } catch (ExpandVetoException e) {
        return;
    }
    togglePaths.put(path, Boolean.valueOf(state));
    if (state) {
        fireTreeExpanded(path);
    } else {
        fireTreeCollapsed(path);
    }
}
项目:JamVM-PH    文件:JTree.java   
public void expandPath(TreePath path)
{
  // Don't expand if path is null
  // or is already expanded.
  if (path == null || isExpanded(path))
    return;

  try
    {
      fireTreeWillExpand(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }

  setExpandedState(path, true);
  fireTreeExpanded(path);
}
项目: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()));
      }
    });
  }
}
项目:classpath    文件:JTree.java   
public void expandPath(TreePath path)
{
  // Don't expand if path is null
  // or is already expanded.
  if (path == null || isExpanded(path))
    return;

  try
    {
      fireTreeWillExpand(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }

  setExpandedState(path, true);
  fireTreeExpanded(path);
}
项目:freeVM    文件:JTree.java   
private void doSetExpandedState(TreePath path, boolean state) {
    if (path == null) {
        return;
    }
    doSetExpandedState(path.getParentPath(), true);
    if (isExpanded(path) == state) {
        return;
    }
    try {
        if (state) {
            fireTreeWillExpand(path);
        } else {
            fireTreeWillCollapse(path);
        }
    } catch (ExpandVetoException e) {
        return;
    }
    togglePaths.put(path, Boolean.valueOf(state));
    if (state) {
        fireTreeExpanded(path);
    } else {
        fireTreeCollapsed(path);
    }
}
项目:freeVM    文件:JTree.java   
private void doSetExpandedState(TreePath path, boolean state) {
    if (path == null) {
        return;
    }
    doSetExpandedState(path.getParentPath(), true);
    if (isExpanded(path) == state) {
        return;
    }
    try {
        if (state) {
            fireTreeWillExpand(path);
        } else {
            fireTreeWillCollapse(path);
        }
    } catch (ExpandVetoException e) {
        return;
    }
    togglePaths.put(path, Boolean.valueOf(state));
    if (state) {
        fireTreeExpanded(path);
    } else {
        fireTreeCollapsed(path);
    }
}
项目:consulo    文件: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()));
      }
    });
  }
}
项目: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    文件: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);
        }
    }
}
项目:openjdk-jdk10    文件:JTreeOperator.java   
/**
 * Maps {@code JTree.fireTreeWillCollapse(TreePath)} through queue
 */
public void fireTreeWillCollapse(final TreePath treePath) {
    runMapping(new MapVoidAction("fireTreeWillCollapse") {
        @Override
        public void map() throws ExpandVetoException {
            ((JTree) getSource()).fireTreeWillCollapse(treePath);
        }
    });
}
项目:openjdk-jdk10    文件:JTreeOperator.java   
/**
 * Maps {@code JTree.fireTreeWillExpand(TreePath)} through queue
 */
public void fireTreeWillExpand(final TreePath treePath) {
    runMapping(new MapVoidAction("fireTreeWillExpand") {
        @Override
        public void map() throws ExpandVetoException {
            ((JTree) getSource()).fireTreeWillExpand(treePath);
        }
    });
}
项目:openjdk9    文件:JTreeOperator.java   
/**
 * Maps {@code JTree.fireTreeWillCollapse(TreePath)} through queue
 */
public void fireTreeWillCollapse(final TreePath treePath) {
    runMapping(new MapVoidAction("fireTreeWillCollapse") {
        @Override
        public void map() throws ExpandVetoException {
            ((JTree) getSource()).fireTreeWillCollapse(treePath);
        }
    });
}
项目:openjdk9    文件:JTreeOperator.java   
/**
 * Maps {@code JTree.fireTreeWillExpand(TreePath)} through queue
 */
public void fireTreeWillExpand(final TreePath treePath) {
    runMapping(new MapVoidAction("fireTreeWillExpand") {
        @Override
        public void map() throws ExpandVetoException {
            ((JTree) getSource()).fireTreeWillExpand(treePath);
        }
    });
}
项目:megan-ce    文件:ViewerJTree.java   
/**
 * Invoked whenever a node in the tree is about to be expanded.
 */
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
    if (classificationViewer.isLocked()) {
        throw new ExpandVetoException(event);
    }
    jTree.addChildren((ViewerJTree.MyJTreeNode) event.getPath().getLastPathComponent());
}
项目:megan-ce    文件:InspectorWindow.java   
/**
 * Invoked whenever a node in the tree is about to be collapsed.
 */
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
    if (inspectorWindow.isLocked()) {
        if (dir.getDocument().getProgressListener() != null)
            dir.getDocument().getProgressListener().setUserCancelled(true);
        throw new ExpandVetoException(event);
    }
}
项目:megan-ce    文件:InspectorWindow.java   
/**
 * Invoked whenever a node in the tree is about to be expanded.
 */
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
    if (inspectorWindow.isLocked()) {
        if (dir.getDocument().getProgressListener() != null)
            dir.getDocument().getProgressListener().setUserCancelled(true);
        throw new ExpandVetoException(event);
    }

    final TreePath path = event.getPath();
    final NodeBase node = (NodeBase) path.getLastPathComponent();
    if (node.getChildCount() > 0) { // has already been expanded
        if (node.isCompleted())
            return;
        else {
            int result = JOptionPane.showConfirmDialog(inspectorWindow.getFrame(), "List of children incomplete, re-fetch?", "Re-fetch", JOptionPane.YES_NO_CANCEL_OPTION);
            if (result == JOptionPane.NO_OPTION)
                return;
            else if (result == JOptionPane.CANCEL_OPTION)
                throw new ExpandVetoException(event);
            else // remove all children to trigger re-download
                node.removeAllChildren();
        }
    }

    if (node instanceof TopLevelNode) {
        inspectorWindow.addChildren((TopLevelNode) node);
    } else if (node instanceof ReadHeadLineNode) {
        inspectorWindow.addChildren((ReadHeadLineNode) node, path.getPathComponent(1).toString());
    }
    if (node instanceof ReadDataHeadLineNode) {
        inspectorWindow.addChildren((ReadDataHeadLineNode) node);
    } else if (node instanceof MatchHeadLineNode) {
        inspectorWindow.addChildren((MatchHeadLineNode) node);
    }
}
项目:javify    文件:JTree.java   
/**
 * Notifies all listeners that the tree will collapse.
 *
 * @param path the path to the node that will collapse
 */
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillCollapse(event);
}
项目:javify    文件:JTree.java   
/**
 * Notifies all listeners that the tree will expand.
 *
 * @param path the path to the node that will expand
 */
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillExpand(event);
}
项目:javify    文件:JTree.java   
public void collapsePath(TreePath path)
{
  try
    {
      fireTreeWillCollapse(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }
  setExpandedState(path, false);
  fireTreeCollapsed(path);
}
项目:intellij-ce-playground    文件:ScopeTreeViewPanel.java   
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
  final TreePath path = event.getPath();
  if (path == null) return;
  final PackageDependenciesNode node = (PackageDependenciesNode)path.getLastPathComponent();
  node.sortChildren();
  ((DefaultTreeModel)myTree.getModel()).reload(node);
}
项目:jvm-stm    文件:JTree.java   
/**
 * Notifies all listeners that the tree will collapse.
 * 
 * @param path the path to the node that will collapse
 */
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillCollapse(event);
}
项目:jvm-stm    文件:JTree.java   
/**
 * Notifies all listeners that the tree will expand.
 * 
 * @param path the path to the node that will expand
 */
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillExpand(event);
}
项目:jvm-stm    文件:JTree.java   
public void collapsePath(TreePath path)
{
  try
    {
      fireTreeWillCollapse(path);
    }
  catch (ExpandVetoException ev)
    {
      // We do nothing if attempt has been vetoed.
    }
  setExpandedState(path, false);
  fireTreeCollapsed(path);
}
项目:smoothcsv    文件:SqlTableList.java   
@Override
public void treeWillExpand(TreeExpansionEvent event) throws ExpandVetoException {
  TreePath path = event.getPath();
  Object obj = path.getLastPathComponent();
  if (obj instanceof AbstractTreeNode) {
    AbstractTreeNode node = (AbstractTreeNode) obj;
    node.beforeExpand();
  }
}
项目:i18n-editor    文件:TranslationTree.java   
@Override
    public void treeWillCollapse(TreeExpansionEvent e) throws ExpandVetoException {
// Prevent root key from being collapsed
        if (e.getPath().getPathCount() == 1) {
            throw new ExpandVetoException(e);                   
        }
    }
项目:KSPSavefileEditor    文件:NodeTreeModel.java   
@Override
public void treeWillExpand(TreeExpansionEvent e) throws ExpandVetoException {
    TreePath tp = e.getPath();
    if(tp!=null){
        TreeBaseNode lpc = (TreeBaseNode) tp.getLastPathComponent();
        if(lpc!=null){
            lpc.isExpanded(true);
        }
    }
}
项目:cats    文件:PreferencePanel.java   
@Override
public void treeWillCollapse(TreeExpansionEvent event)
        throws ExpandVetoException {
    DefaultMutableTreeNode node = (DefaultMutableTreeNode)
       preferenceTree.getLastSelectedPathComponent();

    if(node == top){
        throw new ExpandVetoException(event);
    }
}
项目:cn1    文件:JTree.java   
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException {
    TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
    if (listeners.length == 0) {
        return;
    }
    TreeExpansionEvent event = new TreeExpansionEvent(this, path);
    for (TreeWillExpandListener element : listeners) {
        element.treeWillExpand(event);
    }
}
项目:cn1    文件:JTree.java   
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException {
    TreeWillExpandListener[] listeners = getTreeWillExpandListeners();
    if (listeners.length == 0) {
        return;
    }
    TreeExpansionEvent event = new TreeExpansionEvent(this, path);
    for (TreeWillExpandListener element : listeners) {
        element.treeWillCollapse(event);
    }
}
项目:JamVM-PH    文件:JTree.java   
/**
 * Notifies all listeners that the tree will collapse.
 * 
 * @param path the path to the node that will collapse
 */
public void fireTreeWillCollapse(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillCollapse(event);
}
项目:JamVM-PH    文件:JTree.java   
/**
 * Notifies all listeners that the tree will expand.
 * 
 * @param path the path to the node that will expand
 */
public void fireTreeWillExpand(TreePath path) throws ExpandVetoException
{
  TreeExpansionEvent event = new TreeExpansionEvent(this, path);
  TreeWillExpandListener[] listeners = getTreeWillExpandListeners();

  for (int index = 0; index < listeners.length; ++index)
    listeners[index].treeWillExpand(event);
}