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


Java TreeExpansionEvent.getPath方法代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: treeWillExpand

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
@Override
public void treeWillExpand(TreeExpansionEvent event)
throws ExpandVetoException {
    // prepare wait cursor and optionally show it
    TreePath path = event.getPath();
    prepareWaitCursor(DragDropUtilities.secureFindNode(path.getLastPathComponent()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:TreeView.java

示例8: treeCollapsed

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
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);
        }
    }
}
 
开发者ID:cst316,项目名称:spring16project-Team-Laredo,代码行数:14,代码来源:TaskTable.java

示例9: treeCollapsed

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
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);
		}
	}
}
 
开发者ID:cst316,项目名称:spring16project-Modula-2,代码行数:14,代码来源:TaskTable.java

示例10: treeCollapsed

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
@Override
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);
		}
	}
}
 
开发者ID:cst316,项目名称:spring16project-Fortran,代码行数:15,代码来源:TaskTable.java

示例11: treeWillCollapse

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
public void treeWillCollapse(TreeExpansionEvent event) throws ExpandVetoException {
  final TreePath path = event.getPath();
  if (path == null) return;
  final DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  if (node instanceof DirectoryNode) {
    Set<FileNode> fileNodes = null;
    for (int i = node.getChildCount() - 1; i >= 0; i--) {
      final TreeNode childNode = node.getChildAt(i);
      if (childNode instanceof ClassNode) {
        final ClassNode classNode = (ClassNode)childNode;
        final PsiFile containingFile = classNode.getContainingFile();
        if (containingFile != null && containingFile.isValid()) {
          if (fileNodes == null) {
            fileNodes = new HashSet<FileNode>();
          }
          fileNodes.add(new FileNode(containingFile.getVirtualFile(), myProject, true));
        }
        node.remove(classNode);
      }
    }
    if (fileNodes != null) {
      for (FileNode fileNode : fileNodes) {
        node.add(fileNode);
      }
    }
    TreeUtil.sort(node, getNodeComparator());
    final Object source = event.getSource();
    if (source instanceof JTree) {
      ((DefaultTreeModel)((JTree)source).getModel()).reload(node);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ClassesScopeTreeStructureExpander.java

示例12: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
public void treeExpanded(final TreeExpansionEvent event) {
  if (myTreeBuilder == null || !myTreeBuilder.isNodeBeingBuilt(event.getPath())) return;

  TreePath path = event.getPath();
  DefaultMutableTreeNode node = (DefaultMutableTreeNode)path.getLastPathComponent();
  if (node.getUserObject() instanceof FileNodeDescriptor) {
    FileNodeDescriptor nodeDescriptor = (FileNodeDescriptor)node.getUserObject();
    final FileElement fileDescriptor = nodeDescriptor.getElement();
    final VirtualFile virtualFile = fileDescriptor.getFile();
    if (virtualFile != null) {
      if (!myEverExpanded.contains(virtualFile)) {
        if (virtualFile instanceof NewVirtualFile) {
          ((NewVirtualFile)virtualFile).markDirty();
        }
        myEverExpanded.add(virtualFile);
      }


      AbstractTreeStructure treeStructure = myTreeBuilder.getTreeStructure();
      final boolean async = treeStructure != null && treeStructure.isToBuildChildrenInBackground(virtualFile);
      DumbService.allowStartingDumbModeInside(DumbModePermission.MAY_START_MODAL, new Runnable() {
        @Override
        public void run() {
          if (virtualFile instanceof NewVirtualFile) {
            RefreshQueue.getInstance().refresh(async, false, null, ModalityState.stateForComponent(myTree), virtualFile);
          }
          else {
            virtualFile.refresh(async, false);
          }
        }
      });
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:35,代码来源:FileSystemTreeImpl.java

示例13: treeWillExpand

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

示例14: setExpandedState

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
private void setExpandedState(TreeExpansionEvent event, boolean shouldExpand) {
  final TreePath path = event.getPath();
  final AbstractTreeUi ui = getUi();
  final Object lastPathComponent = path.getLastPathComponent();
  if (lastPathComponent != null) {
    final Object element = ui.getElementFor(lastPathComponent);
    if (element instanceof AntBuildFileBase) {
      ((AntBuildFileBase)element).setShouldExpand(shouldExpand);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:AntExplorerTreeBuilder.java

示例15: treeExpanded

import javax.swing.event.TreeExpansionEvent; //导入方法依赖的package包/类
public void treeExpanded(TreeExpansionEvent evt)
{
	// Get the node to be expanded.
	final TreePath path = evt.getPath();
	final Object parentObj = path.getLastPathComponent();
	if (parentObj instanceof ObjectTreeNode)
	{
		startExpandingTree((ObjectTreeNode)parentObj, false, null, false);
		_expandedPathNames.put(path.toString(), null);
	}
}
 
开发者ID:realxujiang,项目名称:bigtable-sql,代码行数:12,代码来源:ObjectTree.java


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