cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ntimof...@apache.org
Subject cayenne git commit: CAY-2308 UI fix for Modeler on Windows: ObjEntity > Entity tab: Extraneous elements are visible in Inheritance and Table/View fields.
Date Wed, 07 Jun 2017 15:15:10 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 272b6e67b -> bf520cffb


CAY-2308 UI fix for Modeler on Windows:
    ObjEntity > Entity tab: Extraneous elements are visible in
    Inheritance and Table/View fields.


Project: http://git-wip-us.apache.org/repos/asf/cayenne/repo
Commit: http://git-wip-us.apache.org/repos/asf/cayenne/commit/bf520cff
Tree: http://git-wip-us.apache.org/repos/asf/cayenne/tree/bf520cff
Diff: http://git-wip-us.apache.org/repos/asf/cayenne/diff/bf520cff

Branch: refs/heads/master
Commit: bf520cffb0ad5ea507feefd92bbe28a0b7851ea6
Parents: 272b6e6
Author: Nikita Timofeev <stariy95@gmail.com>
Authored: Wed Jun 7 18:15:04 2017 +0300
Committer: Nikita Timofeev <stariy95@gmail.com>
Committed: Wed Jun 7 18:15:04 2017 +0300

----------------------------------------------------------------------
 .../modeler/win/WinCustomTextFieldUI.java       | 44 ++++++++++++++++++++
 .../modeler/win/WinPlatformInitializer.java     |  1 +
 .../modeler/util/combo/EditorTextField.java     |  9 +++-
 3 files changed, 52 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/bf520cff/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCustomTextFieldUI.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCustomTextFieldUI.java
b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCustomTextFieldUI.java
new file mode 100644
index 0000000..3828e69
--- /dev/null
+++ b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinCustomTextFieldUI.java
@@ -0,0 +1,44 @@
+/*****************************************************************
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ ****************************************************************/
+
+package org.apache.cayenne.modeler.win;
+
+import javax.swing.JComponent;
+import javax.swing.plaf.ComponentUI;
+import javax.swing.plaf.basic.BasicTextFieldUI;
+
+import com.jgoodies.looks.windows.WindowsTextFieldUI;
+import org.apache.cayenne.modeler.util.combo.EditorTextField;
+
+/**
+ * @since 4.0
+ */
+public class WinCustomTextFieldUI extends BasicTextFieldUI {
+
+    public WinCustomTextFieldUI() {
+    }
+
+    public static ComponentUI createUI(JComponent c) {
+        if(c instanceof EditorTextField) {
+            c.putClientProperty("TextField.fullSizeBackground", Boolean.TRUE);
+        }
+        return new WindowsTextFieldUI();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bf520cff/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
index 5603733..7b42d8f 100644
--- a/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
+++ b/modeler/cayenne-modeler-win-ext/src/main/java/org/apache/cayenne/modeler/win/WinPlatformInitializer.java
@@ -49,6 +49,7 @@ public class WinPlatformInitializer implements PlatformInitializer {
     private void overrideUIDefaults() {
         Color darkGrey = new Color(225, 225, 225);
 
+        UIManager.put("TextFieldUI",            WinCustomTextFieldUI.class.getName());
         UIManager.put("Tree.expandedIcon",      ModelerUtil.buildIcon("icon-arrow-open.png"));
         UIManager.put("Tree.collapsedIcon",     ModelerUtil.buildIcon("icon-arrow-closed.png"));
         UIManager.put("Tree.paintLines",        Boolean.FALSE);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/bf520cff/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
index a335b30..96e3d50 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/EditorTextField.java
@@ -114,8 +114,13 @@ public class EditorTextField extends JTextField implements FocusListener
{
 
             Color oldColor = g.getColor();
             g.setColor(getBackground());
-            g.fillRect(insets.left, insets.top,
-                    getWidth() - insets.right - insets.left, getHeight() - insets.bottom
- insets.top);
+
+            if(Boolean.TRUE.equals(getClientProperty("TextField.fullSizeBackground"))) {
+                g.fillRect(0, 0, getWidth(), getHeight());
+            } else {
+                g.fillRect(insets.left, insets.top,
+                        getWidth() - insets.right - insets.left, getHeight() - insets.bottom
- insets.top);
+            }
             g.setColor(oldColor);
 
             rendererPane.paintComponent(g, c, combo, insets.left, insets.top,


Mime
View raw message