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();
    }
  }
示例#2
0
 /** Sets the owning class loader. */
 @Override
 public void setLoader(DynamicClassLoader loader) {
   super.setLoader(loader);
 }