cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject [1/4] cayenne git commit: fix problems: path select autocompletion, autocompletion scroll, make indent in table cells, header renderer. refactor some code
Date Wed, 16 Dec 2015 12:57:04 GMT
Repository: cayenne
Updated Branches:
  refs/heads/master 9baef19b7 -> 1448a194c


fix problems: path select autocompletion,autocompletion scroll, make indent in table cells, header renderer. refactor some code


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

Branch: refs/heads/master
Commit: 7e8e07c71d5e1fb15d150a08042048f9ee753ab3
Parents: 9baef19
Author: AlexandrShestak <shestakalexandr@mail.ru>
Authored: Wed Dec 9 13:30:35 2015 +0300
Committer: AlexandrShestak <shestakalexandr@mail.ru>
Committed: Wed Dec 9 13:30:35 2015 +0300

----------------------------------------------------------------------
 .../modeler/editor/ObjAttributeTableModel.java  |   3 +-
 .../modeler/editor/ObjEntityAttributePanel.java |  35 ++-----
 .../editor/ObjEntityRelationshipPanel.java      |  45 ++++----
 .../editor/dbentity/DbEntityAttributePanel.java |   2 +
 .../dbentity/DbEntityRelationshipPanel.java     |   2 +
 .../modeler/util/BoardTableCellRenderer.java    |  34 ++++++
 .../util/CollectionTypeComboBoxEditor.java      |  90 ++++++++++++++++
 .../util/CollectionTypeComboBoxRenderer.java    |  53 ++++++++++
 .../util/DbAttributePathComboBoxRenderer.java   |  48 +++++++++
 .../util/DbRelationshipPathComboBoxEditor.java  |   1 +
 .../modeler/util/DefaultWidgetFactory.java      |  22 ++--
 .../JTableCollectionTypeComboBoxEditor.java     |  84 ---------------
 .../JTableCollectionTypeComboBoxRenderer.java   |  55 ----------
 .../util/JTableMapKeyComboBoxEditor.java        |  99 ------------------
 .../util/JTableMapKeyComboBoxRenderer.java      |  58 -----------
 .../modeler/util/MapKeyComboBoxEditor.java      | 104 +++++++++++++++++++
 .../modeler/util/MapKeyComboBoxRenderer.java    |  57 ++++++++++
 .../util/PathChooserComboBoxCellEditor.java     |   6 +-
 .../modeler/util/SortButtonRenderer.java        |  95 ++++++-----------
 .../modeler/util/combo/AutoCompletion.java      |   4 +-
 20 files changed, 476 insertions(+), 421 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjAttributeTableModel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjAttributeTableModel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjAttributeTableModel.java
index 8ea39c1..16db808 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjAttributeTableModel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjAttributeTableModel.java
@@ -64,6 +64,7 @@ public class ObjAttributeTableModel extends CayenneTableModel<ObjAttributeWrappe
     public static final int DB_ATTRIBUTE = 3;
     public static final int DB_ATTRIBUTE_TYPE = 4;
     public static final int LOCKING = 5;
+    public static final int COLUMN_COUNT = 6;
 
     private ObjEntity entity;
     private DbEntity dbEntity;
@@ -145,7 +146,7 @@ public class ObjAttributeTableModel extends CayenneTableModel<ObjAttributeWrappe
     }
 
     public int getColumnCount() {
-        return 6;
+        return COLUMN_COUNT;
     }
 
     public String getColumnName(int column) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributePanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributePanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributePanel.java
index 46c4215..6dc7290 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributePanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributePanel.java
@@ -20,7 +20,6 @@ package org.apache.cayenne.modeler.editor;
 
 import org.apache.cayenne.configuration.DataChannelDescriptor;
 import org.apache.cayenne.map.DataMap;
-import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.Embeddable;
 import org.apache.cayenne.map.ObjAttribute;
 import org.apache.cayenne.map.ObjEntity;
@@ -45,16 +44,17 @@ import org.apache.cayenne.modeler.event.TablePopupHandler;
 import org.apache.cayenne.modeler.pref.TableColumnPreferences;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneTableModel;
+import org.apache.cayenne.modeler.util.DbAttributePathComboBoxRenderer;
 import org.apache.cayenne.modeler.util.DbAttributePathComboBoxEditor;
 import org.apache.cayenne.modeler.util.ModelerUtil;
 import org.apache.cayenne.modeler.util.PanelFactory;
 import org.apache.cayenne.modeler.util.UIUtil;
 import org.apache.cayenne.modeler.util.combo.AutoCompletion;
 
+import javax.swing.BorderFactory;
 import javax.swing.Icon;
 import javax.swing.ImageIcon;
 import javax.swing.JComboBox;
-import javax.swing.JLabel;
 import javax.swing.JMenuItem;
 import javax.swing.JPanel;
 import javax.swing.JPopupMenu;
@@ -84,6 +84,8 @@ import java.util.Map;
 public class ObjEntityAttributePanel extends JPanel implements ObjEntityDisplayListener,
         ObjEntityListener, ObjAttributeListener, ProjectOnSaveListener {
 
+    private static final int INHERITANCE_COLUMN_WIDTH = 35;
+
     private ProjectController mediator;
     private CayenneTable table;
     private TableColumnPreferences tablePreferences;
@@ -334,17 +336,15 @@ public class ObjEntityAttributePanel extends JPanel implements ObjEntityDisplayL
     }
 
     protected void setUpTableStructure() {
-        int inheritanceColumnWidth = 30;
-
         Map<Integer, Integer> minSizes = new HashMap<Integer, Integer>();
         Map<Integer, Integer> maxSizes = new HashMap<Integer, Integer>();
 
-        minSizes.put(ObjAttributeTableModel.INHERITED, inheritanceColumnWidth);
-        maxSizes.put(ObjAttributeTableModel.INHERITED, inheritanceColumnWidth);
+        minSizes.put(ObjAttributeTableModel.INHERITED, INHERITANCE_COLUMN_WIDTH);
+        maxSizes.put(ObjAttributeTableModel.INHERITED, INHERITANCE_COLUMN_WIDTH);
 
         initComboBoxes();
 
-        table.getColumnModel().getColumn(3).setCellRenderer(new JTableDbAttributeComboBoxRenderer());
+        table.getColumnModel().getColumn(3).setCellRenderer(new DbAttributePathComboBoxRenderer());
         table.getColumnModel().getColumn(3).setCellEditor(new DbAttributePathComboBoxEditor());
 
         tablePreferences.bind(
@@ -432,6 +432,7 @@ public class ObjEntityAttributePanel extends JPanel implements ObjEntityDisplayL
                 }
                 setText("");
             }
+            setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
 
             return this;
         }
@@ -505,24 +506,4 @@ public class ObjEntityAttributePanel extends JPanel implements ObjEntityDisplayL
     }
 
 
-    private static final class JTableDbAttributeComboBoxRenderer extends DefaultTableCellRenderer {
-
-        public JTableDbAttributeComboBoxRenderer() {
-        }
-
-        @Override
-        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
-                                                       boolean hasFocus, int row, int column) {
-            JLabel jLabel = new JLabel("");
-            jLabel.setFont(new Font("Verdana", Font.PLAIN , 12));
-
-            if (value instanceof DbAttribute) {
-                jLabel.setText(ModelerUtil.getObjectName(value));
-            } else if (value != null) {
-                jLabel.setText(value.toString());
-            }
-
-            return jLabel;
-        }
-    }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipPanel.java
index f417989..fd08bde 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipPanel.java
@@ -41,34 +41,24 @@ import org.apache.cayenne.modeler.pref.TableColumnPreferences;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CellRenderers;
 import org.apache.cayenne.modeler.util.DbRelationshipPathComboBoxEditor;
-import org.apache.cayenne.modeler.util.JTableCollectionTypeComboBoxEditor;
-import org.apache.cayenne.modeler.util.JTableCollectionTypeComboBoxRenderer;
-import org.apache.cayenne.modeler.util.JTableMapKeyComboBoxEditor;
-import org.apache.cayenne.modeler.util.JTableMapKeyComboBoxRenderer;
+import org.apache.cayenne.modeler.util.CollectionTypeComboBoxEditor;
+import org.apache.cayenne.modeler.util.CollectionTypeComboBoxRenderer;
+import org.apache.cayenne.modeler.util.MapKeyComboBoxEditor;
+import org.apache.cayenne.modeler.util.MapKeyComboBoxRenderer;
 import org.apache.cayenne.modeler.util.ModelerUtil;
 import org.apache.cayenne.modeler.util.PanelFactory;
 import org.apache.cayenne.modeler.util.UIUtil;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.swing.DefaultCellEditor;
-import javax.swing.Icon;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JMenuItem;
-import javax.swing.JPanel;
-import javax.swing.JPopupMenu;
-import javax.swing.JTable;
-import javax.swing.ListSelectionModel;
+import javax.swing.*;
 import javax.swing.event.ListSelectionEvent;
 import javax.swing.event.ListSelectionListener;
 import javax.swing.event.TableModelEvent;
 import javax.swing.event.TableModelListener;
 import javax.swing.table.DefaultTableCellRenderer;
 import javax.swing.table.TableColumn;
-import java.awt.BorderLayout;
-import java.awt.Color;
-import java.awt.Component;
+import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Collection;
@@ -326,25 +316,37 @@ public class ObjEntityRelationshipPanel extends JPanel implements ObjEntityDispl
 
         TableColumn col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_TARGET_PATH);
         col.setCellEditor(new DbRelationshipPathComboBoxEditor());
+        col.setCellRenderer(new DefaultTableCellRenderer(){
+            @Override
+            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+                super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
+                setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+                setToolTipText("To choose relationship press enter two times. \n To choose next relationship press dot.");
+                return this;
+            }
+        });
 
         col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_DELETE_RULE);
         JComboBox deleteRulesCombo = Application.getWidgetFactory().createComboBox(
                 DELETE_RULES,
                 false);
-        deleteRulesCombo.setEditable(false);
+        deleteRulesCombo.setFocusable(false);
+        deleteRulesCombo.setEditable(true);
+        ((JComponent) deleteRulesCombo.getEditor().getEditorComponent()).setBorder(null);
+        deleteRulesCombo.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
         deleteRulesCombo.setSelectedIndex(0); // Default to the first value
         col.setCellEditor(Application.getWidgetFactory().createCellEditor(
                 deleteRulesCombo));
 
         col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_COLLECTION_TYPE);
 
-        col.setCellEditor(new JTableCollectionTypeComboBoxEditor());
-        col.setCellRenderer(new JTableCollectionTypeComboBoxRenderer());
+        col.setCellEditor(new CollectionTypeComboBoxEditor());
+        col.setCellRenderer(new CollectionTypeComboBoxRenderer());
 
         col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_MAP_KEY);
 
-        col.setCellEditor(new JTableMapKeyComboBoxEditor());
-        col.setCellRenderer(new JTableMapKeyComboBoxRenderer());
+        col.setCellEditor(new MapKeyComboBoxEditor());
+        col.setCellRenderer(new MapKeyComboBoxRenderer());
 
         tablePreferences.bind(
                 table,
@@ -419,6 +421,7 @@ public class ObjEntityRelationshipPanel extends JPanel implements ObjEntityDispl
                         ? table.getSelectionForeground()
                         : table.getForeground());
             }
+            setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
 
             return this;
         }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributePanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributePanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributePanel.java
index 7bb4f44..e84b6bf 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributePanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributePanel.java
@@ -34,6 +34,7 @@ import org.apache.cayenne.modeler.event.DbEntityDisplayListener;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
 import org.apache.cayenne.modeler.pref.TableColumnPreferences;
+import org.apache.cayenne.modeler.util.BoardTableCellRenderer;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.PanelFactory;
 import org.apache.cayenne.modeler.util.UIUtil;
@@ -81,6 +82,7 @@ public class DbEntityAttributePanel extends JPanel implements DbEntityDisplayLis
         tablePreferences = new TableColumnPreferences(
                 DbAttributeTableModel.class,
                 "attributeTable");
+        table.setDefaultRenderer(String.class, new BoardTableCellRenderer());
 
         /**
          * Create and install a popup

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipPanel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipPanel.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipPanel.java
index 046ddad..bae752d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipPanel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipPanel.java
@@ -38,6 +38,7 @@ import org.apache.cayenne.modeler.event.DbEntityDisplayListener;
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
 import org.apache.cayenne.modeler.pref.TableColumnPreferences;
+import org.apache.cayenne.modeler.util.BoardTableCellRenderer;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CellRenderers;
 import org.apache.cayenne.modeler.util.ModelerUtil;
@@ -103,6 +104,7 @@ public class DbEntityRelationshipPanel extends JPanel implements DbEntityDisplay
         table = new CayenneTable();
         table.setDefaultRenderer(DbEntity.class, CellRenderers
                 .entityTableRendererWithIcons(mediator));
+        table.setDefaultRenderer(String.class, new BoardTableCellRenderer());
         tablePreferences = new TableColumnPreferences(
                 DbRelationshipTableModel.class,
                 "relationshipTable");

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BoardTableCellRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BoardTableCellRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BoardTableCellRenderer.java
new file mode 100644
index 0000000..231f089
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/BoardTableCellRenderer.java
@@ -0,0 +1,34 @@
+/*****************************************************************
+ *   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.util;
+
+import javax.swing.BorderFactory;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+
+public class BoardTableCellRenderer extends DefaultTableCellRenderer {
+
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int col) {
+        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, col);
+        setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 0));
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxEditor.java
new file mode 100644
index 0000000..1ea13ed
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxEditor.java
@@ -0,0 +1,90 @@
+/*****************************************************************
+ *   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.util;
+
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class CollectionTypeComboBoxEditor extends AbstractCellEditor implements TableCellEditor {
+
+    private static final String COLLECTION_TYPE_MAP = "java.util.Map";
+    private static final String COLLECTION_TYPE_SET = "java.util.Set";
+    private static final String COLLECTION_TYPE_COLLECTION = "java.util.Collection";
+    private static final String DEFAULT_COLLECTION_TYPE = "java.util.List";
+    private static final int REL_COLLECTION_TYPE_COLUMN = 3;
+
+    private ObjRelationshipTableModel model;
+    private int row;
+
+    @Override
+    public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, final int column) {
+
+        this.model = (ObjRelationshipTableModel) table.getModel();
+        this.row = row;
+
+        final JComboBox collectionTypeCombo = Application.getWidgetFactory().createComboBox(
+                new Object[]{
+                        COLLECTION_TYPE_MAP,
+                        COLLECTION_TYPE_SET,
+                        COLLECTION_TYPE_COLLECTION,
+                        DEFAULT_COLLECTION_TYPE
+                },
+                false);
+        if (model.getRelationship(row).isToMany()) {
+            collectionTypeCombo.setEnabled(true);
+            collectionTypeCombo.setSelectedItem(model.getRelationship(row).getCollectionType());
+        } else {
+            JLabel labelIfToOneRelationship = new JLabel();
+            labelIfToOneRelationship.setEnabled(false);
+            return labelIfToOneRelationship;
+        }
+        collectionTypeCombo.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Object selected = collectionTypeCombo.getSelectedItem();
+                model.setUpdatedValueAt(selected, row, REL_COLLECTION_TYPE_COLUMN);
+                table.repaint();
+            }
+        });
+
+        collectionTypeCombo.setFocusable(false);
+        collectionTypeCombo.setEditable(true);
+        ((JComponent) collectionTypeCombo.getEditor().getEditorComponent()).setBorder(null);
+        collectionTypeCombo.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+
+        return collectionTypeCombo;
+    }
+
+    @Override
+    public Object getCellEditorValue() {
+        return model.getValueAt(row, REL_COLLECTION_TYPE_COLUMN);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxRenderer.java
new file mode 100644
index 0000000..d1a69b0
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxRenderer.java
@@ -0,0 +1,53 @@
+/*****************************************************************
+ *   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.util;
+
+import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
+
+import javax.swing.BorderFactory;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+import java.awt.Font;
+
+public class CollectionTypeComboBoxRenderer extends DefaultTableCellRenderer {
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+        super.getTableCellRendererComponent(table, value, isSelected,  hasFocus,  row, column);
+
+        setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+        if (value == null) {
+            setEnabled(false);
+            return this;
+        }
+        if (((ObjRelationshipTableModel) table.getModel()).getRelationship(row).isToMany()) {
+            setFocusable(false);
+            setEnabled(true);
+            setText((String) value);
+            setFont(new Font("Verdana", Font.PLAIN, 12));
+            return this;
+        } else {
+            setEnabled(false);
+            return this;
+        }
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxRenderer.java
new file mode 100644
index 0000000..282adff
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxRenderer.java
@@ -0,0 +1,48 @@
+/*****************************************************************
+ *   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.util;
+
+import org.apache.cayenne.map.DbAttribute;
+
+import javax.swing.BorderFactory;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+import java.awt.Font;
+
+public class DbAttributePathComboBoxRenderer extends DefaultTableCellRenderer {
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
+                                                   boolean hasFocus, int row, int column) {
+        super.getTableCellRendererComponent(table, value, isSelected,  hasFocus,  row, column);
+
+        setText("");
+        setFont(new Font("Verdana", Font.PLAIN , 12));
+
+        if (value instanceof DbAttribute) {
+           setText(ModelerUtil.getObjectName(value));
+        } else if (value != null) {
+            setText(value.toString());
+        }
+        setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbRelationshipPathComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbRelationshipPathComboBoxEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbRelationshipPathComboBoxEditor.java
index 9aac322..829f874 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbRelationshipPathComboBoxEditor.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbRelationshipPathComboBoxEditor.java
@@ -70,6 +70,7 @@ public class DbRelationshipPathComboBoxEditor extends PathChooserComboBoxCellEdi
 
         enterPressedCount = 0;
         comboBoxPathChooser.addActionListener(this);
+        comboBoxPathChooser.setToolTipText("To choose relationship press enter two times. \n To choose next relationship press dot.");
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DefaultWidgetFactory.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DefaultWidgetFactory.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DefaultWidgetFactory.java
index c0596c7..da6463f 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DefaultWidgetFactory.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DefaultWidgetFactory.java
@@ -18,22 +18,22 @@
  ****************************************************************/
 package org.apache.cayenne.modeler.util;
 
-import java.awt.Color;
-import java.awt.Font;
-import java.util.Arrays;
-import java.util.Collection;
+import org.apache.cayenne.modeler.ModelerPreferences;
+import org.apache.cayenne.modeler.undo.JComboBoxUndoListener;
+import org.apache.cayenne.modeler.util.combo.AutoCompletion;
+import org.apache.cayenne.modeler.util.combo.ComboBoxCellEditor;
+import org.syntax.jedit.JEditTextArea;
 
+import javax.swing.BorderFactory;
 import javax.swing.DefaultCellEditor;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JComboBox;
 import javax.swing.JTextField;
 import javax.swing.table.TableCellEditor;
-
-import org.apache.cayenne.modeler.ModelerPreferences;
-import org.apache.cayenne.modeler.undo.JComboBoxUndoListener;
-import org.apache.cayenne.modeler.util.combo.AutoCompletion;
-import org.apache.cayenne.modeler.util.combo.ComboBoxCellEditor;
-import org.syntax.jedit.JEditTextArea;
+import java.awt.Color;
+import java.awt.Font;
+import java.util.Arrays;
+import java.util.Collection;
 
 public class DefaultWidgetFactory implements WidgetFactory {
 
@@ -85,6 +85,7 @@ public class DefaultWidgetFactory implements WidgetFactory {
      * Creates cell editor for text field
      */
     public DefaultCellEditor createCellEditor(JTextField textField) {
+        textField.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
         return new CayenneCellEditor(textField);
     }
 
@@ -95,6 +96,7 @@ public class DefaultWidgetFactory implements WidgetFactory {
      * @param combo JComboBox to be used as editor component
      */
     public TableCellEditor createCellEditor(JComboBox combo) {
+        combo.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
         if (Boolean.TRUE.equals(combo
                 .getClientProperty(AutoCompletion.AUTOCOMPLETION_PROPERTY))) {
             return new ComboBoxCellEditor(combo);

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxEditor.java
deleted file mode 100644
index f43b095..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxEditor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*****************************************************************
- *   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.util;
-
-import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-
-public class JTableCollectionTypeComboBoxEditor extends AbstractCellEditor implements TableCellEditor {
-
-        private static final String COLLECTION_TYPE_MAP = "java.util.Map";
-        private static final String COLLECTION_TYPE_SET = "java.util.Set";
-        private static final String COLLECTION_TYPE_COLLECTION = "java.util.Collection";
-        private static final String DEFAULT_COLLECTION_TYPE = "java.util.List";
-        private static final int REL_COLLECTION_TYPE_COLUMN = 3;
-
-        private ObjRelationshipTableModel model;
-        private int row;
-
-        public JTableCollectionTypeComboBoxEditor() {
-        }
-
-        @Override
-        public Component getTableCellEditorComponent(final JTable table, Object value, boolean isSelected, final int row, final int column) {
-            this.model = (ObjRelationshipTableModel) table.getModel();
-            this.row = row;
-
-            final JComboBox collectionTypeCombo = Application.getWidgetFactory().createComboBox(
-                    new Object[]{
-                            COLLECTION_TYPE_MAP,
-                            COLLECTION_TYPE_SET,
-                            COLLECTION_TYPE_COLLECTION,
-                            DEFAULT_COLLECTION_TYPE
-                    },
-                    false);
-            if (model.getRelationship(row).isToMany()) {
-                collectionTypeCombo.setEnabled(true);
-                collectionTypeCombo.setSelectedItem(model.getRelationship(row).getCollectionType());
-            } else {
-                JLabel labelIfToOneRelationship = new JLabel();
-                labelIfToOneRelationship.setEnabled(false);
-                return labelIfToOneRelationship;
-            }
-            collectionTypeCombo.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                    Object selected = collectionTypeCombo.getSelectedItem();
-                    model.setUpdatedValueAt(selected, row, REL_COLLECTION_TYPE_COLUMN);
-                    table.repaint();
-                }
-            });
-            return collectionTypeCombo;
-        }
-
-        @Override
-        public Object getCellEditorValue() {
-            return model.getValueAt(row, REL_COLLECTION_TYPE_COLUMN);
-        }
-    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxRenderer.java
deleted file mode 100644
index 8c5d497..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableCollectionTypeComboBoxRenderer.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*****************************************************************
- *   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.util;
-
-import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
-
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Component;
-import java.awt.Font;
-
-public class JTableCollectionTypeComboBoxRenderer implements TableCellRenderer {
-
-        private ObjRelationshipTableModel model;
-
-        public JTableCollectionTypeComboBoxRenderer() {
-        }
-
-        @Override
-        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
-            this.model = (ObjRelationshipTableModel) table.getModel();
-            JLabel labelIfToOneRelationship = new JLabel();
-            labelIfToOneRelationship.setEnabled(false);
-            JLabel labelIfToManyRelationship = new JLabel((String) value);
-            labelIfToManyRelationship.setEnabled(true);
-            labelIfToManyRelationship.setFont(new Font("Verdana", Font.PLAIN, 12));
-            if (value == null) {
-                return labelIfToOneRelationship;
-            }
-            if (model.getRelationship(row).isToMany()) {
-                return labelIfToManyRelationship;
-            } else {
-                return labelIfToOneRelationship;
-            }
-
-        }
-    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxEditor.java
deleted file mode 100644
index 3e1178a..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxEditor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*****************************************************************
- *   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.util;
-
-import org.apache.cayenne.map.ObjAttribute;
-import org.apache.cayenne.map.ObjEntity;
-import org.apache.cayenne.modeler.Application;
-import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
-
-import javax.swing.AbstractCellEditor;
-import javax.swing.JComboBox;
-import javax.swing.JTable;
-import javax.swing.table.TableCellEditor;
-import java.awt.Component;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-
-public class JTableMapKeyComboBoxEditor extends AbstractCellEditor implements TableCellEditor {
-
-        private static final String DEFAULT_MAP_KEY = "ID (default)";
-        private static final String COLLECTION_TYPE_MAP = "java.util.Map";
-        private static final int REL_MAP_KEY_COLUMN = 4;
-
-        private List<String> mapKeys = new ArrayList<>();
-        private ObjRelationshipTableModel model;
-        private int row;
-
-        public JTableMapKeyComboBoxEditor() {
-        }
-
-        private void initMapKeys() {
-            mapKeys.clear();
-            mapKeys.add(DEFAULT_MAP_KEY);
-            /**
-             * Object target can be null when selected target DbEntity has no
-             * ObjEntities
-             */
-            ObjEntity objectTarget = model.getRelationship(row).getTargetEntity();
-            if (objectTarget == null) {
-                return;
-            }
-            for (ObjAttribute attribute : objectTarget.getAttributes()) {
-                mapKeys.add(attribute.getName());
-            }
-        }
-
-        @Override
-        public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, final int column) {
-            this.model = (ObjRelationshipTableModel) table.getModel();
-            this.row = row;
-            initMapKeys();
-            final JComboBox mapKeysComboBox = Application.getWidgetFactory().createComboBox(
-                    mapKeys,
-                    false);
-            if ((model.getRelationship(row).getCollectionType() == null)
-                    || (!model.getRelationship(row).getCollectionType().equals(COLLECTION_TYPE_MAP))) {
-                JComboBox jComboBox = new JComboBox();
-                jComboBox.setFocusable(false);
-                jComboBox.setEnabled(false);
-                return jComboBox;
-            } else {
-                mapKeysComboBox.setFocusable(true);
-                mapKeysComboBox.setEnabled(true);
-            }
-            mapKeysComboBox.addActionListener(new ActionListener() {
-                @Override
-                public void actionPerformed(ActionEvent e) {
-                    Object selected = mapKeysComboBox.getSelectedItem();
-                    model.setUpdatedValueAt(selected, row, REL_MAP_KEY_COLUMN);
-                }
-            });
-            mapKeysComboBox.setSelectedItem(model.getRelationship(row).getMapKey());
-            return mapKeysComboBox;
-        }
-
-        @Override
-        public Object getCellEditorValue() {
-            return model.getValueAt(row, REL_MAP_KEY_COLUMN);
-        }
-    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxRenderer.java
deleted file mode 100644
index 6f359a1..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/JTableMapKeyComboBoxRenderer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*****************************************************************
- *   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.util;
-
-import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
-
-import javax.swing.JComboBox;
-import javax.swing.JLabel;
-import javax.swing.JTable;
-import javax.swing.table.TableCellRenderer;
-import java.awt.Component;
-import java.awt.Font;
-
-public class JTableMapKeyComboBoxRenderer implements TableCellRenderer {
-
-        private static final String DEFAULT_MAP_KEY = "ID (default)";
-        private static final String COLLECTION_TYPE_MAP = "java.util.Map";
-
-        private ObjRelationshipTableModel model;
-
-        public JTableMapKeyComboBoxRenderer() {
-        }
-
-        @Override
-        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
-            this.model = (ObjRelationshipTableModel) table.getModel();
-            if ((model.getRelationship(row).getCollectionType() == null)
-                    || (!model.getRelationship(row).getCollectionType().equals(COLLECTION_TYPE_MAP))) {
-                JComboBox jComboBox = new JComboBox();
-                jComboBox.setFocusable(false);
-                jComboBox.setEnabled(false);
-                return jComboBox;
-            }
-            if (model.getRelationship(row).getMapKey() == null) {
-                model.getRelationship(row).setMapKey(DEFAULT_MAP_KEY);
-            }
-            JLabel jLabel = new JLabel(model.getRelationship(row).getMapKey());
-            jLabel.setFont(new Font("Verdana", Font.PLAIN, 12));
-            return jLabel;
-        }
-    }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxEditor.java
new file mode 100644
index 0000000..2d4d16e
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxEditor.java
@@ -0,0 +1,104 @@
+/*****************************************************************
+ *   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.util;
+
+import org.apache.cayenne.map.ObjAttribute;
+import org.apache.cayenne.map.ObjEntity;
+import org.apache.cayenne.modeler.Application;
+import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
+
+import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JTable;
+import javax.swing.table.TableCellEditor;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.List;
+
+public class MapKeyComboBoxEditor extends AbstractCellEditor implements TableCellEditor {
+
+    private static final String DEFAULT_MAP_KEY = "ID (default)";
+    private static final String COLLECTION_TYPE_MAP = "java.util.Map";
+    private static final int REL_MAP_KEY_COLUMN = 4;
+
+    private List<String> mapKeys = new ArrayList<>();
+    private ObjRelationshipTableModel model;
+    private int row;
+
+    private void initMapKeys() {
+        mapKeys.clear();
+        mapKeys.add(DEFAULT_MAP_KEY);
+        /**
+         * Object target can be null when selected target DbEntity has no
+         * ObjEntities
+         */
+        ObjEntity objectTarget = model.getRelationship(row).getTargetEntity();
+        if (objectTarget == null) {
+            return;
+        }
+        for (ObjAttribute attribute : objectTarget.getAttributes()) {
+            mapKeys.add(attribute.getName());
+        }
+    }
+
+    @Override
+    public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, final int row, int column) {
+        this.model = (ObjRelationshipTableModel) table.getModel();
+        this.row = row;
+        initMapKeys();
+        final JComboBox mapKeysComboBox = Application.getWidgetFactory().createComboBox(
+                mapKeys,
+                false);
+        if ((model.getRelationship(row).getCollectionType() == null)
+                || (!model.getRelationship(row).getCollectionType().equals(COLLECTION_TYPE_MAP))) {
+            JLabel labelIfNotMapCollection = new JLabel();
+            labelIfNotMapCollection.setEnabled(false);
+            return labelIfNotMapCollection;
+        }
+        mapKeysComboBox.setFocusable(true);
+        mapKeysComboBox.setEnabled(true);
+
+        mapKeysComboBox.addActionListener(new ActionListener() {
+            @Override
+            public void actionPerformed(ActionEvent e) {
+                Object selected = mapKeysComboBox.getSelectedItem();
+                model.setUpdatedValueAt(selected, row, REL_MAP_KEY_COLUMN);
+            }
+        });
+        mapKeysComboBox.setSelectedItem(model.getRelationship(row).getMapKey());
+
+        mapKeysComboBox.setFocusable(false);
+        mapKeysComboBox.setEditable(true);
+        ((JComponent) mapKeysComboBox.getEditor().getEditorComponent()).setBorder(null);
+        mapKeysComboBox.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+
+        return mapKeysComboBox;
+    }
+
+    @Override
+    public Object getCellEditorValue() {
+        return model.getValueAt(row, REL_MAP_KEY_COLUMN);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxRenderer.java
new file mode 100644
index 0000000..6664a58
--- /dev/null
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxRenderer.java
@@ -0,0 +1,57 @@
+/*****************************************************************
+ *   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.util;
+
+import org.apache.cayenne.modeler.editor.ObjRelationshipTableModel;
+
+import javax.swing.BorderFactory;
+import javax.swing.JTable;
+import javax.swing.table.DefaultTableCellRenderer;
+import java.awt.Component;
+import java.awt.Font;
+
+public class MapKeyComboBoxRenderer extends DefaultTableCellRenderer {
+
+    private static final String DEFAULT_MAP_KEY = "ID (default)";
+    private static final String COLLECTION_TYPE_MAP = "java.util.Map";
+
+    @Override
+    public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
+        super.getTableCellRendererComponent(table, value, isSelected,  hasFocus,  row, column);
+
+        setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
+        ObjRelationshipTableModel model = (ObjRelationshipTableModel) table.getModel();
+        if ((model.getRelationship(row).getCollectionType() == null)
+                || (!model.getRelationship(row).getCollectionType().equals(COLLECTION_TYPE_MAP))) {
+
+            setEnabled(false);
+            setText("");
+            return this;
+        }
+        if (model.getRelationship(row).getMapKey() == null) {
+            model.getRelationship(row).setMapKey(DEFAULT_MAP_KEY);
+        }
+
+        setText(model.getRelationship(row).getMapKey());
+        setFont(new Font("Verdana", Font.PLAIN, 12));
+        setEnabled(true);
+        return this;
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PathChooserComboBoxCellEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PathChooserComboBoxCellEditor.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PathChooserComboBoxCellEditor.java
index ae4a639..051d8a4 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PathChooserComboBoxCellEditor.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PathChooserComboBoxCellEditor.java
@@ -24,8 +24,10 @@ import org.apache.cayenne.modeler.util.combo.AutoCompletion;
 import org.apache.commons.lang.StringUtils;
 
 import javax.swing.AbstractCellEditor;
+import javax.swing.BorderFactory;
 import javax.swing.DefaultComboBoxModel;
 import javax.swing.JComboBox;
+import javax.swing.JComponent;
 import javax.swing.JTable;
 import javax.swing.table.TableCellEditor;
 import javax.swing.text.JTextComponent;
@@ -71,7 +73,9 @@ public abstract class PathChooserComboBoxCellEditor extends AbstractCellEditor i
                 parsePathString(event.getKeyChar());
             }
         });
-        AutoCompletion.enable(comboBoxPathChooser, false, true);
+        AutoCompletion.enable(comboBoxPathChooser, true, true);
+        ((JComponent) comboBoxPathChooser.getEditor().getEditorComponent()).setBorder(null);
+        comboBoxPathChooser.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
     }
 
     private void setComboModelAccordingToPath(String pathString) {

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/SortButtonRenderer.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/SortButtonRenderer.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/SortButtonRenderer.java
index beae1e7..a68998e 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/SortButtonRenderer.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/SortButtonRenderer.java
@@ -19,50 +19,24 @@
 package org.apache.cayenne.modeler.util;
 
 import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
 import javax.swing.JButton;
+import javax.swing.JLabel;
 import javax.swing.JTable;
-import javax.swing.border.MatteBorder;
-import javax.swing.table.TableCellRenderer;
+import javax.swing.border.CompoundBorder;
+import javax.swing.table.DefaultTableCellRenderer;
 import java.awt.Color;
 import java.awt.Component;
-import java.awt.Insets;
-import java.util.Hashtable;
+import java.awt.Font;
 
-public class SortButtonRenderer extends JButton implements TableCellRenderer {
+public class SortButtonRenderer  extends DefaultTableCellRenderer {
 
     public static final int NONE = 0;
     public static final int DOWN = 1;
     public static final int UP = 2;
 
-    private int pushedColumn;
-    private Hashtable state;
-    private JButton downButton, upButton;
-
-    public SortButtonRenderer() {
-        MatteBorder matteBorder = BorderFactory.createMatteBorder(0, 0, 1, 1, Color.gray);
-        setBorder(matteBorder);
-
-        pushedColumn = -1;
-        state = new Hashtable();
-
-        setMargin(new Insets(0, 0, 0, 0));
-        setHorizontalTextPosition(CENTER);
-        setIcon(new BlankIcon());
-
-        downButton = new JButton();
-
-        downButton.setBorder(matteBorder);
-        downButton.setMargin(new Insets(0, 0, 0, 0));
-        downButton.setHorizontalTextPosition(LEFT);
-        downButton.setIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, false));
-        downButton.setPressedIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, true));
-
-        upButton = new JButton();
-        upButton.setBorder(matteBorder);
-        upButton.setMargin(new Insets(0, 0, 0, 0));
-        upButton.setHorizontalTextPosition(LEFT);
-        upButton.setIcon(new BevelArrowIcon(BevelArrowIcon.UP, false, false));
-    }
+    private int currentState;
+    private int currentColumn;
 
     public Component getTableCellRendererComponent(
             JTable table,
@@ -71,51 +45,46 @@ public class SortButtonRenderer extends JButton implements TableCellRenderer {
             boolean hasFocus,
             int row,
             int column) {
-        JButton button = this;
-        Object obj = state.get(new Integer(column));
+        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
 
-        if (obj != null) {
-            if (((Integer) obj).intValue() == DOWN) {
-                button = downButton;
+        if (column == currentColumn) {
+            if (currentState == DOWN) {
+                setIcon(new BevelArrowIcon(BevelArrowIcon.DOWN, false, false));
             } else {
-                button = upButton;
+                setIcon(new BevelArrowIcon(BevelArrowIcon.UP, false, false));
             }
+        }else {
+            setIcon(new ImageIcon());
         }
-        button.setText((value == null) ? "" : value.toString());
-        return button;
-    }
 
-    public void setPressedColumn(int col) {
-        pushedColumn = col;
+        setText( ((value == null) ? "" : value.toString()));
+        setFont(new Font("Verdana", Font.BOLD , 13));
+        setHorizontalTextPosition(JLabel.LEFT);
+        setOpaque(true);
+        setBackground(new JButton().getBackground());
+        CompoundBorder compoundBorder = BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.GRAY, 1),
+                BorderFactory.createEmptyBorder(0, 4, 0, 0));
+        setBorder(compoundBorder);
+        return this;
     }
 
     public void setSelectedColumn(int col, boolean isAscOrder) {
-        if (col < 0)
+        if (col < 0) {
             return;
-        Integer value = null;
+        }
         //shows the direction of ordering
         if (isAscOrder) {
-            value = new Integer(DOWN);
+            currentState = DOWN;
         } else {
-            value = new Integer(UP);
+            currentState = UP;
         }
-
-        state.clear();
-        state.put(new Integer(col), value);
+        currentColumn = col;
     }
 
     public int getState(int col) {
-        int retValue;
-        Object obj = state.get(new Integer(col));
-        if (obj == null) {
-            retValue = NONE;
-        } else {
-            if (((Integer) obj).intValue() == DOWN) {
-                retValue = DOWN;
-            } else {
-                retValue = UP;
-            }
+        if (col == currentColumn){
+            return currentState;
         }
-        return retValue;
+        return NONE;
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/cayenne/blob/7e8e07c7/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
index 9c8a371..86ec2b5 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
@@ -280,12 +280,12 @@ public class AutoCompletion implements FocusListener, KeyListener, Runnable {
     private void suggestionListScrolling(){
         Component c = suggestionList.getComponent(0);
         if (c instanceof JScrollPane) {
-            double height = suggestionList.getPreferredSize().getHeight();
             int itemCount = suggestionList.getItemCount();
             int selectedIndex = suggestionList.getSelectedIndex();
-            double scrollValue = Math.ceil(height*selectedIndex/itemCount);
             JScrollPane scrollPane = (JScrollPane) c;
             JScrollBar scrollBar = scrollPane.getVerticalScrollBar();
+            double height = scrollBar.getMaximum();
+            double scrollValue = Math.ceil(height*selectedIndex/itemCount);
             scrollBar.setValue((int) scrollValue);
         }
     }


Mime
View raw message