当前位置: 首页>>代码示例>>Java>>正文


Java TreeExpansionEvent类代码示例

本文整理汇总了Java中javax.swing.event.TreeExpansionEvent的典型用法代码示例。如果您正苦于以下问题:Java TreeExpansionEvent类的具体用法?Java TreeExpansionEvent怎么用?Java TreeExpansionEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


TreeExpansionEvent类属于javax.swing.event包,在下文中一共展示了TreeExpansionEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: treeExpansionVetoed

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
/** 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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:EventBroadcaster.java

示例2: initExpandCollapseNotify

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:TreeModelRoot.java

示例3: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
@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 );
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:DirectoryChooserUI.java

示例4: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
@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);
	}
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:22,代码来源:Model.java

示例5: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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);
        }
      }
    }
  }
}
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:17,代码来源:WindowsDirectoryChooserUI.java

示例6: treeCollapsed

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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);
   }
 
开发者ID:nomencurator,项目名称:taxonaut,代码行数:25,代码来源:AlignerTreeSynchronizer.java

示例7: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:FileChooserDialogImpl.java

示例8: treeWillExpand

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
@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()));
      }
    });
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:InspectionTree.java

示例9: doubleClickHandler

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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);
            }
        }
    }
}
 
开发者ID:axxepta,项目名称:project-argon,代码行数:20,代码来源:TreeListener.java

示例10: treeWillExpand

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
/**
 * @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()); } } }
     */
}
 
开发者ID:dvorka,项目名称:mindraider,代码行数:27,代码来源:TrashJPanel.java

示例11: treeWillExpand

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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();
    }
}
 
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:20,代码来源:SchemaTree.java

示例12: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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();
                    }

                }
            });
        }

    }
}
 
开发者ID:ytus,项目名称:findbugs-all-the-bugs,代码行数:26,代码来源:MainFrameTree.java

示例13: treeCollapsed

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
/**
 * 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);

}
 
开发者ID:StefanoSalsano,项目名称:alien-ofelia-conet-ccnx,代码行数:24,代码来源:ContentExplorer.java

示例14: folderTreeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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);
    }
}
 
开发者ID:swimmesberger,项目名称:FileTree,代码行数:20,代码来源:FileTree.java

示例15: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入依赖的package包/类
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();
}
 
开发者ID:MegaDiablo,项目名称:android-packages-manager,代码行数:19,代码来源:JFolderChoose.java


注:本文中的javax.swing.event.TreeExpansionEvent类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。