db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From florianbruck...@apache.org
Subject cvs commit: db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/gui DBColumnPropertySheet.form DBColumnPropertySheet.java
Date Fri, 21 Feb 2003 12:47:03 GMT
florianbruckner    2003/02/21 04:47:03

  Modified:    src/java/org/apache/ojb/tools/mapping/reversedb/gui
                        DBColumnPropertySheet.form
                        DBColumnPropertySheet.java
  Log:
  corrected event handling of JInputField objects, value of field was
  not written back to the model object.
  
  Revision  Changes    Path
  1.3       +17 -20    db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/gui/DBColumnPropertySheet.form
  
  Index: DBColumnPropertySheet.form
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/gui/DBColumnPropertySheet.form,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DBColumnPropertySheet.form	18 Jun 2002 12:26:41 -0000	1.2
  +++ DBColumnPropertySheet.form	21 Feb 2003 12:47:03 -0000	1.3
  @@ -1,15 +1,14 @@
   <?xml version="1.0" encoding="UTF-8" ?>
   
   <Form version="1.0" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
  -  <SyntheticProperties>
  -    <SyntheticProperty name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
  -  </SyntheticProperties>
  -
     <Events>
       <EventHandler event="componentShown" listener="java.awt.event.ComponentListener"
parameters="java.awt.event.ComponentEvent" handler="formComponentShown"/>
       <EventHandler event="componentHidden" listener="java.awt.event.ComponentListener"
parameters="java.awt.event.ComponentEvent" handler="formComponentHidden"/>
       <EventHandler event="hierarchyChanged" listener="java.awt.event.HierarchyListener"
parameters="java.awt.event.HierarchyEvent" handler="formHierarchyChanged"/>
     </Events>
  +  <AuxValues>
  +    <AuxValue name="designerSize" type="java.awt.Dimension" value="-84,-19,0,5,115,114,0,18,106,97,118,97,46,97,119,116,46,68,105,109,101,110,115,105,111,110,65,-114,-39,-41,-84,95,68,20,2,0,2,73,0,6,104,101,105,103,104,116,73,0,5,119,105,100,116,104,120,112,0,0,1,44,0,0,1,-112"/>
  +  </AuxValues>
   
     <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
     <SubComponents>
  @@ -27,17 +26,16 @@
         <SubComponents>
           <Component class="javax.swing.JLabel" name="lblEnabled">
             <Properties>
  -            <Property name="text" type="java.lang.String" value="enabled:"/>
               <Property name="displayedMnemonic" type="int" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
                 <Connection type="value" value="&apos;e&apos;" valueType="int"/>
               </Property>
  +            <Property name="text" type="java.lang.String" value="enabled:"/>
             </Properties>
           </Component>
           <Component class="javax.swing.JCheckBox" name="cbEnabled">
             <Properties>
               <Property name="mnemonic" type="int" value="101"/>
             </Properties>
  -
             <Events>
               <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="cbEnabledActionPerformed"/>
             </Events>
  @@ -59,60 +57,61 @@
           </Component>
           <Component class="javax.swing.JLabel" name="lblColumnName">
             <Properties>
  -            <Property name="text" type="java.lang.String" value="Column Name:"/>
               <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
                 <Connection component="tfColumnName" type="bean"/>
               </Property>
  +            <Property name="text" type="java.lang.String" value="Column Name:"/>
             </Properties>
           </Component>
           <Component class="javax.swing.JTextField" name="tfColumnName">
             <Properties>
               <Property name="editable" type="boolean" value="false"/>
               <Property name="text" type="java.lang.String" value="jTextField1"/>
  -            <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  -              <Border info="null"/>
  -            </Property>
               <Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
                 <Color blue="0" green="0" id="windowText" palette="3" red="0" type="palette"/>
               </Property>
  +            <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  +              <Border info="null"/>
  +            </Property>
               <Property name="enabled" type="boolean" value="false"/>
             </Properties>
           </Component>
           <Component class="javax.swing.JLabel" name="lblJavaFieldName">
             <Properties>
  -            <Property name="text" type="java.lang.String" value="Java Field Name:"/>
               <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
                 <Connection component="tfColumnName" type="bean"/>
               </Property>
  +            <Property name="text" type="java.lang.String" value="Java Field Name:"/>
             </Properties>
           </Component>
           <Component class="javax.swing.JTextField" name="tfJavaFieldName">
             <Properties>
               <Property name="text" type="java.lang.String" value="jTextField1"/>
             </Properties>
  -
             <Events>
  -            <EventHandler event="inputMethodTextChanged" listener="java.awt.event.InputMethodListener"
parameters="java.awt.event.InputMethodEvent" handler="tfJavaFieldNameInputMethodTextChanged"/>
  +            <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="tfJavaFieldNameActionPerformed"/>
  +            <EventHandler event="focusLost" listener="java.awt.event.FocusListener"
parameters="java.awt.event.FocusEvent" handler="tfJavaFieldNameFocusLost"/>
  +            <EventHandler event="keyTyped" listener="java.awt.event.KeyListener" parameters="java.awt.event.KeyEvent"
handler="tfJavaFieldNameKeyTyped"/>
             </Events>
           </Component>
           <Component class="javax.swing.JLabel" name="lblSQLTypeName">
             <Properties>
  -            <Property name="text" type="java.lang.String" value="SQL Type Name:"/>
               <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
                 <Connection component="tfColumnName" type="bean"/>
               </Property>
  +            <Property name="text" type="java.lang.String" value="SQL Type Name:"/>
             </Properties>
           </Component>
           <Component class="javax.swing.JTextField" name="tfSQLTypeName">
             <Properties>
               <Property name="editable" type="boolean" value="false"/>
               <Property name="text" type="java.lang.String" value="jTextField1"/>
  -            <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  -              <Border info="null"/>
  -            </Property>
               <Property name="disabledTextColor" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
                 <Color blue="0" green="0" id="windowText" palette="3" red="0" type="palette"/>
               </Property>
  +            <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
  +              <Border info="null"/>
  +            </Property>
               <Property name="enabled" type="boolean" value="false"/>
             </Properties>
           </Component>
  @@ -127,7 +126,6 @@
                 <Connection code="new javax.swing.DefaultComboBoxModel(Utilities.vJDBCTypeNames)"
type="code"/>
               </Property>
             </Properties>
  -
             <Events>
               <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="cmbSQLTypeActionPerformed"/>
             </Events>
  @@ -139,12 +137,11 @@
           </Component>
           <Component class="javax.swing.JComboBox" name="cmbJavaType">
             <Properties>
  -            <Property name="editable" type="boolean" value="true"/>
               <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
                 <Connection code=" new org.apache.ojb.tools.swing.SortingComboBoxModel(Utilities.vJavaTypes)
&#xa;/*new javax.swing.DefaultComboBoxModel(at.citec.ojb.schemegenerator.Utilities.vJavaTypes)*/"
type="code"/>
               </Property>
  +            <Property name="editable" type="boolean" value="true"/>
             </Properties>
  -
             <Events>
               <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener"
parameters="java.awt.event.ActionEvent" handler="cmbJavaTypeActionPerformed"/>
             </Events>
  
  
  
  1.4       +61 -31    db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/gui/DBColumnPropertySheet.java
  
  Index: DBColumnPropertySheet.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/tools/mapping/reversedb/gui/DBColumnPropertySheet.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DBColumnPropertySheet.java	18 Jun 2002 12:26:41 -0000	1.3
  +++ DBColumnPropertySheet.java	21 Feb 2003 12:47:03 -0000	1.4
  @@ -126,7 +126,6 @@
     public DBColumnPropertySheet ()
     {
       initComponents ();
  -    
     }
     
     private void readValuesFromColumn()
  @@ -191,8 +190,8 @@
   
           jPanel1.setLayout(new java.awt.GridLayout(8, 2));
   
  -        lblEnabled.setText("enabled:");
           lblEnabled.setDisplayedMnemonic('e');
  +        lblEnabled.setText("enabled:");
           jPanel1.add(lblEnabled);
   
           cbEnabled.setMnemonic('e');
  @@ -217,43 +216,56 @@
   
           jPanel1.add(jLabel3);
   
  -        lblColumnName.setText("Column Name:");
           lblColumnName.setLabelFor(tfColumnName);
  +        lblColumnName.setText("Column Name:");
           jPanel1.add(lblColumnName);
   
           tfColumnName.setEditable(false);
           tfColumnName.setText("jTextField1");
  -        tfColumnName.setBorder(null);
           tfColumnName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
  +        tfColumnName.setBorder(null);
           tfColumnName.setEnabled(false);
           jPanel1.add(tfColumnName);
   
  -        lblJavaFieldName.setText("Java Field Name:");
           lblJavaFieldName.setLabelFor(tfColumnName);
  +        lblJavaFieldName.setText("Java Field Name:");
           jPanel1.add(lblJavaFieldName);
   
           tfJavaFieldName.setText("jTextField1");
  -        tfJavaFieldName.addInputMethodListener(new java.awt.event.InputMethodListener()
  +        tfJavaFieldName.addActionListener(new java.awt.event.ActionListener()
  +        {
  +            public void actionPerformed(java.awt.event.ActionEvent evt)
  +            {
  +                tfJavaFieldNameActionPerformed(evt);
  +            }
  +        });
  +
  +        tfJavaFieldName.addFocusListener(new java.awt.event.FocusAdapter()
           {
  -            public void inputMethodTextChanged(java.awt.event.InputMethodEvent evt)
  +            public void focusLost(java.awt.event.FocusEvent evt)
               {
  -                tfJavaFieldNameInputMethodTextChanged(evt);
  +                tfJavaFieldNameFocusLost(evt);
               }
  -            public void caretPositionChanged(java.awt.event.InputMethodEvent evt)
  +        });
  +
  +        tfJavaFieldName.addKeyListener(new java.awt.event.KeyAdapter()
  +        {
  +            public void keyTyped(java.awt.event.KeyEvent evt)
               {
  +                tfJavaFieldNameKeyTyped(evt);
               }
           });
   
           jPanel1.add(tfJavaFieldName);
   
  -        lblSQLTypeName.setText("SQL Type Name:");
           lblSQLTypeName.setLabelFor(tfColumnName);
  +        lblSQLTypeName.setText("SQL Type Name:");
           jPanel1.add(lblSQLTypeName);
   
           tfSQLTypeName.setEditable(false);
           tfSQLTypeName.setText("jTextField1");
  -        tfSQLTypeName.setBorder(null);
           tfSQLTypeName.setDisabledTextColor((java.awt.Color) javax.swing.UIManager.getDefaults().get("windowText"));
  +        tfSQLTypeName.setBorder(null);
           tfSQLTypeName.setEnabled(false);
           jPanel1.add(tfSQLTypeName);
   
  @@ -274,9 +286,9 @@
           lblJavaType.setText("Java Type:");
           jPanel1.add(lblJavaType);
   
  -        cmbJavaType.setEditable(true);
           cmbJavaType.setModel( new org.apache.ojb.tools.swing.SortingComboBoxModel(Utilities.vJavaTypes)
               /*new javax.swing.DefaultComboBoxModel(at.citec.ojb.schemegenerator.Utilities.vJavaTypes)*/);
  +        cmbJavaType.setEditable(true);
           cmbJavaType.addActionListener(new java.awt.event.ActionListener()
           {
               public void actionPerformed(java.awt.event.ActionEvent evt)
  @@ -296,6 +308,27 @@
   
       }//GEN-END:initComponents
   
  +    private void tfJavaFieldNameKeyTyped(java.awt.event.KeyEvent evt)//GEN-FIRST:event_tfJavaFieldNameKeyTyped
  +    {//GEN-HEADEREND:event_tfJavaFieldNameKeyTyped
  +        // Revert to original value if ESC is pressed.
  +        if (evt.getKeyChar() == evt.VK_ESCAPE)
  +        {
  +            this.tfJavaFieldName.setText(aColumn.getJavaFieldName());
  +        }
  +    }//GEN-LAST:event_tfJavaFieldNameKeyTyped
  +
  +    private void tfJavaFieldNameFocusLost(java.awt.event.FocusEvent evt)//GEN-FIRST:event_tfJavaFieldNameFocusLost
  +    {//GEN-HEADEREND:event_tfJavaFieldNameFocusLost
  +        // Commit the new value to the column if the focus is lost
  +        aColumn.setJavaFieldName(tfJavaFieldName.getText());        
  +    }//GEN-LAST:event_tfJavaFieldNameFocusLost
  +
  +    private void tfJavaFieldNameActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_tfJavaFieldNameActionPerformed
  +    {//GEN-HEADEREND:event_tfJavaFieldNameActionPerformed
  +        // Commit value to column object if ENTER is pressed
  +        aColumn.setJavaFieldName(tfJavaFieldName.getText());
  +    }//GEN-LAST:event_tfJavaFieldNameActionPerformed
  +
     private void cmbJavaTypeActionPerformed (java.awt.event.ActionEvent evt)//GEN-FIRST:event_cmbJavaTypeActionPerformed
     {//GEN-HEADEREND:event_cmbJavaTypeActionPerformed
       // Add your handling code here:
  @@ -316,12 +349,6 @@
       }
     }//GEN-LAST:event_cmbJavaTypeActionPerformed
   
  -  private void tfJavaFieldNameInputMethodTextChanged (java.awt.event.InputMethodEvent evt)//GEN-FIRST:event_tfJavaFieldNameInputMethodTextChanged
  -  {//GEN-HEADEREND:event_tfJavaFieldNameInputMethodTextChanged
  -    // Add your handling code here:
  -    aColumn.setJavaFieldName(tfJavaFieldName.getText());
  -  }//GEN-LAST:event_tfJavaFieldNameInputMethodTextChanged
  -
     private void cbEnabledActionPerformed (java.awt.event.ActionEvent evt)//GEN-FIRST:event_cbEnabledActionPerformed
     {//GEN-HEADEREND:event_cbEnabledActionPerformed
       // Add your handling code here:
  @@ -364,23 +391,23 @@
     
     
       // Variables declaration - do not modify//GEN-BEGIN:variables
  -    private javax.swing.JLabel lblSQLTypeName;
  -    private javax.swing.JCheckBox cbDisabledByParent;
  -    private javax.swing.JPanel jPanel1;
  -    private javax.swing.JLabel lblEnabled;
  -    private javax.swing.JCheckBox cbEnabled;
  -    private javax.swing.JLabel lblColumnName;
  -    private javax.swing.JComboBox cmbJavaType;
       private javax.swing.JTextField tfColumnName;
  -    private javax.swing.JLabel lblDisabledByParent;
  -    private javax.swing.JLabel lblJavaType;
  -    private javax.swing.JLabel lblSQLType;
  -    private javax.swing.JTextField tfJavaFieldName;
       private javax.swing.JComboBox cmbSQLType;
  +    private javax.swing.JTextField tfSQLTypeName;
       private javax.swing.JLabel lblJavaFieldName;
  +    private javax.swing.JComboBox cmbJavaType;
  +    private javax.swing.JLabel lblDisabledByParent;
  +    private javax.swing.JLabel lblEnabled;
  +    private javax.swing.JLabel lblSQLTypeName;
  +    private javax.swing.JLabel lblSQLType;
  +    private javax.swing.JCheckBox cbEnabled;
       private javax.swing.JLabel jLabel4;
       private javax.swing.JLabel jLabel3;
  -    private javax.swing.JTextField tfSQLTypeName;
  +    private javax.swing.JPanel jPanel1;
  +    private javax.swing.JLabel lblJavaType;
  +    private javax.swing.JCheckBox cbDisabledByParent;
  +    private javax.swing.JLabel lblColumnName;
  +    private javax.swing.JTextField tfJavaFieldName;
       // End of variables declaration//GEN-END:variables
     
   }
  @@ -388,6 +415,10 @@
   
   /***************************** Changelog *****************************
   // $Log$
  +// Revision 1.4  2003/02/21 12:47:03  florianbruckner
  +// corrected event handling of JInputField objects, value of field was
  +// not written back to the model object.
  +//
   // Revision 1.3  2002/06/18 12:26:41  florianbruckner
   // changes in Netbeans Form definitions after move to jakarta.
   //
  
  
  

Mime
View raw message