Package com.GestDB.sql

Examples of com.GestDB.sql.SelectConexion


    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        try {
            // Abre una conexi�n con un gestor de BBDD
            SelectConexion sc = new SelectConexion(this,true);
            sc.setVisible(true);


            if (!sc.wasCanceled() && sc.isAbrir())
            {
                // preparado la lista de conexiones recientes
                Vector vConexionesRecientes = new Vector();
                if(propiedades.containsKey("gestor.recent_connections"))
                {
                    StringTokenizer st1 = new StringTokenizer((String)propiedades.get("gestor.recent_connections"),";",false);
                    while(st1.hasMoreTokens())
                    {
                        vConexionesRecientes.addElement(st1.nextToken());
                    }
                }
                // antes de insertar el elemento teemos que mirar si ya lo teniamos para quitarlo.
                if(vConexionesRecientes.contains(sc.getKey()))
                    vConexionesRecientes.remove(sc.getKey());

                vConexionesRecientes.insertElementAt(sc.getKey(), 0);
                // las guardamos, como m�ximo las 10 �ltimas
                String sTemp = "";
                for(int i = 0, limite = vConexionesRecientes.size(); i < 10 && i < limite; i++)
                {
                    sTemp += (i > 0?";":"") + vConexionesRecientes.elementAt(i);
                }
                propiedades.put("gestor.recent_connections",sTemp);

                ConexionIFrame conexIFrame = new ConexionIFrame(this, sc.getKey(), GetLiteral("gestor.connected_to","Conexi�n con") + ": " + sc.getKey(), sc.getjdbcDriverClass(), sc.getjdbcDriverURL(), sc.getuser(), sc.getpassword());
                conexIFrame.setBounds(0, 0, DesktopPanel.getWidth(), DesktopPanel.getHeight());
                DesktopPanel.add(conexIFrame);
                boolean bPorDefecto = true;

                if((propiedades.containsKey("conexion.tabs.guardar") &&
                    propiedades.getProperty("conexion.tabs.guardar").toLowerCase().equals("true")) ||
                    !propiedades.containsKey("conexion.tabs.guardar"))
                {
                    String tabsXml = getTabs(this);
                    if(tabsXml != null && tabsXml.indexOf("<conection><title>" + sc.getKey() + "</title>") != -1)
                    {
                        int pos1 = tabsXml.indexOf("<conection><title>" + sc.getKey() + "</title>");
                        pos1 = tabsXml.indexOf("</title>",pos1) + 8; // quita el title
                        int pos2 = tabsXml.indexOf("</conection>",pos1);
                        if(pos2 != -1)
                        {
                            bPorDefecto = false;
                            conexIFrame.putXML(tabsXml.substring(pos1,pos2));
                        }
                    }
                }

                if(bPorDefecto)
                {
                    // cargamos una pesta�a de sql por defecto
                    SQLPannel sqlp = new SQLPannel(this, sc.getKey(), conexIFrame.getTitle(), sc.getjdbcDriverClass(), sc.getjdbcDriverURL(), sc.getuser(), sc.getpassword());
                    conexIFrame.jTabbedPane1.add("SQL   ", sqlp);
                    conexIFrame.jTabbedPane1.setSelectedComponent(sqlp);
                    sqlp.jTabbedPane1.grabFocus();
                }
View Full Code Here

TOP

Related Classes of com.GestDB.sql.SelectConexion

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.