cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r689332 - in /cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo: AutoCompletion.java EditorTextField.java
Date Wed, 27 Aug 2008 01:57:27 GMT
Author: kmenard
Date: Tue Aug 26 18:57:27 2008
New Revision: 689332

URL: http://svn.apache.org/viewvc?rev=689332&view=rev
Log:
Trying to fix the render problems in MacOS X, related to the changes made in CAY-911: CM Usability:
JComboBox Autocompletion.

Patch by Andrey Razumovsky.

Modified:
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
    cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java?rev=689332&r1=689331&r2=689332&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
Tue Aug 26 18:57:27 2008
@@ -166,11 +166,14 @@
             case KeyEvent.VK_ENTER:
                 if (suggest) {
                     Object value = suggestionList.getSelectedValue();
-                    if(!allowsUserValues && value == null && suggestionList.getItemCount()
> 0) {
+                    if (!allowsUserValues && value == null && suggestionList.getItemCount()
> 0) {
                         value = suggestionList.getItemAt(0);
                     }
                     
-                    comboBox.setSelectedItem(value);
+                    //reset the item (value == null) only if user values are not supported
+                    if (value != null || !allowsUserValues) {
+                        comboBox.setSelectedItem(value);
+                    }
                     suggestionList.hide();
                 }
                 return;
@@ -224,4 +227,4 @@
             textEditor.requestFocus();
         }
     }
-}
+}
\ No newline at end of file

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java?rev=689332&r1=689331&r2=689332&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
(original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
Tue Aug 26 18:57:27 2008
@@ -18,8 +18,10 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.util.combo;
 
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Graphics;
+import java.awt.Insets;
 import java.awt.event.FocusEvent;
 import java.awt.event.FocusListener;
 
@@ -74,7 +76,16 @@
             ListCellRenderer renderer = combo.getRenderer();
             Component c = renderer.getListCellRendererComponent(list, combo
                     .getSelectedItem(), -1, false, false);
-            rendererPane.paintComponent(g, c, combo, 0, 0, getWidth(), getHeight());
+            
+            //fill background first
+            Color oldColor = g.getColor();
+            g.setColor(getBackground());
+            g.fillRect(0, 0, getWidth(), getHeight());
+            g.setColor(oldColor);
+            
+            Insets insets = getInsets();
+            rendererPane.paintComponent(g, c, combo, insets.left, insets.top, 
+                    getWidth() - insets.right - insets.left, getHeight() - insets.bottom
- insets.top);
         }
     }
 



Mime
View raw message