예제 #1
0
  // double click
  public void doubleClick(TreePath selectionPath) {
    Log log = Utils.getLog();
    long start = System.currentTimeMillis();
    DefaultMutableTreeNode selectedNode =
        (DefaultMutableTreeNode) selectionPath.getLastPathComponent();

    Object userObject = selectedNode.getUserObject();
    if (userObject instanceof Table) {
      mainApp.getTabPane().showTable((Table) userObject);
    }
    log.info("double click time time:" + (System.currentTimeMillis() - start));
  }
예제 #2
0
  // add table to list
  private void addConnectionToTree(Connection conn) {

    Log log = Utils.getLog();

    DefaultTreeModel defTreeModel = (DefaultTreeModel) getModel();

    DefaultMutableTreeNode rootNode = (DefaultMutableTreeNode) getModel().getRoot();

    //
    log.debug(conn.getName());

    DefaultMutableTreeNode nameNode = new DefaultMutableTreeNode(conn.getName(), true);

    DefaultMutableTreeNode tablesNode = new DefaultMutableTreeNode("Tables", true);

    nameNode.setUserObject(conn);
    nameNode.add(tablesNode);

    for (Table mtable : conn.getTableList()) {

      // log.info(mtable);

      DefaultMutableTreeNode tableNode = new DefaultMutableTreeNode(mtable.getName(), true);
      tablesNode.add(tableNode);
      tableNode.setUserObject(mtable);
    }

    DefaultMutableTreeNode confNode =
        new DefaultMutableTreeNode("Tables Count:" + tablesNode.getChildCount(), true);
    nameNode.add(confNode);

    rootNode.add(nameNode);

    defTreeModel.setRoot(rootNode);

    for (int i = 0; i < getRowCount(); i++) {
      expandRow(i);
    }
  }