cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From skolbac...@apache.org
Subject [4/4] cayenne git commit: remove map key and collection type from ObjEntityRelationshiPanel
Date Wed, 16 Dec 2015 12:57:07 GMT
remove map key and collection type from ObjEntityRelationshiPanel


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

Branch: refs/heads/master
Commit: 1448a194c6f81b566950d54189d379cd96c45fca
Parents: 16ee520
Author: AlexandrShestak <shestakalexandr@mail.ru>
Authored: Tue Dec 15 16:42:29 2015 +0300
Committer: AlexandrShestak <shestakalexandr@mail.ru>
Committed: Tue Dec 15 16:42:29 2015 +0300

----------------------------------------------------------------------
 .../editor/ObjEntityRelationshipPanel.java      |  30 +++---
 .../editor/ObjRelationshipTableModel.java       |  47 +++------
 .../util/CollectionTypeComboBoxEditor.java      |  90 ----------------
 .../util/CollectionTypeComboBoxRenderer.java    |  53 ----------
 .../util/DbAttributePathComboBoxEditor.java     |   5 +
 .../modeler/util/MapKeyComboBoxEditor.java      | 104 -------------------
 .../modeler/util/MapKeyComboBoxRenderer.java    |  57 ----------
 7 files changed, 36 insertions(+), 350 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cayenne/blob/1448a194/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 41061e3..a9900c4 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,24 +41,32 @@ 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.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.*;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultCellEditor;
+import javax.swing.Icon;
+import javax.swing.JComboBox;
+import javax.swing.JComponent;
+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.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.*;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.Collection;
@@ -338,16 +346,6 @@ public class ObjEntityRelationshipPanel extends JPanel implements ObjEntityDispl
         col.setCellEditor(Application.getWidgetFactory().createCellEditor(
                 deleteRulesCombo));
 
-        col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_COLLECTION_TYPE);
-
-        col.setCellEditor(new CollectionTypeComboBoxEditor());
-        col.setCellRenderer(new CollectionTypeComboBoxRenderer());
-
-        col = table.getColumnModel().getColumn(ObjRelationshipTableModel.REL_MAP_KEY);
-
-        col.setCellEditor(new MapKeyComboBoxEditor());
-        col.setCellRenderer(new MapKeyComboBoxRenderer());
-
         tablePreferences.bind(
                 table,
                 null,

http://git-wip-us.apache.org/repos/asf/cayenne/blob/1448a194/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjRelationshipTableModel.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjRelationshipTableModel.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjRelationshipTableModel.java
index cfc7596..e05608d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjRelationshipTableModel.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjRelationshipTableModel.java
@@ -40,12 +40,10 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
     public static final int REL_NAME = 0;
     public static final int REL_TARGET = 1;
     public static final int REL_TARGET_PATH = 2;
-    public static final int REL_COLLECTION_TYPE = 3;
-    public static final int REL_MAP_KEY = 4;
-    public static final int REL_SEMANTICS = 5;
-    public static final int REL_DELETE_RULE = 6;
-    public static final int REL_LOCKING = 7;
-    public static final int COLUMN_COUNT = 8;
+    public static final int REL_SEMANTICS = 3;
+    public static final int REL_DELETE_RULE = 4;
+    public static final int REL_LOCKING = 5;
+    public static final int COLUMN_COUNT = 6;
 
     private ObjEntity entity;
 
@@ -92,10 +90,6 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
                 return "Semantics";
             case REL_DELETE_RULE:
                 return "Delete Rule";
-            case REL_COLLECTION_TYPE:
-                return "Collection Type";
-            case REL_MAP_KEY:
-                return "Map Key";
             case REL_TARGET_PATH:
                 return "DbRelationship Path";
             default:
@@ -133,13 +127,6 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
             return getSemantics(relationship);
         } else if (column == REL_DELETE_RULE) {
             return DeleteRule.deleteRuleName(relationship.getDeleteRule());
-        } else if (column == REL_COLLECTION_TYPE) {
-            if (!relationship.isToMany()) {
-                return null;
-            }
-            return relationship.getCollectionType();
-        } else if (column == REL_MAP_KEY) {
-            return relationship.getMapKey();
         } else if (column == REL_TARGET_PATH) {
             return relationship.getDbRelationshipPath();
         } else {
@@ -153,6 +140,18 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
         if (relationship.isReadOnly()) {
             semantics.append(", read-only");
         }
+        if (relationship.isToMany()) {
+            String collection = "list";
+            if (relationship.getCollectionType() != null) {
+                int dot = relationship.getCollectionType().lastIndexOf('.');
+                collection = relationship
+                        .getCollectionType()
+                        .substring(dot + 1)
+                        .toLowerCase();
+            }
+
+            semantics.append(", " + collection);
+        }
         return semantics.toString();
     }
 
@@ -196,12 +195,6 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
             relationship.setUsedForLocking((value instanceof Boolean)
                     && ((Boolean) value).booleanValue());
             fireTableCellUpdated(row, column);
-        } else if (column == REL_COLLECTION_TYPE) {
-            relationship.setCollectionType((String) value);
-            fireTableCellUpdated(row, column);
-        } else if (column == REL_MAP_KEY) {
-            relationship.setMapKey((String) value);
-            fireTableCellUpdated(row, column);
         } else if (column == REL_TARGET_PATH) {
             relationship.setDbRelationshipPath((String) value);
             fireTableCellUpdated(row, column);
@@ -269,8 +262,6 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
                 sortByElementProperty("usedForLocking", isAscent);
                 break;
             case REL_SEMANTICS:
-            case REL_COLLECTION_TYPE:
-            case REL_MAP_KEY:
             case REL_DELETE_RULE:
             case REL_TARGET_PATH:
                 Collections.sort(objectList, new ObjRelationshipTableComparator(sortCol));
@@ -302,11 +293,7 @@ public class ObjRelationshipTableModel extends CayenneTableModel {
                 return 1;
             }
 
-            switch(sortCol){
-                case REL_COLLECTION_TYPE:
-                    return compareColumnsData(o1.getCollectionType(), o2.getCollectionType());
-                case REL_MAP_KEY:
-                    return compareColumnsData(o1.getMapKey(), o2.getMapKey());
+            switch(sortCol) {
                 case REL_SEMANTICS:
                     return compareColumnsData(getSemantics(o1), getSemantics(o2));
                 case REL_DELETE_RULE:

http://git-wip-us.apache.org/repos/asf/cayenne/blob/1448a194/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
deleted file mode 100644
index 1ea13ed..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxEditor.java
+++ /dev/null
@@ -1,90 +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.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/1448a194/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
deleted file mode 100644
index d1a69b0..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CollectionTypeComboBoxRenderer.java
+++ /dev/null
@@ -1,53 +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.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/1448a194/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxEditor.java
----------------------------------------------------------------------
diff --git a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxEditor.java
b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxEditor.java
index 5eda3d0..f1cca8d 100644
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxEditor.java
+++ b/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/DbAttributePathComboBoxEditor.java
@@ -44,6 +44,7 @@ public class DbAttributePathComboBoxEditor extends PathChooserComboBoxCellEditor
 
     private static final int DB_ATTRIBUTE_PATH_COLUMN = 3;
 
+    private String savePath;
     private ObjAttributeTableModel model;
 
     @Override
@@ -70,6 +71,7 @@ public class DbAttributePathComboBoxEditor extends PathChooserComboBoxCellEditor
     protected void initializeCombo(CayenneTableModel model, int row, final JTable table)
{
         super.initializeCombo(model, row, table);
         comboBoxPathChooser.setSelectedItem(((ObjAttributeTableModel) model).getAttribute(row).getValue().getDbAttributePath());
+        savePath = this.model.getAttribute(row).getValue().getDbAttributePath();
     }
 
 
@@ -103,6 +105,9 @@ public class DbAttributePathComboBoxEditor extends PathChooserComboBoxCellEditor
 
             if (table.getCellEditor() != null) {
                 table.getCellEditor().stopCellEditing();
+                if (dbAttributePath.equals(savePath)) {
+                    return;
+                }
                 model.setUpdatedValueAt(dbAttributePath, row, DB_ATTRIBUTE_PATH_COLUMN);
                 model.getAttribute(row).getValue().setDbAttributePath(dbAttributePath);
             }

http://git-wip-us.apache.org/repos/asf/cayenne/blob/1448a194/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
deleted file mode 100644
index 2d4d16e..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxEditor.java
+++ /dev/null
@@ -1,104 +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.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/1448a194/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
deleted file mode 100644
index 6664a58..0000000
--- a/modeler/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/MapKeyComboBoxRenderer.java
+++ /dev/null
@@ -1,57 +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.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


Mime
View raw message