Diff for /FM2SQL/Attic/FM2SQL.java between versions 1.24 and 1.26

version 1.24, 2004/03/03 12:14:47 version 1.26, 2004/03/08 13:57:40
Line 67  import javax.swing.table.TableModel; Line 67  import javax.swing.table.TableModel;
  */   */
 public class FM2SQL extends JFrame implements ActionListener, TableModelListener  public class FM2SQL extends JFrame implements ActionListener, TableModelListener
 {  {
     private JMenuItem delimiterItem;
   private JCheckBoxMenuItem convertItem;    private JCheckBoxMenuItem convertItem;
   private JCheckBoxMenuItem appendItem;    private JCheckBoxMenuItem appendItem;
   private JCheckBoxMenuItem updateItem;    private JCheckBoxMenuItem updateItem;
Line 596  public class FM2SQL extends JFrame imple Line 597  public class FM2SQL extends JFrame imple
       {        {
       }        }
     }      }
       if (command.equals("Delimiter"))
       {
         new DelimiterDialog(fmInstance).setVisible(true); 
         delimiter =  JOptionPane.showInputDialog(fmInstance,"Enter delimiter String",delimiter); 
         
       }
   
     if (command == "Convert Mode")      if (command == "Convert Mode")
     {      {
       System.out.println("Convert Mode selected");        System.out.println("Convert Mode selected");
Line 1274  public class FM2SQL extends JFrame imple Line 1282  public class FM2SQL extends JFrame imple
     menu = new JMenu("Options");      menu = new JMenu("Options");
     menu.setMnemonic('O');      menu.setMnemonic('O');
         
     item = new JMenuItem("show Driver features");  
         item.setToolTipText("shows the features of the selected driver");  
     item.addActionListener(fm);  
     menu.add(item);  
     menubar.add(menu);  
   
     ButtonGroup bgrp = new ButtonGroup();      ButtonGroup bgrp = new ButtonGroup();
     convertItem = new JCheckBoxMenuItem("Convert Mode");      convertItem = new JCheckBoxMenuItem("Convert Mode");
         convertItem.setToolTipText("Normal table conversion  existing table will be deleted");          convertItem.setToolTipText("Normal table conversion  existing table will be deleted");
Line 1315  public class FM2SQL extends JFrame imple Line 1317  public class FM2SQL extends JFrame imple
     menu.add(deleteItem);      menu.add(deleteItem);
   
         menubar.add(menu);          menubar.add(menu);
         item = new JMenuItem("show Driver features");
       item.setToolTipText("shows the features of the selected driver");
     item.addActionListener(fm);      item.addActionListener(fm);
     menu.add(item);      menu.add(item);
       menubar.add(menu);
       delimiterItem = new JMenuItem("Delimiter");
       delimiterItem.setToolTipText("Delimiter for FM Arrayfields");
       delimiterItem.addActionListener(fm);
       menu.add(delimiterItem);
       menubar.add(menu);
   
    //   item.addActionListener(fm);
   //    menu.add(item);
       
     menubar.add(menu);      menubar.add(menu);
       
Line 1442  public class FM2SQL extends JFrame imple Line 1454  public class FM2SQL extends JFrame imple
     }      }
   
   }    }
       public static class DelimiterDialog extends JDialog
       {
           JLabel table = new JLabel("    ");
           JLabel status = new JLabel("    ");
           JLabel title = new JLabel("     ");
           JPanel content = new JPanel();
           JPanel titlePanel = new JPanel();
           JPanel delimiterPanel = new JPanel();
           JPanel buttonPanel = new JPanel();
           JTextField delimiter = new JTextField(10);
       
           JButton cancel = new JButton("Cancel");
           JButton ok = new JButton("Ok");
           Thread thread;
           public DelimiterDialog(JFrame frame)
           {
               super(frame);
               setTitle("Delimiter Editor");
               setModal(true);
               content = new JPanel(true);
               ActionListener al = new ActionListener()
               {
                   public void actionPerformed(ActionEvent e)
                   {
                       fmInstance.delimiter=parseDelimiter(delimiter.getText());
                       setVisible(false);
                   }
   
               };
               this.addWindowListener(new WindowAdapter()
               {
                   public void windowClosing(WindowEvent e)
                   {
                       cancel.doClick();
                   }
               });
   
               //delimiter.setText(fmInstance.delimiter);
               delimiter.addActionListener(al);
               content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
               title = new JLabel("Enter Delimiter ");
               title.setHorizontalTextPosition(title.CENTER);
               titlePanel.add(title);
               buttonPanel.add(ok);
               buttonPanel.add(cancel);
               content.add(titlePanel);
               content.add(Box.createRigidArea(new java.awt.Dimension(0, 15)));
           
               content.add(new JLabel(""));
               content.add(delimiterPanel);
               content.add(buttonPanel);
               content.add(Box.createRigidArea(new java.awt.Dimension(0, 15)));
               
               delimiterPanel.add(new JLabel("Delimiter:  "));
               delimiterPanel.add(delimiter);
           getContentPane().add(titlePanel, "North");
               getContentPane().add(content, "Center");
               ok.addActionListener(al);
               cancel.addActionListener(new ActionListener()
               {
                   public void actionPerformed(ActionEvent e)
                   {
                       fmInstance.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
                       fmInstance.setEnabled(true);
                       setVisible(false);
                   //  thread.stop();
                   }
   
               });
               pack();
         setLocationRelativeTo(fmInstance);
           }
       public String parseDelimiter(Object o)
       {
         String str = o.toString();
         StringBuffer sbuff = new StringBuffer();
         int length = str.length();
         for(int i = 0;i<length;++i)
         {
                   
                   if(str.charAt(i)=='\\')
           {
             System.out.println(str.charAt(i));
             if (str.charAt(i + 1) == 'r')
             {
               sbuff.append("\r");
             }
             if (str.charAt(i + 1) == 't')
             {
               sbuff.append("\t");
             }  
               if (str.charAt(i + 1) == 'n')
               {
                 sbuff.append("\n");
               } 
                 if (str.charAt(i + 1) == '\\')
                 {
                   sbuff.append("\\");
                 }
                       
                       if(i<length-1) ++i;
           
           } else sbuff.append(str.charAt(i));
               }
       
         return sbuff.toString();
       }
       }
   
   
   public static class PasswordDialog extends JDialog    public static class PasswordDialog extends JDialog
   {    {
     JLabel table = new JLabel("    ");      JLabel table = new JLabel("    ");

Removed from v.1.24  
changed lines
  Added in v.1.26


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