protected void newFlow() {
    m_newFlowBut.setEnabled(false);

    String user = m_viewer.getUser();
    String password = m_viewer.getPassword();
    String uRL = m_viewer.getURL();
    String query = m_viewer.getQuery();

    if (query == null) {
      query = "";
    }

    try {
      DatabaseLoader dbl = new DatabaseLoader();
      dbl.setUser(user);
      dbl.setPassword(password);
      dbl.setUrl(uRL);
      dbl.setQuery(query);

      BeanContextSupport bc = new BeanContextSupport();
      bc.setDesignTime(true);

      Loader loaderComp = new Loader();
      bc.add(loaderComp);
      loaderComp.setLoader(dbl);

      KnowledgeFlowApp singleton = KnowledgeFlowApp.getSingleton();
      m_mainPerspective.addTab("DBSource");
      BeanInstance beanI =
          new BeanInstance(
              m_mainPerspective.getBeanLayout(m_mainPerspective.getNumTabs() - 1),
              loaderComp,
              50,
              50,
              m_mainPerspective.getNumTabs() - 1);
      Vector beans = BeanInstance.getBeanInstances(m_mainPerspective.getNumTabs() - 1);
      Vector connections = BeanConnection.getConnections(m_mainPerspective.getNumTabs() - 1);
      singleton.integrateFlow(beans, connections, true, false);
      singleton.setActivePerspective(0); // switch back to the main perspective

      m_newFlowBut.setEnabled(true);

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  /** Constructor */
  public SQLViewerPerspective() {
    setLayout(new BorderLayout());

    m_viewer = new SqlViewer(null);
    add(m_viewer, BorderLayout.CENTER);

    m_newFlowBut = new JButton("New Flow");
    m_newFlowBut.setToolTipText(
        "Set up a new Knowledge Flow with the " + "current connection and query");
    JPanel butHolder = new JPanel();
    butHolder.add(m_newFlowBut);
    add(butHolder, BorderLayout.SOUTH);

    m_newFlowBut.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent e) {
            if (m_mainPerspective != null) {
              newFlow();
            }
          }
        });
    m_newFlowBut.setEnabled(false);

    m_viewer.addConnectionListener(
        new ConnectionListener() {

          @Override
          public void connectionChange(ConnectionEvent evt) {
            if (evt.getType() == ConnectionEvent.DISCONNECT) {
              m_newFlowBut.setEnabled(false);
            } else {
              m_newFlowBut.setEnabled(true);
            }
          }
        });
  }