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


Java Tree.setCellRenderer方法代码示例

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


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

示例1: createTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private static Tree createTree(TreeModel treeModel) {
  final Tree tree = new Tree(treeModel);

  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.setDragEnabled(false);
  tree.setEditable(false);
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);


  final TreeSpeedSearch speedSearch = new TreeSpeedSearch(
    tree,
    new Convertor<TreePath, String>() {
      public String convert(TreePath object) {
        final Object userObject = ((DefaultMutableTreeNode)object.getLastPathComponent()).getUserObject();
        return (userObject instanceof Configuration) ? ((Configuration)userObject).getName() : userObject.toString();
      }
    }
  );
  tree.setCellRenderer(new ExistingTemplatesTreeCellRenderer(speedSearch));

  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ExistingTemplatesComponent.java

示例2: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private static void initTree(Tree tree, boolean isRightTree) {
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  tree.setCellRenderer(new MyTreeCellRenderer());
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(tree);

  TreeUtil.installActions(tree);
  new TreeSpeedSearch(tree, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      return o.getLastPathComponent().toString();
    }
  }, true);
  PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(isRightTree, tree), ActionManager.getInstance());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:ModulesDependenciesPanel.java

示例3: FileTemplateTabAsTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected FileTemplateTabAsTree(String title) {
  super(title);
  myRoot = initModel();
  MyTreeModel treeModel = new MyTreeModel(myRoot);
  myTree = new Tree(treeModel);
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(myTree);

  myTree.expandPath(TreeUtil.getPathFromRoot(myRoot));
  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myTree.setCellRenderer(new MyTreeCellRenderer());
  myTree.expandRow(0);

  myTree.addTreeSelectionListener(new TreeSelectionListener() {
    @Override
    public void valueChanged(TreeSelectionEvent e) {
      onTemplateSelected();
    }
  });
  new TreeSpeedSearch(myTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:FileTemplateTabAsTree.java

示例4: DirectoryChooserModuleTreeView

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public DirectoryChooserModuleTreeView(@NotNull Project project) {
  myRootNode = new DefaultMutableTreeNode();
  myTree = new Tree(myRootNode);
  myTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myFileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  myProject = project;
  myTree.setRootVisible(false);
  myTree.setShowsRootHandles(true);
  myTree.setCellRenderer(new MyTreeCellRenderer());
  new TreeSpeedSearch(myTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(final TreePath o) {
      final Object userObject = ((DefaultMutableTreeNode)o.getLastPathComponent()).getUserObject();
      if (userObject instanceof Module) {
        return ((Module)userObject).getName();
      }
      else {
        if (userObject == null) return "";
        return userObject.toString();
      }
    }
  }, true);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:DirectoryChooserModuleTreeView.java

示例5: init

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public void init() {
  final TreeNode root = createRoot(myProject);
  myModel = new DefaultTreeModel(root, true);
  myTree = new Tree(myModel);
  add(ScrollPaneFactory.createScrollPane(myTree), BorderLayout.CENTER);

  myTree.getSelectionModel().setSelectionMode(mySelectionMode);
  myTree.setCellRenderer(new Cvs2Renderer());
  addSelectionListener();

  final TreeUIHelper uiHelper = TreeUIHelper.getInstance();
  uiHelper.installTreeSpeedSearch(myTree);
  TreeUtil.installActions(myTree);

  myTree.requestFocus();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CvsTree.java

示例6: createComponent

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void createComponent() {
  setLayout(new BorderLayout());
  myRepositoryTree = new Tree();
  myRepositoryTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  myRepositoryTree.setRootVisible(false);
  myRepositoryTree.setShowsRootHandles(true);
  JScrollPane scrollPane =
    ScrollPaneFactory.createScrollPane(myRepositoryTree, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
  add(scrollPane, BorderLayout.CENTER);
  myRepositoryTree.setCellRenderer(new SvnRepositoryTreeCellRenderer());
  TreeSpeedSearch search = new TreeSpeedSearch(myRepositoryTree, new Convertor<TreePath, String>() {
    @Override
    public String convert(TreePath o) {
      Object component = o.getLastPathComponent();
      if (component instanceof RepositoryTreeNode) {
        return ((RepositoryTreeNode)component).getURL().toDecodedString();
      }
      return null;
    }
  });
  search.setComparator(new SpeedSearchComparator(false, true));

  EditSourceOnDoubleClickHandler.install(myRepositoryTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:RepositoryBrowserComponent.java

示例7: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected void initTree(Tree tree) {
    tree.setCellRenderer(new ContactTreeCellRenderer());
    tree.setShowsRootHandles(false);
    tree.setRootVisible(false);
    tree.addMouseListener(new IMContactDoubleClicker(getImPanel()));
    tree.setUI(new WideSelectionTreeUI() {

    });
}
 
开发者ID:Jamling,项目名称:SmartQQ4IntelliJ,代码行数:10,代码来源:IMContactView.java

示例8: createUIComponents

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void createUIComponents() {
	bundle = ResourceBundle.getBundle("com.kaylerrenslow.armaplugin.ProjectSettingsBundle");

	tfWithBrowseReferenceDirectory = new TextFieldWithBrowseButton(new JTextField(40));

	treeAddonsRoots_rootNode = new RootTreeNode();
	treeAddonsRoots = new Tree(treeAddonsRoots_rootNode);
	treeAddonsRoots.setCellRenderer(new MyColoredTreeCellRenderer());
	treeAddonsRoots.setHoldSize(true);
	treeAddonsRoots.addTreeSelectionListener(e -> {
		System.out.println("ArmaAddonsSettingsForm.createUIComponents e=" + e);
	});
}
 
开发者ID:kayler-renslow,项目名称:arma-intellij-plugin,代码行数:14,代码来源:ArmaAddonsSettingsForm.java

示例9: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
private void initTree(final Tree tree) {
  final MigrationRootsTreeCellRenderer rootsTreeCellRenderer = new MigrationRootsTreeCellRenderer();
  tree.setCellRenderer(rootsTreeCellRenderer);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  UIUtil.setLineStyleAngled(tree);

  TreeUtil.installActions(tree);
  TreeUtil.expandAll(tree);
  SmartExpander.installOn(tree);
  EditSourceOnDoubleClickHandler.install(tree);
  new TreeSpeedSearch(tree);
  PopupHandler.installUnknownPopupHandler(tree, createTreePopupActions(), ActionManager.getInstance());
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:MigrationPanel.java

示例10: createTreeComponent

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
/**
 * @return a created tree component (to be used as
 */
private JComponent createTreeComponent() {
  myExplanationTree = new Tree(new DefaultTreeModel(buildTree()));
  myExplanationTree.setRootVisible(false);
  myExplanationTree.setCellRenderer(new ExplanationTreeRenderer());
  DataManager.registerDataProvider(myExplanationTree, this);
  TreeUtil.expandAll(myExplanationTree);
  final NavigateAction navigateAction = new NavigateAction();
  navigateAction.registerCustomShortcutSet(new CustomShortcutSet(CommonShortcuts.DOUBLE_CLICK_1.getShortcuts()[0]), myExplanationTree);
  DefaultActionGroup group = new DefaultActionGroup();
  group.addAction(navigateAction);
  PopupHandler.installUnknownPopupHandler(myExplanationTree, group, ActionManager.getInstance());
  return new JBScrollPane(myExplanationTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AnalyzeDependenciesComponent.java

示例11: initTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public void initTree(@NotNull final Tree tree, JComponent mainComponent, CheckboxTreeBase.CheckboxTreeCellRendererBase cellRenderer) {
  tree.setCellRenderer(cellRenderer);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.setLineStyleAngled();
  TreeUtil.installActions(tree);

  setupKeyListener(tree, mainComponent);
  setupMouseListener(tree, mainComponent, cellRenderer);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:CheckboxTreeHelper.java

示例12: ImageDuplicateResultsDialog

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
public ImageDuplicateResultsDialog(Project project, List<VirtualFile> images, Map<String, Set<VirtualFile>> duplicates) {
  super(project);
  myProject = project;
  myImages = images;
  PropertiesComponent.getInstance(myProject).loadFields(myResourceModules);
  myDuplicates = duplicates;
  setModal(false);
  myTree = new Tree(new MyRootNode());
  myTree.setRootVisible(true);
  myTree.setCellRenderer(new MyCellRenderer());
  init();
  TreeUtil.expandAll(myTree);
  setTitle("Image Duplicates");
  TreeUtil.selectFirstNode(myTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ImageDuplicateResultsDialog.java

示例13: configureTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected void configureTree(@NotNull Tree tree) {
  tree.getSelectionModel().setSelectionMode(TreeSelectionModel.DISCONTIGUOUS_TREE_SELECTION);
  tree.setToggleClickCount(-1);
  tree.setCellRenderer(new HierarchyNodeRenderer());
  UIUtil.setLineStyleAngled(tree);
  new TreeSpeedSearch(tree);
  TreeUtil.installActions(tree);
  myAutoScrollToSourceHandler.install(tree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:HierarchyBrowserBase.java

示例14: createTree

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
protected Tree createTree() {
  final Tree tree = new Tree(new DefaultTreeModel(new DefaultMutableTreeNode()));

  tree.setCellRenderer(getTreeCellRenderer());
  UIUtil.setLineStyleAngled(tree);
  tree.setRootVisible(false);
  tree.setShowsRootHandles(true);
  tree.addKeyListener(new TreeKeyListener());
  tree.addTreeSelectionListener(new MyTreeSelectionListener());

  if (!myAllowMultiSelection) {
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  }

  new DoubleClickListener() {
    @Override
    protected boolean onDoubleClick(MouseEvent e) {
      if (tree.getPathForLocation(e.getX(), e.getY()) != null) {
        doOKAction();
        return true;
      }
      return false;
    }
  }.installOn(tree);

  TreeUtil.installActions(tree);
  return tree;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:MemberChooser.java

示例15: GitSkippedCommits

import com.intellij.ui.treeStructure.Tree; //导入方法依赖的package包/类
/**
 * The constructor
 *
 * @param contentManager content manager
 * @param project        the context project
 * @param skippedCommits the map with skipped commits
 */
public GitSkippedCommits(@NotNull ContentManager contentManager,
                         Project project, SortedMap<VirtualFile, List<GitRebaseUtils.CommitInfo>> skippedCommits) {
  super(contentManager, null);
  myProject = project;
  DefaultMutableTreeNode treeRoot = new DefaultMutableTreeNode("ROOT", true);
  for (Map.Entry<VirtualFile, List<GitRebaseUtils.CommitInfo>> e : skippedCommits.entrySet()) {
    DefaultMutableTreeNode vcsRoot = new DefaultMutableTreeNode(new VcsRoot(e.getKey()));
    int missed = 0;
    for (GitRebaseUtils.CommitInfo c : e.getValue()) {
      if (c != null) {
        vcsRoot.add(new DefaultMutableTreeNode(new Commit(e.getKey(), c)));
      }
      else {
        missed++;
      }
    }
    treeRoot.add(vcsRoot);
    if (missed > 0) {
      vcsRoot.add(new DefaultMutableTreeNode("The " + missed + " commit(s) were not parsed due to unsupported rebase directory format"));
    }
  }
  myTree = new Tree(treeRoot);
  myTree.setCellRenderer(createTreeCellRenderer());
  myTree.setRootVisible(false);
  myCenterComponent = new JBScrollPane(myTree);
  init();
  TreeUtil.expandAll(myTree);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:GitSkippedCommits.java


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