Diff for /FM2SQL/Attic/TableComponent.java between versions 1.3 and 1.4

version 1.3, 2004/02/18 13:25:24 version 1.4, 2004/02/19 10:35:06
Line 151  public class TableComponent extends JPan Line 151  public class TableComponent extends JPan
             {              {
         tableComp.row=row;          tableComp.row=row;
         boolean value=false;          boolean value=false;
                 if(getColumnClass(column)==ArrayList.class||getColumnClass(column)==JComboBox.class||getColumnClass(column)== SQLCommand.class)           if (getColumnClass(column) == ArrayList.class || getColumnClass(column) == JComboBox.class || getColumnClass(column) == SQLCommand.class || getColumnClass(column) == IDComboBox.class)
                 value=true;                  value=true;
                 //System.out.println("tried to edit at row "+row+" column "+column+" "+value);                   //System.out.println("tried to edit at row "+row+" column "+column+" "+value); 
                                                                                                                           
Line 393  public class TableComponent extends JPan Line 393  public class TableComponent extends JPan
             //tableModel.fireTableCellUpdated(row,column);              //tableModel.fireTableCellUpdated(row,column);
              if(box.getModel().getSize()>0)               if(box.getModel().getSize()>0)
              return boxValue;               return boxValue;
          else return null;        else
           return null;
           
          }           }
   
          public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)           public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column)
          {           {
             boxValue = (value != null) ? (JComboBox) value : null;              boxValue = (value != null) ? (JComboBox) value : null;
             this.row=row;this.column=column;        this.row = row;
       if(boxValue!=null) box.setModel(boxValue.getModel());        this.column = column;
       else return null;        if (boxValue != null)
           box.setModel(boxValue.getModel());
         else
           return null;
         return box;          return box;
          }           }
   
Line 478  public class TableComponent extends JPan Line 482  public class TableComponent extends JPan
       CellEditorListener listener=table;        CellEditorListener listener=table;
       JLabel label = new JLabel();        JLabel label = new JLabel();
       int x=0,y=0;        int x=0,y=0;
       String copy="";boolean removeCalled=true;      String copy = "";
       boolean removeCalled = true;
       public SQLCommandEditor()        public SQLCommandEditor()
       {        {
    //     super(new JCheckBox());     //     super(new JCheckBox());
         //this.list = list;          //this.list = list;
         editor.getDocument().addDocumentListener(new DocumentListener() {        editor.getDocument().addDocumentListener(new DocumentListener()
         {
   
         public void insertUpdate(DocumentEvent e)          public void insertUpdate(DocumentEvent e)
         {          {
Line 512  public class TableComponent extends JPan Line 518  public class TableComponent extends JPan
         }          }
               
       });        });
       table.addMouseListener(new MouseAdapter() {        table.addMouseListener(new MouseAdapter()
         {
       public void mouseEntered(MouseEvent e)         public void mouseEntered(MouseEvent e) 
       {        {
         if(true) return;            if (true)
               return;
         //System.out.println(e);          //System.out.println(e);
         x = e.getX();          x = e.getX();
         y = e.getY();          y = e.getY();
Line 525  public class TableComponent extends JPan Line 533  public class TableComponent extends JPan
                   
         if(window!=null)          if(window!=null)
         {          {
         if(!window.isVisible()) return;              if (!window.isVisible())
                 return;
                     
         }else return;            } else
               return;
         if(row!=table.getEditingRow()||col!=table.getEditingColumn())          if(row!=table.getEditingRow()||col!=table.getEditingColumn())
         if (listener != null)          if (listener != null)
         {                  {        
Line 543  public class TableComponent extends JPan Line 553  public class TableComponent extends JPan
             y = e.getY();              y = e.getY();
                           
             if(window!=null)              if(window!=null)
             if(!window.isVisible()) return;              if (!window.isVisible())
                 return;
           
             int row = table.rowAtPoint(new Point(x,y));              int row = table.rowAtPoint(new Point(x,y));
             int col = table.columnAtPoint(new Point(x,y));              int col = table.columnAtPoint(new Point(x,y));
Line 556  public class TableComponent extends JPan Line 567  public class TableComponent extends JPan
             }              }
           }            }
           
       public void mouseExited(MouseEvent e) {          public void mouseExited(MouseEvent e)
           {
       //  System.out.println(e);        //  System.out.println(e);
             
       }        }
Line 600  public class TableComponent extends JPan Line 612  public class TableComponent extends JPan
  //      if(label.isShowing())   //      if(label.isShowing())
  //      System.out.println( label.getLocationOnScreen());   //      System.out.println( label.getLocationOnScreen());
           
   
       Dimension dimEditor = editor.getPreferredSize();        Dimension dimEditor = editor.getPreferredSize();
       if (dimEditor.width < 260)        if (dimEditor.width < 260)
         dimEditor.width = 260;          dimEditor.width = 260;
Line 679  public class TableComponent extends JPan Line 690  public class TableComponent extends JPan
       
     }      }
   
   
   class ArrayListEditor implements TableCellEditor    class ArrayListEditor implements TableCellEditor
   {    {
     JList list = new JList();      JList list = new JList();
Line 693  public class TableComponent extends JPan Line 703  public class TableComponent extends JPan
     {      {
  //     super(new JCheckBox());   //     super(new JCheckBox());
       //this.list = list;        //this.list = list;
       table.addMouseListener(new MouseAdapter() {        table.addMouseListener(new MouseAdapter()
         {
          public void mouseEntered(MouseEvent e)            public void mouseEntered(MouseEvent e) 
          {           {
           // if(true) return;            // if(true) return;
Line 706  public class TableComponent extends JPan Line 717  public class TableComponent extends JPan
                   
            if(window!=null)             if(window!=null)
            {             {
              if(!window.isVisible()) return;              if (!window.isVisible())
                 return;
                           
            } else return;            } else
               return;
                       
            if(row!=table.getEditingRow()||col!=table.getEditingColumn())             if(row!=table.getEditingRow()||col!=table.getEditingColumn())
            if (listener != null)             if (listener != null)
Line 725  public class TableComponent extends JPan Line 738  public class TableComponent extends JPan
                y = e.getY();                 y = e.getY();
                           
                if(window!=null)                 if(window!=null)
                if(!window.isVisible()) return;              if (!window.isVisible())
                 return;
           
                int row = table.rowAtPoint(new Point(x,y));                 int row = table.rowAtPoint(new Point(x,y));
                int col = table.columnAtPoint(new Point(x,y));                 int col = table.columnAtPoint(new Point(x,y));
Line 738  public class TableComponent extends JPan Line 752  public class TableComponent extends JPan
                }                 }
              }               }
           
          public void mouseExited(MouseEvent e) {          public void mouseExited(MouseEvent e)
           {
          //  System.out.println(e);           //  System.out.println(e);
             
          }           }
Line 794  public class TableComponent extends JPan Line 809  public class TableComponent extends JPan
     //      if(label.isShowing())      //      if(label.isShowing())
     //      System.out.println( label.getLocationOnScreen());      //      System.out.println( label.getLocationOnScreen());
           
   
         Dimension dimEditor = pane.getPreferredSize();          Dimension dimEditor = pane.getPreferredSize();
         window.setSize((dimEditor.width<250) ? dimEditor.width+20:250,(dimEditor.height>50) ? 200:50);          window.setSize((dimEditor.width<250) ? dimEditor.width+20:250,(dimEditor.height>50) ? 200:50);
         TableColumnModel model = table.getColumnModel();          TableColumnModel model = table.getColumnModel();
Line 872  public class TableComponent extends JPan Line 886  public class TableComponent extends JPan
     JLabel label = new JLabel();      JLabel label = new JLabel();
     DefaultListModel model=new DefaultListModel();      DefaultListModel model=new DefaultListModel();
      JScrollPane listScroller=new JScrollPane(list);       JScrollPane listScroller=new JScrollPane(list);
       Color noIDColor=new Color(50,50,200);
         
     public VectorCellRenderer()      public VectorCellRenderer()
     {      {
Line 883  public class TableComponent extends JPan Line 898  public class TableComponent extends JPan
     public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)      public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column)
     {      {
             box = (JComboBox) value ;              box = (JComboBox) value ;
             if(box==null) return null;//label.setText("");        if (box == null)
             else          return null; //label.setText("");
             if(box.getSelectedItem()!=null)        else if (box.getSelectedItem() != null)
             {              {
             String text=box.getSelectedItem().toString();              String text=box.getSelectedItem().toString();
             if(text=="")              if(text=="")
             {               { 
             if (box instanceof IDComboBox)
             {
               text = "\"no  ID\"";
               label.setForeground(noIDColor);
             } else
             {
                 text="\"no Layout\"";                  text="\"no Layout\"";
               label.setForeground(Color.red);                label.setForeground(Color.red);
             }
           } else
           {
             if (box instanceof IDComboBox)
               label.setForeground(Color.darkGray);
                               
             }else  label.setForeground(Color.blue);             else
               label.setForeground(Color.blue);
           }
             label.setText(text);              label.setText(text);
   
             }        } else
       else label.setText("");          label.setText("");
         return label;          return label;
     }      }
   
Line 1072  return label; Line 1100  return label;
       return command;        return command;
     }      }
   }    }
     public static class IDComboBox extends JComboBox
     {
       public IDComboBox(Vector vec)
       {
         super(vec);
       }
   
 }  }
   
   }
   

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


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