Diff for /FM2SQL/src/FM2SQL.java between versions 1.4 and 1.5

version 1.4, 2005/03/18 13:31:09 version 1.5, 2005/04/19 10:49:05
Line 68  import javax.swing.SwingConstants; Line 68  import javax.swing.SwingConstants;
 import javax.swing.event.TableModelEvent;  import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;  import javax.swing.event.TableModelListener;
 import javax.swing.table.TableModel;  import javax.swing.table.TableModel;
   
 /**  /**
  *    * 
  * <br>   * <br>
Line 88  public class FM2SQL extends JFrame imple Line 89  public class FM2SQL extends JFrame imple
     private JCheckBoxMenuItem updateItem;      private JCheckBoxMenuItem updateItem;
     private JCheckBoxMenuItem deleteItem;      private JCheckBoxMenuItem deleteItem;
     private JCheckBoxMenuItem useNormanToUnicodeMapper;      private JCheckBoxMenuItem useNormanToUnicodeMapper;
     private JMenuItem aboutBox;
     int mode = -1;      int mode = -1;
     final static int STATUS_INDEX = 0;      final static int STATUS_INDEX = 0;
     final static int NAME_INDEX = 1;      final static int NAME_INDEX = 1;
Line 171  public class FM2SQL extends JFrame imple Line 173  public class FM2SQL extends JFrame imple
   
         initializeGUI();          initializeGUI();
     }      }
   
     public void initializeGUI() throws Exception      public void initializeGUI() throws Exception
     {      {
         Image local = getToolkit().getImage(FM2SQL.class.getResource("icons/fm.jpg"));          Image local = getToolkit().getImage(FM2SQL.class.getResource("icons/fm.jpg"));
Line 180  public class FM2SQL extends JFrame imple Line 183  public class FM2SQL extends JFrame imple
         bean = new DBBean();          bean = new DBBean();
         destBean = new DBBean();          destBean = new DBBean();
         sourceURLBox = new JComboBox(new String[]          sourceURLBox = new JComboBox(new String[]
         {"jdbc:fmpro:http://141.14.237.74:8050", "jdbc:fmpro:http://localhost", "jdbc:postgresql://foxridge/test", "jdbc:sequelink://r583-3:2399"});      { "jdbc:fmpro:http://141.14.237.74:8050", "jdbc:fmpro:http://localhost",
           "jdbc:postgresql://foxridge/test", "jdbc:sequelink://r583-3:2399" });
         sourceURLBox.setEditable(true);          sourceURLBox.setEditable(true);
         sourceURLBox.setFont(new Font("Times New Roman", Font.PLAIN, 14));          sourceURLBox.setFont(new Font("Times New Roman", Font.PLAIN, 14));
         destURLBox = new JComboBox(new String[]          destURLBox = new JComboBox(new String[]
         {"jdbc:postgresql://foxridge/test", "jdbc:postgresql://erebos/test1"});      { "jdbc:postgresql://foxridge/test" });
         destURLBox.setEditable(true);          destURLBox.setEditable(true);
         destURLBox.addActionListener(this);          destURLBox.addActionListener(this);
         destURLBox.setFont(new Font("Times New Roman", Font.PLAIN, 14));          destURLBox.setFont(new Font("Times New Roman", Font.PLAIN, 14));
Line 334  public class FM2SQL extends JFrame imple Line 338  public class FM2SQL extends JFrame imple
         paneDest.setPreferredSize(new Dimension(250, 285));          paneDest.setPreferredSize(new Dimension(250, 285));
   
         getContentPane().add(splitter, "Center");          getContentPane().add(splitter, "Center");
         this.addWindowListener(new WindowAdapter()      this.addWindowListener(new WindowAdapter() {
         {  
             public void windowClosing(WindowEvent e)              public void windowClosing(WindowEvent e)
             {              {
                 bean.closeAllConnections();                  bean.closeAllConnections();
Line 343  public class FM2SQL extends JFrame imple Line 346  public class FM2SQL extends JFrame imple
                 System.exit(0);                  System.exit(0);
             }              }
         });          });
         addComponentListener(new ComponentAdapter()      addComponentListener(new ComponentAdapter() {
         {  
             public void componentResized(ComponentEvent e)              public void componentResized(ComponentEvent e)
             {              {
   
Line 353  public class FM2SQL extends JFrame imple Line 355  public class FM2SQL extends JFrame imple
                     // table.sizeToFit(getWidth(), getHeight());                      // table.sizeToFit(getWidth(), getHeight());
   
                     Dimension dim = table.table.getPreferredSize();                      Dimension dim = table.table.getPreferredSize();
                     int size = contentPanel.getPreferredSize().height + new JScrollBar().getPreferredSize().height + new JMenuBar().getPreferredSize().height + 10;            int size = contentPanel.getPreferredSize().height
                 + new JScrollBar().getPreferredSize().height
                 + new JMenuBar().getPreferredSize().height + 10;
   
                     table.tableScroller.setPreferredSize(new Dimension(getWidth() - 15, getHeight() - size));                      table.tableScroller.setPreferredSize(new Dimension(getWidth() - 15, getHeight() - size));
                     Dimension d2 = table.tableScroller.getPreferredSize();                      Dimension d2 = table.tableScroller.getPreferredSize();
Line 377  public class FM2SQL extends JFrame imple Line 381  public class FM2SQL extends JFrame imple
                 // 5, 370));                  // 5, 370));
                 tC.tableScroller.revalidate();                  tC.tableScroller.revalidate();
                 Dimension dim = getSize();                  Dimension dim = getSize();
                 tC.tableScroller.setMinimumSize(new Dimension(dim.width - 400, dim.height - topPanel.getPreferredSize().height - 100));          tC.tableScroller.setMinimumSize(new Dimension(dim.width - 400, dim.height
               - topPanel.getPreferredSize().height - 100));
                 tC.tableScroller.setMaximumSize(getSize());                  tC.tableScroller.setMaximumSize(getSize());
                 tC.tableScroller.setPreferredSize(tC.tableScroller.getMinimumSize());                  tC.tableScroller.setPreferredSize(tC.tableScroller.getMinimumSize());
   
                 paneDest.setMinimumSize(new Dimension(400, dim.height - topPanel2.getPreferredSize().height - 100));          paneDest.setMinimumSize(new Dimension(400, dim.height - topPanel2.getPreferredSize().height
               - 100));
                 paneDest.setMaximumSize(tC.tableScroller.getMaximumSize());                  paneDest.setMaximumSize(tC.tableScroller.getMaximumSize());
                 paneDest.setPreferredSize(new Dimension(400, dim.height - topPanel2.getPreferredSize().height - 100));          paneDest.setPreferredSize(new Dimension(400, dim.height
               - topPanel2.getPreferredSize().height - 100));
   
                 paneDest.validate();                  paneDest.validate();
                 // tC.tableScroller.setPreferredSize(getSize());                  // tC.tableScroller.setPreferredSize(getSize());
Line 423  public class FM2SQL extends JFrame imple Line 430  public class FM2SQL extends JFrame imple
 //              System.out.println(enume.nextElement() + " " + enum2.nextElement());  //              System.out.println(enume.nextElement() + " " + enum2.nextElement());
 //  //
             if (System.getProperty("os.name").startsWith("W"))              if (System.getProperty("os.name").startsWith("W"))
                 javax.swing.UIManager.setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());          javax.swing.UIManager
             javax.swing.UIManager.put("Table.focusCellHighlightBorder", new javax.swing.border.LineBorder(java.awt.Color.black));              .setLookAndFeel(new com.sun.java.swing.plaf.windows.WindowsLookAndFeel());
             javax.swing.UIManager.put("Table.focusCellBackground", new java.awt.Color(227, 227, 227, 127));        javax.swing.UIManager.put("Table.focusCellHighlightBorder",
             new javax.swing.border.LineBorder(java.awt.Color.black));
         javax.swing.UIManager
             .put("Table.focusCellBackground", new java.awt.Color(227, 227, 227, 127));
   
             fmInstance = new FM2SQL();              fmInstance = new FM2SQL();
             fmInstance.table.tableModel.addTableModelListener(fmInstance);              fmInstance.table.tableModel.addTableModelListener(fmInstance);
             fmInstance.setVisible(true);              fmInstance.setVisible(true);
   
         }      } catch (Exception e)
         catch (Exception e)  
         {          {
             JOptionPane pane = new JOptionPane(e.getMessage() + "  \n URL: " + url, JOptionPane.ERROR_MESSAGE);        JOptionPane pane = new JOptionPane(e.getMessage() + "  \n URL: " + url,
             JOptionPane.ERROR_MESSAGE);
   
             JDialog dialog = pane.createDialog(null, " Exception occured while connecting");              JDialog dialog = pane.createDialog(null, " Exception occured while connecting");
             e.printStackTrace();              e.printStackTrace();
             dialog.addWindowListener(new WindowAdapter()        dialog.addWindowListener(new WindowAdapter() {
             {  
                 public void windowClosing(WindowEvent e)                  public void windowClosing(WindowEvent e)
                 {                  {
                     System.exit(0);                      System.exit(0);
                 }                  }
             });              });
             dialog.addComponentListener(new ComponentAdapter()        dialog.addComponentListener(new ComponentAdapter() {
             {  
   
                 public void componentHidden(ComponentEvent e)                  public void componentHidden(ComponentEvent e)
                 {                  {
Line 457  public class FM2SQL extends JFrame imple Line 465  public class FM2SQL extends JFrame imple
             dialog.setVisible(true);              dialog.setVisible(true);
         }          }
     }      }
   
     public void actionPerformed(ActionEvent e)      public void actionPerformed(ActionEvent e)
     {      {
         String command = e.getActionCommand();          String command = e.getActionCommand();
         if (debug)          if (debug)
             System.out.println("command " + command);              System.out.println("command " + command);
       if (command.equals(aboutBox.getText()))
       {
         JOptionPane.showMessageDialog(fmInstance,Convert.versionID, "About FM2SQL",JOptionPane.INFORMATION_MESSAGE);
       }
   
         if (command == "comboBoxEdited")          if (command == "comboBoxEdited")
         {          {
             Object src = e.getSource();              Object src = e.getSource();
Line 474  public class FM2SQL extends JFrame imple Line 488  public class FM2SQL extends JFrame imple
   
                 ((DefaultComboBoxModel) sourceURLBox.getModel()).insertElementAt(insObj, 0);                  ((DefaultComboBoxModel) sourceURLBox.getModel()).insertElementAt(insObj, 0);
                 sourceURLBox.setSelectedItem(insObj);                  sourceURLBox.setSelectedItem(insObj);
             }        } else if (src == destURLBox)
             else if (src == destURLBox)  
             {              {
                 if (debug)                  if (debug)
                     System.out.println("hey" + destURLBox.getSelectedItem());                      System.out.println("hey" + destURLBox.getSelectedItem());
Line 489  public class FM2SQL extends JFrame imple Line 502  public class FM2SQL extends JFrame imple
                     Vector urls = new Vector();                      Vector urls = new Vector();
                     for (int i = 0; i < catalogs.size(); ++i)                      for (int i = 0; i < catalogs.size(); ++i)
                     {                      {
                         urls.add(destBean.url.substring(0, destBean.url.lastIndexOf("/") + 1) + catalogs.get(i));              urls
                   .add(destBean.url.substring(0, destBean.url.lastIndexOf("/") + 1) + catalogs.get(i));
                     }                      }
                     destURLBox.setModel(new DefaultComboBoxModel(urls));                      destURLBox.setModel(new DefaultComboBoxModel(urls));
                     destURLBox.setSelectedItem(selected);                      destURLBox.setSelectedItem(selected);
                 }          } catch (Exception e5)
                 catch (Exception e5)  
                 {                  {
                 }                  }
             }              }
Line 504  public class FM2SQL extends JFrame imple Line 517  public class FM2SQL extends JFrame imple
             try              try
             {              {
                 // System.out.println("hallo " + (e.getSource() == box3));                  // System.out.println("hallo " + (e.getSource() == box3));
   
                 Object src = e.getSource();                  Object src = e.getSource();
                 if (src == sourceURLBox && !noUserUpdate)                  if (src == sourceURLBox && !noUserUpdate)
                 {                  {
                     Thread thread = new Thread()            Thread thread = new Thread() {
                     {  
                         public void run()                          public void run()
                         {                          {
   
Line 530  public class FM2SQL extends JFrame imple Line 541  public class FM2SQL extends JFrame imple
                                 fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                                  fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                                 fmInstance.setEnabled(true);                                  fmInstance.setEnabled(true);
                                 // System.out.println("hallo" + tables + " ");                                  // System.out.println("hallo" + tables + " ");
                             }                } catch (Exception e5)
                             catch (Exception e5)  
                             {                              {
                                 ByteArrayOutputStream b = new ByteArrayOutputStream();                                  ByteArrayOutputStream b = new ByteArrayOutputStream();
                                 PrintStream stream = new PrintStream(b);                                  PrintStream stream = new PrintStream(b);
Line 554  public class FM2SQL extends JFrame imple Line 564  public class FM2SQL extends JFrame imple
                         }                          }
                     };                      };
                     thread.start();                      thread.start();
                 }          } else if (src == destURLBox && !noUserUpdate)
                 else if (src == destURLBox && !noUserUpdate)  
                 {  
                     Thread thread = new Thread()  
                     {                      {
             Thread thread = new Thread() {
                         public void run()                          public void run()
                         {                          {
   
Line 581  public class FM2SQL extends JFrame imple Line 589  public class FM2SQL extends JFrame imple
                                 // System.out.println("hallo" + tables + " ");                                  // System.out.println("hallo" + tables + " ");
                                 fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                                  fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                                 fmInstance.setEnabled(true);                                  fmInstance.setEnabled(true);
                             }                } catch (Exception e5)
                             catch (Exception e5)  
                             {                              {
                                 ByteArrayOutputStream b = new ByteArrayOutputStream();                                  ByteArrayOutputStream b = new ByteArrayOutputStream();
                                 PrintStream stream = new PrintStream(b);                                  PrintStream stream = new PrintStream(b);
Line 603  public class FM2SQL extends JFrame imple Line 610  public class FM2SQL extends JFrame imple
                 setTitle("Filemaker 2 SQL Conversion Tool ");                  setTitle("Filemaker 2 SQL Conversion Tool ");
                 // pack();                  // pack();
   
             }        } catch (Exception e4)
             catch (Exception e4)  
             {              {
                 ByteArrayOutputStream b = new ByteArrayOutputStream();                  ByteArrayOutputStream b = new ByteArrayOutputStream();
                 PrintStream stream = new PrintStream(b);                  PrintStream stream = new PrintStream(b);
Line 624  public class FM2SQL extends JFrame imple Line 630  public class FM2SQL extends JFrame imple
                 result.title = "Database features";                  result.title = "Database features";
                 result.setVisible(true);                  result.setVisible(true);
                 String name = result.writeResult();                  String name = result.writeResult();
             }        } catch (Exception e2)
             catch (Exception e2)  
             {              {
             }              }
         }          }
Line 693  public class FM2SQL extends JFrame imple Line 698  public class FM2SQL extends JFrame imple
                 configExportFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);                  configExportFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                 configExportFileChooser.setFileFilter(new XMLFilter());                  configExportFileChooser.setFileFilter(new XMLFilter());
                 configExportFileChooser.setDialogType(JFileChooser.SAVE_DIALOG);                  configExportFileChooser.setDialogType(JFileChooser.SAVE_DIALOG);
                 configExportFileChooser.addActionListener(new ActionListener()          configExportFileChooser.addActionListener(new ActionListener() {
                 {  
                     public void actionPerformed(ActionEvent e2)                      public void actionPerformed(ActionEvent e2)
                     {                      {
                         System.out.println(e2.getActionCommand());                          System.out.println(e2.getActionCommand());
                         if (!e2.getActionCommand().toString().equals("ApproveSelection"))                          if (!e2.getActionCommand().toString().equals("ApproveSelection"))
                             return;                              return;
   
                         Thread thread = new Thread()              Thread thread = new Thread() {
                         {  
                             public void run()                              public void run()
                             {                              {
                                 File configFile = configExportFileChooser.getSelectedFile();                                  File configFile = configExportFileChooser.getSelectedFile();
Line 727  public class FM2SQL extends JFrame imple Line 730  public class FM2SQL extends JFrame imple
                 configImportFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);                  configImportFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES);
                 configImportFileChooser.setFileFilter(new XMLFilter());                  configImportFileChooser.setFileFilter(new XMLFilter());
                 configImportFileChooser.setDialogType(JFileChooser.OPEN_DIALOG);                  configImportFileChooser.setDialogType(JFileChooser.OPEN_DIALOG);
                 configImportFileChooser.addActionListener(new ActionListener()          configImportFileChooser.addActionListener(new ActionListener() {
                 {  
                     public void actionPerformed(ActionEvent e2)                      public void actionPerformed(ActionEvent e2)
                     {                      {
                         System.out.println(e2.getActionCommand());                          System.out.println(e2.getActionCommand());
                         if (!e2.getActionCommand().toString().equals("ApproveSelection"))                          if (!e2.getActionCommand().toString().equals("ApproveSelection"))
                             return;                              return;
   
                         Thread thread = new Thread()              Thread thread = new Thread() {
                         {  
                             public void run()                              public void run()
                             {                              {
                                 File configFile = configImportFileChooser.getSelectedFile();                                  File configFile = configImportFileChooser.getSelectedFile();
Line 757  public class FM2SQL extends JFrame imple Line 758  public class FM2SQL extends JFrame imple
         if (command.equals("Convert Tables") || command.equals("Append Tables"))          if (command.equals("Convert Tables") || command.equals("Append Tables"))
         {          {
   
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     setEnabled(false);                      setEnabled(false);
Line 772  public class FM2SQL extends JFrame imple Line 772  public class FM2SQL extends JFrame imple
         if (command.equals("Update Tables"))          if (command.equals("Update Tables"))
         {          {
   
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     setEnabled(false);                      setEnabled(false);
Line 787  public class FM2SQL extends JFrame imple Line 786  public class FM2SQL extends JFrame imple
         if (command.equals("Delete Tables"))          if (command.equals("Delete Tables"))
         {          {
   
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     setEnabled(false);                      setEnabled(false);
Line 802  public class FM2SQL extends JFrame imple Line 800  public class FM2SQL extends JFrame imple
         if (command.equals("Synchronize Tables"))          if (command.equals("Synchronize Tables"))
         {          {
   
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     setEnabled(false);                      setEnabled(false);
Line 817  public class FM2SQL extends JFrame imple Line 814  public class FM2SQL extends JFrame imple
   
         if (command.equals("show Tables"))          if (command.equals("show Tables"))
         {          {
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     fmInstance.setEnabled(false);                      fmInstance.setEnabled(false);
Line 835  public class FM2SQL extends JFrame imple Line 831  public class FM2SQL extends JFrame imple
         }          }
         if (command.equals("show Tables source"))          if (command.equals("show Tables source"))
         {          {
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     fmInstance.setEnabled(false);                      fmInstance.setEnabled(false);
Line 853  public class FM2SQL extends JFrame imple Line 848  public class FM2SQL extends JFrame imple
   
         if (command.equals("drop Tables"))          if (command.equals("drop Tables"))
         {          {
             Thread thread = new Thread()        Thread thread = new Thread() {
             {  
                 public void run()                  public void run()
                 {                  {
                     dropTable();                      dropTable();
Line 872  public class FM2SQL extends JFrame imple Line 866  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     /**      /**
      *        * 
      */       */
Line 888  public class FM2SQL extends JFrame imple Line 883  public class FM2SQL extends JFrame imple
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
             fmInstance.setEnabled(false);              fmInstance.setEnabled(false);
             // TODO indexList vector weiter reichen              // TODO indexList vector weiter reichen
             Convert.synchronize(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], mode, delimiter, new Vector());        Convert.synchronize(bean.url, destURLBox.getSelectedItem().toString(), vectors[0],
             vectors[1], vectors[2], vectors[3], vectors[4], mode, delimiter, new Vector());
   
             destBean.setConnection((String) destURLBox.getSelectedItem());              destBean.setConnection((String) destURLBox.getSelectedItem());
             DefaultListModel model = new DefaultListModel();              DefaultListModel model = new DefaultListModel();
Line 899  public class FM2SQL extends JFrame imple Line 895  public class FM2SQL extends JFrame imple
                 System.out.println("hallo" + tables + " ");                  System.out.println("hallo" + tables + " ");
             tListDest.setModel(model);              tListDest.setModel(model);
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         }      } catch (Exception e4)
         catch (Exception e4)  
         {          {
             ByteArrayOutputStream b = new ByteArrayOutputStream();              ByteArrayOutputStream b = new ByteArrayOutputStream();
             PrintStream stream = new PrintStream(b);              PrintStream stream = new PrintStream(b);
Line 910  public class FM2SQL extends JFrame imple Line 905  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     /**      /**
      * Updates the content of source to destination and makes new table if       * Updates the content of source to destination and makes new table if
      * necessary       * necessary
Line 927  public class FM2SQL extends JFrame imple Line 923  public class FM2SQL extends JFrame imple
   
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
             fmInstance.setEnabled(false);              fmInstance.setEnabled(false);
             Convert.update(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], mode);        Convert.update(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1],
             vectors[2], vectors[3], vectors[4], mode);
   
             destBean.setConnection((String) destURLBox.getSelectedItem());              destBean.setConnection((String) destURLBox.getSelectedItem());
             DefaultListModel model = new DefaultListModel();              DefaultListModel model = new DefaultListModel();
Line 938  public class FM2SQL extends JFrame imple Line 935  public class FM2SQL extends JFrame imple
                 System.out.println("hallo" + tables + " ");                  System.out.println("hallo" + tables + " ");
             tListDest.setModel(model);              tListDest.setModel(model);
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         }      } catch (Exception e4)
         catch (Exception e4)  
         {          {
             ByteArrayOutputStream b = new ByteArrayOutputStream();              ByteArrayOutputStream b = new ByteArrayOutputStream();
             PrintStream stream = new PrintStream(b);              PrintStream stream = new PrintStream(b);
Line 949  public class FM2SQL extends JFrame imple Line 945  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     public void delete()      public void delete()
     {      {
         Vector vectors[] = getListFromTable();          Vector vectors[] = getListFromTable();
Line 961  public class FM2SQL extends JFrame imple Line 958  public class FM2SQL extends JFrame imple
   
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
             fmInstance.setEnabled(false);              fmInstance.setEnabled(false);
             Convert.delete(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], mode);        Convert.delete(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1],
             vectors[2], vectors[3], vectors[4], mode);
   
             destBean.setConnection((String) destURLBox.getSelectedItem());              destBean.setConnection((String) destURLBox.getSelectedItem());
             DefaultListModel model = new DefaultListModel();              DefaultListModel model = new DefaultListModel();
Line 972  public class FM2SQL extends JFrame imple Line 970  public class FM2SQL extends JFrame imple
                 System.out.println("hallo" + tables + " ");                  System.out.println("hallo" + tables + " ");
             tListDest.setModel(model);              tListDest.setModel(model);
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         }      } catch (Exception e4)
         catch (Exception e4)  
         {          {
             ByteArrayOutputStream b = new ByteArrayOutputStream();              ByteArrayOutputStream b = new ByteArrayOutputStream();
             PrintStream stream = new PrintStream(b);              PrintStream stream = new PrintStream(b);
Line 999  public class FM2SQL extends JFrame imple Line 996  public class FM2SQL extends JFrame imple
         {          {
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
             fmInstance.setEnabled(false);              fmInstance.setEnabled(false);
             Convert.convert(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], mode, delimiter);        Convert.convert(bean.url, destURLBox.getSelectedItem().toString(), vectors[0], vectors[1],
             vectors[2], vectors[3], vectors[4], mode, delimiter);
             destBean.setConnection((String) destURLBox.getSelectedItem());              destBean.setConnection((String) destURLBox.getSelectedItem());
             DefaultListModel model = new DefaultListModel();              DefaultListModel model = new DefaultListModel();
             tables = destBean.getTableNames();              tables = destBean.getTableNames();
Line 1009  public class FM2SQL extends JFrame imple Line 1007  public class FM2SQL extends JFrame imple
                 System.out.println("hallo" + tables + " ");                  System.out.println("hallo" + tables + " ");
             tListDest.setModel(model);              tListDest.setModel(model);
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
         }      } catch (Exception e4)
         catch (Exception e4)  
         {          {
             ByteArrayOutputStream b = new ByteArrayOutputStream();              ByteArrayOutputStream b = new ByteArrayOutputStream();
             PrintStream stream = new PrintStream(b);              PrintStream stream = new PrintStream(b);
Line 1019  public class FM2SQL extends JFrame imple Line 1016  public class FM2SQL extends JFrame imple
             fmInstance.setEnabled(true);              fmInstance.setEnabled(true);
         }          }
     }      }
   
     public void writeConfig(String file)      public void writeConfig(String file)
     {      {
         fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));          fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
Line 1037  public class FM2SQL extends JFrame imple Line 1035  public class FM2SQL extends JFrame imple
             mode = Convert.DataBase.SYNCHRONIZE_MODE;              mode = Convert.DataBase.SYNCHRONIZE_MODE;
   
         // TODO add id vector in table and write it out          // TODO add id vector in table and write it out
         Convert.DataBase source = new Convert.DataBase(bean, vectors[0], vectors[1], vectors[2], vectors[3], vectors[4], mode);      Convert.DataBase source = new Convert.DataBase(bean, vectors[0], vectors[1], vectors[2],
         Convert.DataBase destination = new Convert.DataBase(destBean, new Vector(), new Vector(), new Vector(), new Vector(), new Vector(), -1);          vectors[3], vectors[4], mode);
       Convert.DataBase destination = new Convert.DataBase(destBean, new Vector(), new Vector(),
           new Vector(), new Vector(), new Vector(), -1);
         source.delimiter = delimiter;          source.delimiter = delimiter;
         source.useNormanToUnicodeMapper = useNormanToUnicodeMapper.isSelected();          source.useNormanToUnicodeMapper = useNormanToUnicodeMapper.isSelected();
         try          try
Line 1047  public class FM2SQL extends JFrame imple Line 1047  public class FM2SQL extends JFrame imple
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             fmInstance.setEnabled(true);              fmInstance.setEnabled(true);
   
         }      } catch (Exception e)
         catch (Exception e)  
         {          {
             fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));              fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
             fmInstance.setEnabled(true);              fmInstance.setEnabled(true);
Line 1060  public class FM2SQL extends JFrame imple Line 1059  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     public void readXMLConfig(String file)      public void readXMLConfig(String file)
     {      {
   
Line 1085  public class FM2SQL extends JFrame imple Line 1085  public class FM2SQL extends JFrame imple
                 if (database.mode == Convert.DataBase.CONVERT_MODE)                  if (database.mode == Convert.DataBase.CONVERT_MODE)
                 {                  {
                     convertItem.doClick();                      convertItem.doClick();
                 }          } else if (database.mode == Convert.DataBase.APPEND_MODE)
                 else if (database.mode == Convert.DataBase.APPEND_MODE)  
                 {                  {
                     appendItem.doClick();                      appendItem.doClick();
                 }          } else if (database.mode == Convert.DataBase.UPDATE_MODE)
                 else if (database.mode == Convert.DataBase.UPDATE_MODE)  
                 {                  {
                     updateItem.doClick();                      updateItem.doClick();
                 }          } else if (database.mode == Convert.DataBase.DELETE_MODE)
                 else if (database.mode == Convert.DataBase.DELETE_MODE)  
                 {                  {
                     deleteItem.doClick();                      deleteItem.doClick();
                 }          } else if (database.mode == Convert.DataBase.SYNCHRONIZE_MODE)
                 else if (database.mode == Convert.DataBase.SYNCHRONIZE_MODE)  
                 {                  {
                     synchronizeItem.doClick();                      synchronizeItem.doClick();
                 }                  }
Line 1122  public class FM2SQL extends JFrame imple Line 1118  public class FM2SQL extends JFrame imple
                     String table = (String) database.tables.get(i);                      String table = (String) database.tables.get(i);
                     int index = tables.indexOf(table);                      int index = tables.indexOf(table);
                     if (index < 0)                      if (index < 0)
                         throw new RuntimeException("Error table \"" + table + "\" does no longer exist\n at server " + bean.url + "\n or you mispelled the tablename.");              throw new RuntimeException("Error table \"" + table
                   + "\" does no longer exist\n at server " + bean.url
                   + "\n or you mispelled the tablename.");
                     noDBUpdate = true;                      noDBUpdate = true;
                     tC.tableModel.setValueAt(new TableComponent.SQLCommand(database.selects.get(i).toString()), index, SELECT_INDEX);            tC.tableModel.setValueAt(
                 new TableComponent.SQLCommand(database.selects.get(i).toString()), index,
                 SELECT_INDEX);
   
                     String create = database.creates.get(i).toString();                      String create = database.creates.get(i).toString();
                     tC.tableModel.setValueAt(new TableComponent.SQLCommand(create.equals("") ? create : "           " + create), index, CREATE_INDEX);            tC.tableModel.setValueAt(new TableComponent.SQLCommand(create.equals("") ? create
                 : "           " + create), index, CREATE_INDEX);
                     // tC.tableModel.setValueAt(new                      // tC.tableModel.setValueAt(new
                     // TableComponent.SQLCommand(bean.ids.get(i).toString()),index,ID_INDEX);                      // TableComponent.SQLCommand(bean.ids.get(i).toString()),index,ID_INDEX);
   
Line 1141  public class FM2SQL extends JFrame imple Line 1142  public class FM2SQL extends JFrame imple
                         ((JComboBox) comboBox).setSelectedItem(layout);                          ((JComboBox) comboBox).setSelectedItem(layout);
                         if (layout != "")                          if (layout != "")
                         {                          {
                             bean.makeQuery("select * from" + bean.getQC() + table + bean.getQC() + " layout " + bean.getQC() + layout + bean.getQC(), 1);                bean.makeQuery("select * from" + bean.getQC() + table + bean.getQC() + " layout "
                     + bean.getQC() + layout + bean.getQC(), 1);
   
                             Vector idVec = bean.getColumnNames();                              Vector idVec = bean.getColumnNames();
                             if (idVec == null)                              if (idVec == null)
Line 1178  public class FM2SQL extends JFrame imple Line 1180  public class FM2SQL extends JFrame imple
   
             }              }
   
         }      } catch (Exception e)
         catch (Exception e)  
         {          {
             noUserUpdate = false;              noUserUpdate = false;
             noDBUpdate = false;              noDBUpdate = false;
Line 1193  public class FM2SQL extends JFrame imple Line 1194  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     public boolean showTable(int list)      public boolean showTable(int list)
     {      {
         ProgressDialog dialog = new ProgressDialog(fm, bean);          ProgressDialog dialog = new ProgressDialog(fm, bean);
Line 1222  public class FM2SQL extends JFrame imple Line 1224  public class FM2SQL extends JFrame imple
             windowDest = new MultiResultWindow(fm);              windowDest = new MultiResultWindow(fm);
             window = windowDest;              window = windowDest;
         }          }
         dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x + (FM2SQL.fmInstance.getWidth() - 500) / 2, FM2SQL.fmInstance.getLocationOnScreen().y + (FM2SQL.fmInstance.getHeight() - 250) / 2);      dialog.setLocation(FM2SQL.fmInstance.getLocationOnScreen().x
           + (FM2SQL.fmInstance.getWidth() - 500) / 2, FM2SQL.fmInstance.getLocationOnScreen().y
           + (FM2SQL.fmInstance.getHeight() - 250) / 2);
         dialog.setSize(500, 250);          dialog.setSize(500, 250);
         if (!tables.isEmpty())          if (!tables.isEmpty())
             dialog.setVisible(true);              dialog.setVisible(true);
Line 1256  public class FM2SQL extends JFrame imple Line 1260  public class FM2SQL extends JFrame imple
   
             try              try
             {              {
                 if ((query.toLowerCase().indexOf("insert") >= 0) || (query.toLowerCase().indexOf("delete") >= 0) || (query.toLowerCase().indexOf("alter") >= 0) || (query.toLowerCase().indexOf("update") >= 0))          if ((query.toLowerCase().indexOf("insert") >= 0)
               || (query.toLowerCase().indexOf("delete") >= 0)
               || (query.toLowerCase().indexOf("alter") >= 0)
               || (query.toLowerCase().indexOf("update") >= 0))
                 {                  {
                     Statement stm = (list > 0) ? destBean.getConnection().createStatement() : bean.getConnection().createStatement();            Statement stm = (list > 0) ? destBean.getConnection().createStatement() : bean
                 .getConnection().createStatement();
                     stm.executeUpdate(query);                      stm.executeUpdate(query);
                     Vector vec = new Vector();                      Vector vec = new Vector();
                     Vector vec2 = new Vector();                      Vector vec2 = new Vector();
Line 1272  public class FM2SQL extends JFrame imple Line 1280  public class FM2SQL extends JFrame imple
                     // window.pack();                      // window.pack();
                     // window.setVisible(true);                      // window.setVisible(true);
   
                 }          } else
                 else  
                 {                  {
                     Vector[] vecs = (list > 0) ? destBean.getQueryData(query, dialog, 50) : bean.getQueryData(query, dialog, 50);            Vector[] vecs = (list > 0) ? destBean.getQueryData(query, dialog, 50) : bean
                 .getQueryData(query, dialog, 50);
                     if (vecs[1].isEmpty())                      if (vecs[1].isEmpty())
                         throw new Exception("Wrong columnname or Empty Layout");                          throw new Exception("Wrong columnname or Empty Layout");
                     window.updateResult(vecs[0], vecs[1]);                      window.updateResult(vecs[0], vecs[1]);
Line 1287  public class FM2SQL extends JFrame imple Line 1295  public class FM2SQL extends JFrame imple
   
                 // window.setVisible(true);                  // window.setVisible(true);
   
             }        } catch (Exception e)
             catch (Exception e)  
             {              {
                 System.out.println("Exception occured");                  System.out.println("Exception occured");
                 e.printStackTrace();                  e.printStackTrace();
Line 1338  public class FM2SQL extends JFrame imple Line 1345  public class FM2SQL extends JFrame imple
             {              {
                 Statement stm = destBean.getConnection().createStatement();                  Statement stm = destBean.getConnection().createStatement();
                 stm.executeUpdate(query);                  stm.executeUpdate(query);
             }        } catch (Exception e)
             catch (Exception e)  
             {              {
                 ByteArrayOutputStream b = new ByteArrayOutputStream();                  ByteArrayOutputStream b = new ByteArrayOutputStream();
                 PrintStream stream = new PrintStream(b);                  PrintStream stream = new PrintStream(b);
Line 1357  public class FM2SQL extends JFrame imple Line 1363  public class FM2SQL extends JFrame imple
                 model.addElement(tables.get(j));                  model.addElement(tables.get(j));
             System.out.println("hallo" + tables + " ");              System.out.println("hallo" + tables + " ");
             tListDest.setModel(model);              tListDest.setModel(model);
         }      } catch (Exception e4)
         catch (Exception e4)  
         {          {
         }          }
   
     }      }
   
     /**      /**
      * invoked then the user changes the table or the tableModel changes       * invoked then the user changes the table or the tableModel changes
      */       */
Line 1391  public class FM2SQL extends JFrame imple Line 1397  public class FM2SQL extends JFrame imple
                 if (columnName.equals("select") || columnName.equals("Layouts"))                  if (columnName.equals("select") || columnName.equals("Layouts"))
                 {                  {
                     String table = model.getValueAt(row, NAME_INDEX).toString();                      String table = model.getValueAt(row, NAME_INDEX).toString();
                     String layout = (model.getValueAt(row, LAYOUT_INDEX) != null) ? ((JComboBox) model.getValueAt(row, LAYOUT_INDEX)).getSelectedItem().toString() : "";            String layout = (model.getValueAt(row, LAYOUT_INDEX) != null) ? ((JComboBox) model
                 .getValueAt(row, LAYOUT_INDEX)).getSelectedItem().toString() : "";
                     String query = model.getValueAt(row, SELECT_INDEX).toString();                      String query = model.getValueAt(row, SELECT_INDEX).toString();
                     String create = model.getValueAt(row, CREATE_INDEX).toString();                      String create = model.getValueAt(row, CREATE_INDEX).toString();
                     String id = (model.getValueAt(row, ID_INDEX) != null) ? ((JComboBox) model.getValueAt(row, ID_INDEX)).getSelectedItem().toString() : "";            String id = (model.getValueAt(row, ID_INDEX) != null) ? ((JComboBox) model.getValueAt(
                 row, ID_INDEX)).getSelectedItem().toString() : "";
   
                     System.out.println("table" + table + " layout " + layout + " query " + query);                      System.out.println("table" + table + " layout " + layout + " query " + query);
                     if (!create.equals(""))                      if (!create.equals(""))
                     {                      {
                         Object[] options =                          Object[] options =
                         {"Yes", "No"};                          {"Yes", "No"};
                         int option = showDialog("Create Statement not empty! Do you want to overwrite?", "create statement", options);              int option = showDialog("Create Statement not empty! Do you want to overwrite?",
                   "create statement", options);
                         if (option == 0)                          if (option == 0)
                             model.setValueAt(createStatement(table, destBean, layout, query), row, CREATE_INDEX);                              model.setValueAt(createStatement(table, destBean, layout, query), row, CREATE_INDEX);
                     }                      }
                     if (columnName.equals("Layouts"))                      if (columnName.equals("Layouts"))
                     {                      {
   
                         bean.makeQuery("select * from" + bean.getQC() + table + bean.getQC() + " layout " + bean.getQC() + layout + bean.getQC(), 1);              bean.makeQuery("select * from" + bean.getQC() + table + bean.getQC() + " layout "
                   + bean.getQC() + layout + bean.getQC(), 1);
   
                         Vector idVec = bean.getColumnNames();                          Vector idVec = bean.getColumnNames();
                         if (idVec == null)                          if (idVec == null)
Line 1435  public class FM2SQL extends JFrame imple Line 1445  public class FM2SQL extends JFrame imple
                  * columnName + DBBean.quoteChar + "='" + value + "' WHERE ID='" + idVal + "'                   * columnName + DBBean.quoteChar + "='" + value + "' WHERE ID='" + idVal + "'
                  * ");                   * ");
                  */                   */
             }        } catch (Exception e2)
             catch (Exception e2)  
             {              {
                 fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                  fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                 ByteArrayOutputStream b = new ByteArrayOutputStream();                  ByteArrayOutputStream b = new ByteArrayOutputStream();
Line 1507  public class FM2SQL extends JFrame imple Line 1516  public class FM2SQL extends JFrame imple
   
         menu.add(updateItem);          menu.add(updateItem);
         deleteItem = new JCheckBoxMenuItem("Delete Mode");          deleteItem = new JCheckBoxMenuItem("Delete Mode");
         deleteItem.setToolTipText("Deletes data in an existing table \n that has been deleted in source table");      deleteItem
           .setToolTipText("Deletes data in an existing table \n that has been deleted in source table");
         deleteItem.addActionListener(fm);          deleteItem.addActionListener(fm);
   
         bgrp.add(deleteItem);          bgrp.add(deleteItem);
   
         menu.add(deleteItem);          menu.add(deleteItem);
         synchronizeItem = new JCheckBoxMenuItem("Synchronize Mode");          synchronizeItem = new JCheckBoxMenuItem("Synchronize Mode");
         synchronizeItem.setToolTipText("Synchronizes data with an existing table \n Data wich has been added or removed will be deleted or addded to the destination table. The rest will be updated");      synchronizeItem
           .setToolTipText("Synchronizes data with an existing table \n Data wich has been added or removed will be deleted or addded to the destination table. The rest will be updated");
         synchronizeItem.addActionListener(fm);          synchronizeItem.addActionListener(fm);
   
         bgrp.add(synchronizeItem);          bgrp.add(synchronizeItem);
   
         menu.add(synchronizeItem);          menu.add(synchronizeItem);
         useNormanToUnicodeMapper = new JCheckBoxMenuItem("use NormanToUnicodeMapper");          useNormanToUnicodeMapper = new JCheckBoxMenuItem("use NormanToUnicodeMapper");
         useNormanToUnicodeMapper.setToolTipText("maps characters in norman encoding to unicode characters");      useNormanToUnicodeMapper
           .setToolTipText("maps characters in norman encoding to unicode characters");
         useNormanToUnicodeMapper.addActionListener(fm);          useNormanToUnicodeMapper.addActionListener(fm);
         menu.add(useNormanToUnicodeMapper);          menu.add(useNormanToUnicodeMapper);
   
Line 1542  public class FM2SQL extends JFrame imple Line 1554  public class FM2SQL extends JFrame imple
   
         menubar.add(menu);          menubar.add(menu);
   
       menu = new JMenu("About");
       menu.setMnemonic('A');
       aboutBox = new JMenuItem("about FM2SQL");
       aboutBox.addActionListener(fm);
       menu.add(aboutBox);
       menubar.add(menu);
   
         menu.setBackground(fm.getBackground());          menu.setBackground(fm.getBackground());
         menubar.setBackground(fm.getBackground());          menubar.setBackground(fm.getBackground());
         convertItem.doClick();          convertItem.doClick();
   
         setJMenuBar(menubar);          setJMenuBar(menubar);
     }      }
   
     /**      /**
      * open the log file (index.html)       * open the log file (index.html)
      */       */
Line 1571  public class FM2SQL extends JFrame imple Line 1592  public class FM2SQL extends JFrame imple
         logFile.write(TableComponent.convertUml(buff).toString());          logFile.write(TableComponent.convertUml(buff).toString());
         logFile.flush();          logFile.flush();
     }      }
   
     /**      /**
      * Append one entry to the log file(index.html)       * Append one entry to the log file(index.html)
      */       */
Line 1581  public class FM2SQL extends JFrame imple Line 1603  public class FM2SQL extends JFrame imple
         logFile.write("<br>\n<br>\n");          logFile.write("<br>\n<br>\n");
         logFile.flush();          logFile.flush();
     }      }
   
     /**      /**
      * closes the log file invoked then the application closes       * closes the log file invoked then the application closes
      */       */
Line 1591  public class FM2SQL extends JFrame imple Line 1614  public class FM2SQL extends JFrame imple
   
         logFile.close();          logFile.close();
     }      }
   
     public static void showErrorDialog(String message, String title)      public static void showErrorDialog(String message, String title)
     {      {
         JDialog dialog = new JDialog(fmInstance);          JDialog dialog = new JDialog(fmInstance);
Line 1605  public class FM2SQL extends JFrame imple Line 1629  public class FM2SQL extends JFrame imple
         // JOptionPane.showMessageDialog(null, message, title,          // JOptionPane.showMessageDialog(null, message, title,
         // JOptionPane.ERROR_MESSAGE);          // JOptionPane.ERROR_MESSAGE);
     }      }
   
     public static class ProgressDialog extends JDialog      public static class ProgressDialog extends JDialog
     {      {
         JLabel table = new JLabel("    ");          JLabel table = new JLabel("    ");
Line 1620  public class FM2SQL extends JFrame imple Line 1645  public class FM2SQL extends JFrame imple
         JButton cancel = new JButton("Cancel");          JButton cancel = new JButton("Cancel");
         Thread thread;          Thread thread;
         DBBean bean;          DBBean bean;
   
         public ProgressDialog(JFrame frame, DBBean bean)          public ProgressDialog(JFrame frame, DBBean bean)
         {          {
             super(frame);              super(frame);
Line 1644  public class FM2SQL extends JFrame imple Line 1670  public class FM2SQL extends JFrame imple
             statusPanel.add(status);              statusPanel.add(status);
             getContentPane().add(titlePanel, "North");              getContentPane().add(titlePanel, "North");
             getContentPane().add(content, "Center");              getContentPane().add(content, "Center");
             this.addWindowListener(new WindowAdapter()        this.addWindowListener(new WindowAdapter() {
             {  
                 public void windowClosing(WindowEvent e)                  public void windowClosing(WindowEvent e)
                 {                  {
                     cancel.doClick();                      cancel.doClick();
                 }                  }
             });              });
   
             cancel.addActionListener(new ActionListener()        cancel.addActionListener(new ActionListener() {
             {  
                 public void actionPerformed(ActionEvent e)                  public void actionPerformed(ActionEvent e)
                 {                  {
                     fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                      fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
Line 1662  public class FM2SQL extends JFrame imple Line 1686  public class FM2SQL extends JFrame imple
                     try                      try
                     {                      {
                         ProgressDialog.this.bean.getConnection().close();                          ProgressDialog.this.bean.getConnection().close();
                     }            } catch (SQLException e1)
                     catch (SQLException e1)  
                     {                      {
                         // TODO Auto-generated catch block                          // TODO Auto-generated catch block
                         e1.printStackTrace();                          e1.printStackTrace();
                     }            } catch (Exception e1)
                     catch (Exception e1)  
                     {                      {
                         // TODO Auto-generated catch block                          // TODO Auto-generated catch block
                         e1.printStackTrace();                          e1.printStackTrace();
Line 1681  public class FM2SQL extends JFrame imple Line 1703  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     public static class DelimiterDialog extends JDialog      public static class DelimiterDialog extends JDialog
     {      {
         JLabel table = new JLabel("    ");          JLabel table = new JLabel("    ");
Line 1695  public class FM2SQL extends JFrame imple Line 1718  public class FM2SQL extends JFrame imple
         JButton cancel = new JButton("Cancel");          JButton cancel = new JButton("Cancel");
         JButton ok = new JButton("Ok");          JButton ok = new JButton("Ok");
         Thread thread;          Thread thread;
   
         public DelimiterDialog(JFrame frame)          public DelimiterDialog(JFrame frame)
         {          {
             super(frame);              super(frame);
Line 1702  public class FM2SQL extends JFrame imple Line 1726  public class FM2SQL extends JFrame imple
             setModal(true);              setModal(true);
             content = new JPanel(true);              content = new JPanel(true);
             delimiter.setText(fmInstance.delimiter);              delimiter.setText(fmInstance.delimiter);
             ActionListener al = new ActionListener()        ActionListener al = new ActionListener() {
             {  
                 public void actionPerformed(ActionEvent e)                  public void actionPerformed(ActionEvent e)
                 {                  {
                     fmInstance.delimiter = parseDelimiter(delimiter.getText());                      fmInstance.delimiter = parseDelimiter(delimiter.getText());
Line 1711  public class FM2SQL extends JFrame imple Line 1734  public class FM2SQL extends JFrame imple
                 }                  }
   
             };              };
             this.addWindowListener(new WindowAdapter()        this.addWindowListener(new WindowAdapter() {
             {  
                 public void windowClosing(WindowEvent e)                  public void windowClosing(WindowEvent e)
                 {                  {
                     cancel.doClick();                      cancel.doClick();
Line 1740  public class FM2SQL extends JFrame imple Line 1762  public class FM2SQL extends JFrame imple
             getContentPane().add(titlePanel, "North");              getContentPane().add(titlePanel, "North");
             getContentPane().add(content, "Center");              getContentPane().add(content, "Center");
             ok.addActionListener(al);              ok.addActionListener(al);
             cancel.addActionListener(new ActionListener()        cancel.addActionListener(new ActionListener() {
             {  
                 public void actionPerformed(ActionEvent e)                  public void actionPerformed(ActionEvent e)
                 {                  {
                     fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                      fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
Line 1754  public class FM2SQL extends JFrame imple Line 1775  public class FM2SQL extends JFrame imple
             pack();              pack();
             setLocationRelativeTo(fmInstance);              setLocationRelativeTo(fmInstance);
         }          }
   
         public String parseDelimiter(Object o)          public String parseDelimiter(Object o)
         {          {
             String str = o.toString();              String str = o.toString();
Line 1785  public class FM2SQL extends JFrame imple Line 1807  public class FM2SQL extends JFrame imple
                     if (i < length - 1)                      if (i < length - 1)
                         ++i;                          ++i;
   
                 }          } else
                 else  
                     sbuff.append(str.charAt(i));                      sbuff.append(str.charAt(i));
             }              }
   
Line 1811  public class FM2SQL extends JFrame imple Line 1832  public class FM2SQL extends JFrame imple
         JButton ok = new JButton("Ok");          JButton ok = new JButton("Ok");
         DBBean bean = null;          DBBean bean = null;
         Thread thread;          Thread thread;
   
         public PasswordDialog(JFrame frame, DBBean localBean)          public PasswordDialog(JFrame frame, DBBean localBean)
         {          {
             super(frame);              super(frame);
Line 1819  public class FM2SQL extends JFrame imple Line 1841  public class FM2SQL extends JFrame imple
             content = new JPanel(true);              content = new JPanel(true);
             this.bean = localBean;              this.bean = localBean;
             // content.setBorder(BorderFactory.createRaisedBevelBorder());              // content.setBorder(BorderFactory.createRaisedBevelBorder());
             ActionListener al = new ActionListener()        ActionListener al = new ActionListener() {
             {  
                 public void actionPerformed(ActionEvent e)                  public void actionPerformed(ActionEvent e)
                 {                  {
                     bean.setUserAndPasswd(user.getText(), passwd.getText());                      bean.setUserAndPasswd(user.getText(), passwd.getText());
Line 1828  public class FM2SQL extends JFrame imple Line 1849  public class FM2SQL extends JFrame imple
                 }                  }
   
             };              };
             this.addWindowListener(new WindowAdapter()        this.addWindowListener(new WindowAdapter() {
             {  
                 public void windowClosing(WindowEvent e)                  public void windowClosing(WindowEvent e)
                 {                  {
                     cancel.doClick();                      cancel.doClick();
Line 1866  public class FM2SQL extends JFrame imple Line 1886  public class FM2SQL extends JFrame imple
             getContentPane().add(titlePanel, "North");              getContentPane().add(titlePanel, "North");
             getContentPane().add(content, "Center");              getContentPane().add(content, "Center");
             ok.addActionListener(al);              ok.addActionListener(al);
             cancel.addActionListener(new ActionListener()        cancel.addActionListener(new ActionListener() {
             {  
                 public void actionPerformed(ActionEvent e)                  public void actionPerformed(ActionEvent e)
                 {                  {
                     fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));                      fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
Line 1882  public class FM2SQL extends JFrame imple Line 1901  public class FM2SQL extends JFrame imple
         }          }
   
     }      }
   
     public void fillTable()      public void fillTable()
     {      {
         noDBUpdate = true;          noDBUpdate = true;
Line 1908  public class FM2SQL extends JFrame imple Line 1928  public class FM2SQL extends JFrame imple
             {              {
                 bean.makeQuery("select * from" + bean.getQC() + name + bean.getQC(), 1);                  bean.makeQuery("select * from" + bean.getQC() + name + bean.getQC(), 1);
                 layouts = bean.getLayoutNames(name);                  layouts = bean.getLayoutNames(name);
             }        } catch (SQLException e)
             catch (SQLException e)  
             {              {
                 layouts = new Vector();                  layouts = new Vector();
             }        } catch (Exception e)
             catch (Exception e)  
             {              {
                 // TODO Auto-generated catch block                  // TODO Auto-generated catch block
                 e.printStackTrace();                  e.printStackTrace();
Line 1929  public class FM2SQL extends JFrame imple Line 1947  public class FM2SQL extends JFrame imple
             dataRow.set(STATUS_INDEX, Boolean.FALSE);              dataRow.set(STATUS_INDEX, Boolean.FALSE);
             dataRow.set(NAME_INDEX, name);              dataRow.set(NAME_INDEX, name);
   
             dataRow.set(SELECT_INDEX, new TableComponent.SQLCommand("select * from " + bean.getQC() + name + bean.getQC()));        dataRow.set(SELECT_INDEX, new TableComponent.SQLCommand("select * from " + bean.getQC()
             + name + bean.getQC()));
             if (!layouts.isEmpty())              if (!layouts.isEmpty())
                 dataRow.set(LAYOUT_INDEX, new JComboBox(layouts));                  dataRow.set(LAYOUT_INDEX, new JComboBox(layouts));
             else              else
Line 1957  public class FM2SQL extends JFrame imple Line 1976  public class FM2SQL extends JFrame imple
         noDBUpdate = false;          noDBUpdate = false;
   
     }      }
   
     public Vector[] getListFromTable()      public Vector[] getListFromTable()
     {      {
         Vector[] vec = new Vector[5];          Vector[] vec = new Vector[5];
Line 1982  public class FM2SQL extends JFrame imple Line 2002  public class FM2SQL extends JFrame imple
             JComboBox box = ((JComboBox) tC.tableModel.getValueAt(i, LAYOUT_INDEX));              JComboBox box = ((JComboBox) tC.tableModel.getValueAt(i, LAYOUT_INDEX));
             String layoutName = (box != null) ? box.getSelectedItem().toString() : "";              String layoutName = (box != null) ? box.getSelectedItem().toString() : "";
   
             String idName = ((JComboBox) tC.tableModel.getValueAt(i, ID_INDEX)).getSelectedItem().toString();        String idName = ((JComboBox) tC.tableModel.getValueAt(i, ID_INDEX)).getSelectedItem()
             .toString();
             vec[1].add(layoutName);              vec[1].add(layoutName);
             vec[2].add(tC.tableModel.getValueAt(i, SELECT_INDEX).toString());              vec[2].add(tC.tableModel.getValueAt(i, SELECT_INDEX).toString());
             vec[3].add(tC.tableModel.getValueAt(i, CREATE_INDEX).toString());              vec[3].add(tC.tableModel.getValueAt(i, CREATE_INDEX).toString());
Line 1991  public class FM2SQL extends JFrame imple Line 2012  public class FM2SQL extends JFrame imple
         }          }
         return vec;          return vec;
     }      }
   
     public void setEnabled(boolean state)      public void setEnabled(boolean state)
     {      {
         showTables.setEnabled(state);          showTables.setEnabled(state);
Line 2001  public class FM2SQL extends JFrame imple Line 2023  public class FM2SQL extends JFrame imple
         destURLBox.setEnabled(state);          destURLBox.setEnabled(state);
   
     }      }
     public TableComponent.SQLCommand createStatement(String table, DBBean beanDest, String layout, String query) throws SQLException, ParseException, Exception  
     public TableComponent.SQLCommand createStatement(String table, DBBean beanDest, String layout,
         String query) throws SQLException, ParseException, Exception
     {      {
         fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));          fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
   
Line 2033  public class FM2SQL extends JFrame imple Line 2057  public class FM2SQL extends JFrame imple
             type = (type.equals("CONTAINER")) ? "TEXT" : type;              type = (type.equals("CONTAINER")) ? "TEXT" : type;
             type = type.toUpperCase();              type = type.toUpperCase();
             if (i == 0)              if (i == 0)
                 command.append(beanDest.getQC() + Convert.convertText((String) result[1].get(i)) + beanDest.getQC() + " " + type + ", ");          command.append(beanDest.getQC() + Convert.convertText((String) result[1].get(i))
               + beanDest.getQC() + " " + type + ", ");
             else              else
                 command.append("               " + beanDest.getQC() + Convert.convertText((String) result[1].get(i)) + beanDest.getQC() + " " + type + ", ");          command
               .append("               " + beanDest.getQC()
                   + Convert.convertText((String) result[1].get(i)) + beanDest.getQC() + " " + type
                   + ", ");
             command.append("\n");              command.append("\n");
         }          }
         type = bean.metaData.getColumnTypeName(result[1].size());          type = bean.metaData.getColumnTypeName(result[1].size());
         type = (type.equals("NUMBER")) ? "INT4" : type;          type = (type.equals("NUMBER")) ? "INT4" : type;
         type = (type.equals("CONTAINER")) ? "TEXT" : type;          type = (type.equals("CONTAINER")) ? "TEXT" : type;
         type = type.toUpperCase();          type = type.toUpperCase();
         command.append("               " + beanDest.getQC() + Convert.convertText((String) result[1].get(result[1].size() - 1)) + beanDest.getQC() + " " + type);      command.append("               " + beanDest.getQC()
           + Convert.convertText((String) result[1].get(result[1].size() - 1)) + beanDest.getQC()
           + " " + type);
         command.append("\n             )\n");          command.append("\n             )\n");
         fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));          fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
   
         return new TableComponent.SQLCommand(command.toString());          return new TableComponent.SQLCommand(command.toString());
     }      }
   
     static class XMLFilter extends javax.swing.filechooser.FileFilter      static class XMLFilter extends javax.swing.filechooser.FileFilter
     {      {
         public boolean accept(java.io.File file)          public boolean accept(java.io.File file)
Line 2057  public class FM2SQL extends JFrame imple Line 2088  public class FM2SQL extends JFrame imple
             else              else
                 return false;                  return false;
         }          }
   
         public String getDescription()          public String getDescription()
         {          {
             return "Batch Convert XML File";              return "Batch Convert XML File";
         }          }
   
     }      }
   
     public static int showDialog(String message, String title, Object[] options)      public static int showDialog(String message, String title, Object[] options)
     {      {
         int option = JOptionPane.showOptionDialog(null, message, title, JOptionPane.DEFAULT_OPTION, JOptionPane.WARNING_MESSAGE, null, options, options[0]);      int option = JOptionPane.showOptionDialog(null, message, title, JOptionPane.DEFAULT_OPTION,
           JOptionPane.WARNING_MESSAGE, null, options, options[0]);
         return option;          return option;
   
     }      }

Removed from v.1.4  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>