Java 类com.intellij.ui.treeStructure.treetable.TreeTableTree 实例源码

项目:intellij-ce-playground    文件:AbstractTreeUpdater.java   
public AbstractTreeUpdater(@NotNull AbstractTreeBuilder treeBuilder) {
  myTreeBuilder = treeBuilder;
  final JTree tree = myTreeBuilder.getTree();
  final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree;
  myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 300, component.isShowing(), component) {
    @Override
    protected Alarm createAlarm(@NotNull Alarm.ThreadToUse thread, Disposable parent) {
      return new Alarm(thread, parent) {
        @Override
        protected boolean isEdt() {
          return AbstractTreeUpdater.this.isEdt();
        }
      };
    }
  };
  myUpdateQueue.setRestartTimerOnAdd(false);

  final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue);
  Disposer.register(this, myUpdateQueue);
  Disposer.register(this, uiNotifyConnector);
}
项目:intellij-ce-playground    文件:CheckboxClickListener.java   
@Override
public boolean onClick(@NotNull MouseEvent e, int clickCount) {
  TreeTableTree tree = myTreeTable.getTree();
  int row = tree.getRowForLocation(e.getX(), e.getY());
  if (row < 0) {
    return false;
  }
  Rectangle rowBounds = tree.getRowBounds(row);
  myRenderer.setBounds(rowBounds);
  Rectangle checkBounds = myRenderer.myCheckbox.getBounds();
  checkBounds.setLocation(rowBounds.getLocation());

  if (checkBounds.height == 0) {
    checkBounds.height = checkBounds.width = rowBounds.height;
  }

  if (checkBounds.contains(e.getPoint())) {
    UpdaterTreeNode node = (UpdaterTreeNode)tree.getPathForRow(row).getLastPathComponent();
    node.cycleState();
    myTreeTable.repaint();
    return true;
  }

  return false;
}
项目:tools-idea    文件:AbstractTreeUpdater.java   
public AbstractTreeUpdater(@NotNull AbstractTreeBuilder treeBuilder) {
  myTreeBuilder = treeBuilder;
  final JTree tree = myTreeBuilder.getTree();
  final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree;
  myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 300, component.isShowing(), component) {
    @Override
    protected Alarm createAlarm(@NotNull Alarm.ThreadToUse thread, Disposable parent) {
      return new Alarm(thread, parent) {
        @Override
        protected boolean isEdt() {
          return AbstractTreeUpdater.this.isEdt();
        }
      };
    }
  };
  myUpdateQueue.setRestartTimerOnAdd(false);

  final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue);
  Disposer.register(this, myUpdateQueue);
  Disposer.register(this, uiNotifyConnector);
}
项目:nosql4idea    文件:JsonTreeTableView.java   
public JsonTreeTableView(TreeNode rootNode, ColumnInfo[] columnInfos) {
    super(new ListTreeTableModelOnColumns(rootNode, columnInfos));
    this.columns = columnInfos;

    final TreeTableTree tree = getTree();

    tree.setShowsRootHandles(true);
    tree.setRootVisible(false);
    UIUtil.setLineStyleAngled(tree);
    setTreeCellRenderer(new KeyCellRenderer());

    TreeUtil.expand(tree, 2);

    new TreeTableSpeedSearch(this, new Convertor<TreePath, String>() {
        @Override
        public String convert(final TreePath path) {
            final NoSqlTreeNode node = (NoSqlTreeNode) path.getLastPathComponent();
            NodeDescriptor descriptor = node.getDescriptor();
            return descriptor.getFormattedKey();
        }
    });
}
项目:nosql4idea    文件:MongoResultPanel.java   
private DBObject getSelectedMongoDocument() {
    TreeTableTree tree = resultTableView.getTree();
    NoSqlTreeNode treeNode = (NoSqlTreeNode) tree.getLastSelectedPathComponent();
    if (treeNode == null) {
        return null;
    }

    NodeDescriptor descriptor = treeNode.getDescriptor();
    if (descriptor instanceof MongoKeyValueDescriptor) {
        MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor;
        if (StringUtils.equals(keyValueDescriptor.getKey(), "_id")) {
            return mongoDocumentOperations.getMongoDocument(keyValueDescriptor.getValue());
        }
    }

    return null;
}
项目:nosql4idea    文件:MongoResultPanel.java   
public boolean isSelectedNodeId() {
    if (resultTableView == null) {
        return false;
    }
    TreeTableTree tree = resultTableView.getTree();
    NoSqlTreeNode treeNode = (NoSqlTreeNode) tree.getLastSelectedPathComponent();
    if (treeNode == null) {
        return false;
    }

    NodeDescriptor descriptor = treeNode.getDescriptor();
    if (descriptor instanceof MongoKeyValueDescriptor) {
        MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor;
        return StringUtils.equals(keyValueDescriptor.getKey(), "_id");
    }

    return false;
}
项目:consulo    文件:AbstractTreeUpdater.java   
public AbstractTreeUpdater(@Nonnull AbstractTreeBuilder treeBuilder) {
  myTreeBuilder = treeBuilder;
  final JTree tree = myTreeBuilder.getTree();
  final JComponent component = tree instanceof TreeTableTree ? ((TreeTableTree)tree).getTreeTable() : tree;
  myUpdateQueue = new MergingUpdateQueue("UpdateQueue", 100, component.isShowing(), component) {
    @Override
    protected Alarm createAlarm(@Nonnull Alarm.ThreadToUse thread, Disposable parent) {
      return new Alarm(thread, parent) {
        @Override
        protected boolean isEdt() {
          return AbstractTreeUpdater.this.isEdt();
        }
      };
    }
  };
  myUpdateQueue.setRestartTimerOnAdd(false);

  final UiNotifyConnector uiNotifyConnector = new UiNotifyConnector(component, myUpdateQueue);
  Disposer.register(this, myUpdateQueue);
  Disposer.register(this, uiNotifyConnector);
}
项目:intellij-ce-playground    文件:CheckboxTreeTable.java   
public CheckboxTreeTable(CheckedTreeNode root, CheckboxTree.CheckboxTreeCellRenderer renderer, final ColumnInfo[] columns) {
  super(new ListTreeTableModelOnColumns(root, columns));
  final TreeTableTree tree = getTree();
  myEventDispatcher = EventDispatcher.create(CheckboxTreeListener.class);
  CheckboxTreeHelper helper = new CheckboxTreeHelper(CheckboxTreeHelper.DEFAULT_POLICY, myEventDispatcher);
  helper.initTree(tree, this, renderer);
  tree.setSelectionRow(0);
}
项目:intellij-ce-playground    文件:CollapseAllAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getProject();
  if (project == null) return;

  final TreeTableTree tree = DynamicToolWindowWrapper.getInstance(project).getTreeTable().getTree();
  TreeUtil.collapseAll(tree, 0);
}
项目:intellij-ce-playground    文件:ExpandAllAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getProject();
  if (project == null) return;

  final TreeTableTree tree = DynamicToolWindowWrapper.getInstance(project).getTreeTable().getTree();
  TreeUtil.expandAll(tree);
}
项目:tools-idea    文件:CollapseAllAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getProject();
  if (project == null) return;

  final TreeTableTree tree = DynamicToolWindowWrapper.getInstance(project).getTreeTable().getTree();
  TreeUtil.collapseAll(tree, 0);
}
项目:tools-idea    文件:ExpandAllAction.java   
@Override
public void actionPerformed(AnActionEvent e) {
  final Project project = e.getProject();
  if (project == null) return;

  final TreeTableTree tree = DynamicToolWindowWrapper.getInstance(project).getTreeTable().getTree();
  TreeUtil.expandAll(tree);
}
项目:intellij-ce-playground    文件:InspectionsConfigTreeTable.java   
@Override
public void setTree(final JTree tree) {
  myTreeTable = ((TreeTableTree)tree).getTreeTable();
}
项目:intellij-ce-playground    文件:AddMultipleFilesOptionsDialog.java   
private void createTree() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode();

  for (AddedFileInfo myRoot : myRoots) {
    root.add(myRoot);
  }

  myModel = new ListTreeTableModelOnColumns(root, COLUMNS);
  myTreeTable = new TreeTableView(myModel);

  int comboHeight = new JComboBox().getPreferredSize().height;
  int checkBoxHeight = new JCheckBox().getPreferredSize().height;
  myTreeTable.setMinRowHeight(Math.max(comboHeight, checkBoxHeight) + 2);
  myTreeTable.setRootVisible(false);
  final JTableHeader tableHeader = myTreeTable.getTableHeader();
  tableHeader.setReorderingAllowed(false);
  tableHeader.setResizingAllowed(false);
  final TreeTableTree tree = myTreeTable.getTree();
  myTreeTable.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      final int keyCode = e.getKeyCode();
      if (keyCode == KeyEvent.VK_SPACE) {
        final int selectedColumn = myTreeTable.getSelectedColumn();
        if (selectedColumn == 0) {
          return;
        }
        final int[] selectedRows = myTreeTable.getSelectedRows();
        if (selectedRows.length == 0) {
          return;
        }
        final boolean included = !((AddedFileInfo)myTreeTable.getValueAt(selectedRows[0], 1)).included();
        for (int selectedRow : selectedRows) {
          final AddedFileInfo addedFileInfo = (AddedFileInfo)myTreeTable.getValueAt(selectedRow, 1);
          addedFileInfo.setIncluded(included);
          myModel.nodeChanged(addedFileInfo);
        }
      }
    }
  });
  tree.setCellRenderer(new AddedFileCellRenderer());
  TreeUtil.installActions(tree);
}
项目:intellij-ce-playground    文件:DynamicToolWindowWrapper.java   
@Nullable
private TreeTableTree getTree() {
  return myTreeTable != null ? myTreeTable.getTree() : null;
}
项目:tools-idea    文件:AddMultipleFilesOptionsDialog.java   
private void createTree() {
  DefaultMutableTreeNode root = new DefaultMutableTreeNode();

  for (AddedFileInfo myRoot : myRoots) {
    root.add(myRoot);
  }

  myModel = new ListTreeTableModelOnColumns(root, COLUMNS);
  myTreeTable = new TreeTableView(myModel);

  int comboHeight = new JComboBox().getPreferredSize().height;
  int checkBoxHeight = new JCheckBox().getPreferredSize().height;
  myTreeTable.setMinRowHeight(Math.max(comboHeight, checkBoxHeight) + 2);
  myTreeTable.setRootVisible(false);
  final JTableHeader tableHeader = myTreeTable.getTableHeader();
  tableHeader.setReorderingAllowed(false);
  tableHeader.setResizingAllowed(false);
  final TreeTableTree tree = myTreeTable.getTree();
  myTreeTable.addKeyListener(new KeyAdapter() {
    @Override
    public void keyPressed(KeyEvent e) {
      final int keyCode = e.getKeyCode();
      if (keyCode == KeyEvent.VK_SPACE) {
        final int selectedColumn = myTreeTable.getSelectedColumn();
        if (selectedColumn == 0) {
          return;
        }
        final int[] selectedRows = myTreeTable.getSelectedRows();
        if (selectedRows.length == 0) {
          return;
        }
        final boolean included = !((AddedFileInfo)myTreeTable.getValueAt(selectedRows[0], 1)).included();
        for (int selectedRow : selectedRows) {
          final AddedFileInfo addedFileInfo = (AddedFileInfo)myTreeTable.getValueAt(selectedRow, 1);
          addedFileInfo.setIncluded(included);
          myModel.nodeChanged(addedFileInfo);
        }
      }
    }
  });
  tree.setCellRenderer(new AddedFileCellRenderer());
  TreeUtil.installActions(tree);
}
项目:tools-idea    文件:DynamicToolWindowWrapper.java   
@Nullable
private TreeTableTree getTree() {
  return myTreeTable != null ? myTreeTable.getTree() : null;
}
项目:nosql4idea    文件:MongoResultPanel.java   
void collapseAll() {
    TreeTableTree tree = resultTableView.getTree();
    TreeUtil.collapseAll(tree, 1);
}
项目:nosql4idea    文件:RedisPanel.java   
void collapseAll() {
    TreeTableTree tree = resultTableView.getTree();
    TreeUtil.collapseAll(tree, 1);
}
项目:nosql4idea    文件:CouchbasePanel.java   
void collapseAll() {
    TreeTableTree tree = resultTableView.getTree();
    TreeUtil.collapseAll(tree, 1);
}
项目:consulo    文件:InspectionsConfigTreeTable.java   
@Override
public void setTree(final JTree tree) {
  myTreeTable = ((TreeTableTree)tree).getTreeTable();
}
项目:nosql4idea    文件:ValueCellRenderer.java   
@Override
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {

    TreeTableTree tree = ((TreeTable) table).getTree();
    TreePath pathForRow = tree.getPathForRow(row);

    final NoSqlTreeNode node = (NoSqlTreeNode) pathForRow.getLastPathComponent();

    node.getDescriptor().renderValue(this, tree.isExpanded(pathForRow));
}