Java 类com.intellij.ui.CheckboxTree 实例源码

项目:intellij-ce-playground    文件:PushLogTreeUtil.java   
@Nullable
public static Object getTagAtForRenderer(CheckboxTree.CheckboxTreeCellRenderer renderer, MouseEvent e) {
  JTree tree = (JTree)e.getSource();
  Object tag = null;
  final TreePath path = tree.getPathForLocation(e.getX(), e.getY());
  if (path != null) {
    final Rectangle rectangle = tree.getPathBounds(path);
    assert rectangle != null;
    int dx = e.getX() - rectangle.x;
    final TreeNode treeNode = (TreeNode)path.getLastPathComponent();
    final int row = tree.getRowForLocation(e.getX(), e.getY());
    tree.getCellRenderer().getTreeCellRendererComponent(tree, treeNode, false, false, true, row, true);
    if (treeNode instanceof RepositoryNode) {
      RepositoryNode repositoryNode = (RepositoryNode)treeNode;
      int checkBoxWidth = repositoryNode.isCheckboxVisible() ? renderer.getCheckbox().getWidth() : 0;
      tag = renderer.getTextRenderer().getFragmentTagAt(dx - checkBoxWidth);
    }
    else {
      tag = renderer.getTextRenderer().getFragmentTagAt(dx);
    }
  }
  return tag;
}
项目:idea-gitignore    文件:UntrackFilesDialog.java   
/**
 * Creates scroll panel with templates tree in it.
 *
 * @return scroll panel
 */
private JScrollPane createTreeScrollPanel() {
    for (Map.Entry<VirtualFile, VcsRoot> entry : files.entrySet()) {
        createDirectoryNodes(entry.getKey(), entry.getValue());
    }

    final FileTreeRenderer renderer = new FileTreeRenderer();

    tree = new CheckboxTree(renderer, root);
    tree.setCellRenderer(renderer);
    tree.setRootVisible(true);
    tree.setShowsRootHandles(false);
    UIUtil.setLineStyleAngled(tree);
    TreeUtil.installActions(tree);

    final JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(tree);
    scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    TreeUtil.expandAll(tree);

    tree.getModel().addTreeModelListener(treeModelListener);
    treeExpander = new DefaultTreeExpander(tree);

    return scrollPane;
}
项目:consulo    文件:PushLogTreeUtil.java   
@Nullable
public static Object getTagAtForRenderer(CheckboxTree.CheckboxTreeCellRenderer renderer, MouseEvent e) {
  JTree tree = (JTree)e.getSource();
  Object tag = null;
  final TreePath path = tree.getPathForLocation(e.getX(), e.getY());
  if (path != null) {
    final Rectangle rectangle = tree.getPathBounds(path);
    assert rectangle != null;
    int dx = e.getX() - rectangle.x;
    final TreeNode treeNode = (TreeNode)path.getLastPathComponent();
    final int row = tree.getRowForLocation(e.getX(), e.getY());
    tree.getCellRenderer().getTreeCellRendererComponent(tree, treeNode, false, false, true, row, true);
    if (treeNode instanceof RepositoryNode) {
      RepositoryNode repositoryNode = (RepositoryNode)treeNode;
      int checkBoxWidth = repositoryNode.isCheckboxVisible() ? renderer.getCheckbox().getWidth() : 0;
      tag = renderer.getTextRenderer().getFragmentTagAt(dx - checkBoxWidth);
    }
    else {
      tag = renderer.getTextRenderer().getFragmentTagAt(dx);
    }
  }
  return tag;
}
项目:intellij-ce-playground    文件:VcsBranchEditorListener.java   
public VcsBranchEditorListener(final CheckboxTree.CheckboxTreeCellRenderer renderer) {
  myRenderer = renderer;
}
项目:tools-idea    文件:CheckboxTreeTable.java   
public CheckboxTreeTable(CheckedTreeNode root, CheckboxTree.CheckboxTreeCellRenderer renderer, final ColumnInfo[] columns) {
  super(new ListTreeTableModelOnColumns(root, columns));
  initTree(getTree(), renderer);
}
项目:consulo    文件:VcsBranchEditorListener.java   
public VcsBranchEditorListener(final CheckboxTree.CheckboxTreeCellRenderer renderer) {
  myRenderer = renderer;
}
项目:consulo    文件:CheckboxTreeTable.java   
public CheckboxTreeTable(CheckedTreeNode root, CheckboxTree.CheckboxTreeCellRenderer renderer, final ColumnInfo[] columns) {
  super(new ListTreeTableModelOnColumns(root, columns));
  initTree(getTree(), renderer);
}