cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmen...@apache.org
Subject svn commit: r670246 [2/2] - in /cayenne/main/trunk/framework: cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/map/event/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/ cayenne-modeler/src/main/java/org/apache/cayenne/modeler/acti...
Date Sat, 21 Jun 2008 18:25:31 GMT
Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributeTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributeTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributeTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityAttributeTab.java Sat Jun 21 11:25:29 2008
@@ -23,6 +23,7 @@
 import java.awt.Color;
 import java.awt.Component;
 import java.util.EventObject;
+import java.util.List;
 
 import javax.swing.JComboBox;
 import javax.swing.JPanel;
@@ -50,6 +51,7 @@
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
+import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
 import org.apache.cayenne.modeler.util.ModelerUtil;
@@ -117,42 +119,54 @@
     /**
      * Selects a specified attribute.
      */
-    public void selectAttribute(ObjAttribute attr) {
-        if (attr == null) {
-            Application
-                    .getInstance()
-                    .getAction(RemoveAttributeAction.getActionName())
-                    .setEnabled(false);
+    public void selectAttributes(ObjAttribute[] attrs) {
+        CayenneAction removeAction = Application
+            .getInstance()
+            .getAction(RemoveAttributeAction.getActionName());
+        
+        if (attrs.length == 0) {
+            removeAction.setEnabled(false);
             return;
         }
         // enable the remove button
-        Application
-                .getInstance()
-                .getAction(RemoveAttributeAction.getActionName())
-                .setEnabled(true);
+        removeAction.setEnabled(true);
+        removeAction.setName(RemoveAttributeAction.getActionName(attrs.length > 1));
 
         ObjAttributeTableModel model = (ObjAttributeTableModel) table.getModel();
-        java.util.List attrs = model.getObjectList();
-        int attrPos = attrs.indexOf(attr);
-        if (attrPos >= 0) {
-            table.select(attrPos);
+        
+        List listAttrs = model.getObjectList();
+        int[] newSel = new int[attrs.length];
+        
+        for (int i = 0; i < attrs.length; i++) {
+            newSel[i] = listAttrs.indexOf(attrs[i]);
         }
+        
+        table.select(newSel);
     }
 
     public void processExistingSelection(EventObject e) {
         if (e instanceof ChangeEvent) {
             table.clearSelection();
         }
-        ObjAttribute attribute = null;
+        
+        ObjAttribute[] attrs = new ObjAttribute[0];
         if (table.getSelectedRow() >= 0) {
             ObjAttributeTableModel model = (ObjAttributeTableModel) table.getModel();
-            attribute = model.getAttribute(table.getSelectedRow());
-
-            // scroll table
-            UIUtil.scrollToSelectedRow(table);
+            
+            int[] sel = table.getSelectedRows();
+            attrs = new ObjAttribute[sel.length];
+            
+            for (int i = 0; i < sel.length; i++) {
+                attrs[i] = model.getAttribute(sel[i]);
+            }
+     
+            if (sel.length == 1) {
+                // scroll table
+                UIUtil.scrollToSelectedRow(table);
+            }
         }
 
-        AttributeDisplayEvent ev = new AttributeDisplayEvent(this, attribute, mediator
+        AttributeDisplayEvent ev = new AttributeDisplayEvent(this, attrs, mediator
                 .getCurrentObjEntity(), mediator.getCurrentDataMap(), mediator
                 .getCurrentDataDomain());
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityRelationshipTab.java Sat Jun 21 11:25:29 2008
@@ -26,6 +26,7 @@
 import java.awt.event.ActionListener;
 import java.util.Collection;
 import java.util.EventObject;
+import java.util.List;
 
 import javax.swing.DefaultCellEditor;
 import javax.swing.DefaultComboBoxModel;
@@ -64,6 +65,7 @@
 import org.apache.cayenne.modeler.event.ObjEntityDisplayListener;
 import org.apache.cayenne.modeler.event.RelationshipDisplayEvent;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
+import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
 import org.apache.cayenne.modeler.util.CellRenderers;
@@ -196,40 +198,50 @@
     /**
      * Selects a specified relationship in the relationships table.
      */
-    public void selectRelationship(ObjRelationship rel) {
-        if (rel == null) {
-            Application
-                    .getInstance()
-                    .getAction(RemoveRelationshipAction.getActionName())
-                    .setEnabled(false);
+    public void selectRelationships(ObjRelationship[] rels) {
+        CayenneAction removeAction = Application
+            .getInstance()
+            .getAction(RemoveRelationshipAction.getActionName());
+        
+        if (rels.length == 0) {
+            removeAction.setEnabled(false);
             return;
         }
         // enable the remove button
-        Application
-                .getInstance()
-                .getAction(RemoveRelationshipAction.getActionName())
-                .setEnabled(true);
+        removeAction.setEnabled(true);
+        removeAction.setName(RemoveRelationshipAction.getActionName(rels.length > 1));
 
         ObjRelationshipTableModel model = (ObjRelationshipTableModel) table.getModel();
-        java.util.List rels = model.getObjectList();
-        int relPos = rels.indexOf(rel);
-        if (relPos >= 0) {
-            table.select(relPos);
+
+        List listAttrs = model.getObjectList();
+        int[] newSel = new int[rels.length];
+        
+        for (int i = 0; i < rels.length; i++) {
+            newSel[i] = listAttrs.indexOf(rels[i]);
         }
+        
+        table.select(newSel);
     }
 
     public void processExistingSelection(EventObject e) {
         if (e instanceof ChangeEvent) {
             table.clearSelection();
         }
-        ObjRelationship rel = null;
+        ObjRelationship[] rels = new ObjRelationship[0];
         if (table.getSelectedRow() >= 0) {
             ObjRelationshipTableModel model = (ObjRelationshipTableModel) table
                     .getModel();
-            rel = model.getRelationship(table.getSelectedRow());
-            if (rel.getTargetEntity() != null
-                    && ((ObjEntity) rel.getSourceEntity()).getDbEntity() != null
-                    && ((ObjEntity) rel.getTargetEntity()).getDbEntity() != null) {
+            
+            int[] sel = table.getSelectedRows();
+            rels = new ObjRelationship[sel.length];
+            
+            for (int i = 0; i < sel.length; i++) {
+                rels[i] = model.getRelationship(sel[i]);
+            }
+            
+            if (rels.length == 0 && rels[0].getTargetEntity() != null
+                    && ((ObjEntity) rels[0].getSourceEntity()).getDbEntity() != null
+                    && ((ObjEntity) rels[0].getTargetEntity()).getDbEntity() != null) {
                 resolve.setEnabled(true);
             }
             else
@@ -243,7 +255,7 @@
         
         resolveMenu.setEnabled(resolve.isEnabled());
 
-        RelationshipDisplayEvent ev = new RelationshipDisplayEvent(this, rel, mediator
+        RelationshipDisplayEvent ev = new RelationshipDisplayEvent(this, rels, mediator
                 .getCurrentObjEntity(), mediator.getCurrentDataMap(), mediator
                 .getCurrentDataDomain());
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTabbedView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTabbedView.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTabbedView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ObjEntityTabbedView.java Sat Jun 21 11:25:29 2008
@@ -146,14 +146,17 @@
         }
 
         // update relationship selection
-        Relationship rel = e.getRelationship();
-        if (rel instanceof ObjRelationship) {
-            if (getSelectedComponent() != relationshipsPanel) {
-                setSelectedComponent(relationshipsPanel);
-                relationshipsPanel.setVisible(true);
-            }
-            relationshipsPanel.selectRelationship((ObjRelationship) rel);
+        Relationship[] rels = e.getRelationships();
+        ObjRelationship[] objRels = new ObjRelationship[rels.length];
+        
+        System.arraycopy(rels, 0, objRels, 0, rels.length);
+        
+        if (getSelectedComponent() != relationshipsPanel) {
+            setSelectedComponent(relationshipsPanel);
+            relationshipsPanel.setVisible(true);
         }
+        
+        relationshipsPanel.selectRelationships(objRels);
     }
 
     public void currentObjAttributeChanged(AttributeDisplayEvent e) {
@@ -161,13 +164,16 @@
             return;
 
         // update relationship selection
-        Attribute attr = e.getAttribute();
-        if (attr instanceof ObjAttribute) {
-            if (getSelectedComponent() != attributesPanel) {
-                setSelectedComponent(attributesPanel);
-                attributesPanel.setVisible(true);
-            }
-            attributesPanel.selectAttribute((ObjAttribute) attr);
+        Attribute[] attrs = e.getAttributes();
+        ObjAttribute[] objAttrs = new ObjAttribute[attrs.length];
+        
+        System.arraycopy(attrs, 0, objAttrs, 0, attrs.length);
+        
+        if (getSelectedComponent() != attributesPanel) {
+            setSelectedComponent(attributesPanel);
+            attributesPanel.setVisible(true);
         }
+        
+        attributesPanel.selectAttributes(objAttrs);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureParameterTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureParameterTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureParameterTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureParameterTab.java Sat Jun 21 11:25:29 2008
@@ -24,8 +24,8 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.EventObject;
+import java.util.List;
 
-import javax.swing.DefaultCellEditor;
 import javax.swing.Icon;
 import javax.swing.JButton;
 import javax.swing.JComboBox;
@@ -55,6 +55,8 @@
 import org.apache.cayenne.modeler.event.ProcedureDisplayListener;
 import org.apache.cayenne.modeler.event.ProcedureParameterDisplayEvent;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
+import org.apache.cayenne.modeler.util.CayenneAction;
+import org.apache.cayenne.modeler.util.CayenneCellEditor;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
 import org.apache.cayenne.modeler.util.ModelerUtil;
@@ -165,7 +167,7 @@
             table.clearSelection();
         }
 
-        ProcedureParameter parameter = null;
+        ProcedureParameter[] parameters = new ProcedureParameter[0];
         boolean enableUp = false;
         boolean enableDown = false;
         boolean enableRemoveButton = false;
@@ -175,15 +177,27 @@
             enableRemoveButton = true;
             ProcedureParameterTableModel model =
                 (ProcedureParameterTableModel) table.getModel();
-            parameter = model.getParameter(table.getSelectedRow());
-
-            // scroll table
-            UIUtil.scrollToSelectedRow(table);
+            
+            int[] sel = table.getSelectedRows();
+            parameters = new ProcedureParameter[sel.length];
+            
+            for (int i = 0; i < sel.length; i++) {
+                parameters[i] = model.getParameter(sel[i]);
+            }
 
-            int rowCount = table.getRowCount();
-            if (rowCount > 1){
-                if (selectedRow >0) enableUp = true;
-                if (selectedRow < (rowCount - 1)) enableDown = true;
+            if (sel.length == 1) {
+                // scroll table
+                UIUtil.scrollToSelectedRow(table);
+
+                int rowCount = table.getRowCount();
+                if (rowCount > 1) {
+                    if (selectedRow >0) {
+                        enableUp = true;
+                    }
+                    if (selectedRow < (rowCount - 1)) {
+                        enableDown = true;
+                    }
+                }
             }
         }
 
@@ -196,7 +210,7 @@
         ProcedureParameterDisplayEvent ppde =
             new ProcedureParameterDisplayEvent(
                 this,
-                parameter,
+                parameters,
                 eventController.getCurrentProcedure(),
                 eventController.getCurrentDataMap(),
                 eventController.getCurrentDataDomain());
@@ -214,20 +228,29 @@
     }
 
     /**
-     * Selects a specified parameter.
+     * Selects a specified parameters.
      */
-    public void selectParameter(ProcedureParameter parameter) {
-        if (parameter == null) {
+    public void selectParameters(ProcedureParameter[] parameters) {
+        if (parameters.length == 0) {
             return;
         }
+        
+        CayenneAction removeAction = Application
+            .getInstance()
+            .getAction(RemoveProcedureParameterAction.getActionName());
+        removeAction.setName(RemoveProcedureParameterAction.getActionName(parameters.length > 1));
 
         ProcedureParameterTableModel model =
             (ProcedureParameterTableModel) table.getModel();
-        java.util.List parameters = model.getObjectList();
-        int pos = parameters.indexOf(parameter);
-        if (pos >= 0) {
-            table.select(pos);
+        
+        List listAttrs = model.getObjectList();
+        int[] newSel = new int[parameters.length];
+        
+        for (int i = 0; i < parameters.length; i++) {
+            newSel[i] = listAttrs.indexOf(parameters[i]);
         }
+        
+        table.select(newSel);
     }
 
     protected void rebuildTable(Procedure procedure) {
@@ -273,7 +296,7 @@
                 ProcedureParameterTableModel.PARAMETER_DIRECTION_NAMES,
                 false);
         directionEditor.setEditable(false);
-        directionColumn.setCellEditor(new DefaultCellEditor(directionEditor));
+        directionColumn.setCellEditor(new CayenneCellEditor(directionEditor));
 
         moveUp.setEnabled(false);
         moveDown.setEnabled(false);

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureQueryView.java Sat Jun 21 11:25:29 2008
@@ -71,6 +71,7 @@
         // create widgets
         name = new TextAdapter(new JTextField()) {
 
+            @Override
             protected void updateModel(String text) {
                 setQueryName(text);
             }
@@ -80,10 +81,12 @@
         queryRoot.setRenderer(CellRenderers.listRendererWithIcons());
         properties = new RawQueryPropertiesPanel(mediator) {
 
+            @Override
             protected void setEntity(ObjEntity entity) {
                 ProcedureQueryView.this.setEntity(entity);
             }
 
+            @Override
             public ObjEntity getEntity(Query query) {
                 if (query instanceof ProcedureQuery) {
                     return ProcedureQueryView.this.getEntity((ProcedureQuery) query);
@@ -199,7 +202,7 @@
 
         if (map.getQuery(newName) == null) {
             // completely new name, set new name for entity
-            QueryEvent e = new QueryEvent(this, query, query.getName());
+            QueryEvent e = new QueryEvent(this, query, query.getName(), map);
             ProjectUtil.setQueryName(map, query, newName);
             mediator.fireQueryEvent(e);
         }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureTabbedView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureTabbedView.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureTabbedView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/ProcedureTabbedView.java Sat Jun 21 11:25:29 2008
@@ -92,11 +92,10 @@
     }
 
     public void currentProcedureParameterChanged(ProcedureParameterDisplayEvent e) {
-        if (e.getProcedureParameter() == null)
-            return;
-
-        ProcedureParameter parameter = e.getProcedureParameter();
-        procedureParameterPanel.selectParameter(parameter);
+        ProcedureParameter[] parameters = e.getProcedureParameters();
+        
+        if(parameters.length > 0) {
+            procedureParameterPanel.selectParameters(parameters);
+        }
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributeTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributeTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributeTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityAttributeTab.java Sat Jun 21 11:25:29 2008
@@ -21,6 +21,7 @@
 
 import java.awt.BorderLayout;
 import java.util.EventObject;
+import java.util.List;
 
 import javax.swing.JComboBox;
 import javax.swing.JPanel;
@@ -47,6 +48,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.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
 import org.apache.cayenne.modeler.util.PanelFactory;
@@ -110,49 +112,61 @@
     }
 
     /**
-     * Selects a specified attribute.
+     * Selects specified attributes.
      */
-    public void selectAttribute(DbAttribute attr) {
-        if (attr == null) {
-            Application
-                    .getInstance()
-                    .getAction(RemoveAttributeAction.getActionName())
-                    .setEnabled(false);
+    public void selectAttributes(DbAttribute[] attrs) {
+        CayenneAction removeAction = Application
+          .getInstance()
+          .getAction(RemoveAttributeAction.getActionName());
+        
+        if (attrs == null || attrs.length == 0) {
+            removeAction.setEnabled(false);
             return;
         }
         // enable the remove button
-        Application
-                .getInstance()
-                .getAction(RemoveAttributeAction.getActionName())
-                .setEnabled(true);
+        removeAction.setEnabled(true);
+        removeAction.setName(RemoveAttributeAction.getActionName(attrs.length > 1));
 
         DbAttributeTableModel model = (DbAttributeTableModel) table.getModel();
-        java.util.List attrs = model.getObjectList();
-        int attrPos = attrs.indexOf(attr);
-        if (attrPos >= 0) {
-            table.select(attrPos);
+        
+        List listAttrs = model.getObjectList();
+        int[] newSel = new int[attrs.length];
+        
+        for (int i = 0; i < attrs.length; i++) {
+            newSel[i] = listAttrs.indexOf(attrs[i]);
         }
+        
+        table.select(newSel);
     }
 
     public void processExistingSelection(EventObject e) {
         if (e instanceof ChangeEvent) {
             table.clearSelection();
         }
-        DbAttribute att = null;
+            
+        DbAttribute[] attrs = new DbAttribute[0];
         if (table.getSelectedRow() >= 0) {
-            DbAttributeTableModel model = (DbAttributeTableModel) table.getModel();
-            att = model.getAttribute(table.getSelectedRow());
-
-            // scroll table
-            UIUtil.scrollToSelectedRow(table);
+           DbAttributeTableModel model = (DbAttributeTableModel) table.getModel();
+           
+           int[] sel = table.getSelectedRows();
+           attrs = new DbAttribute[sel.length];
+           
+           for (int i = 0; i < sel.length; i++) {
+               attrs[i] = model.getAttribute(sel[i]);
+           }
+    
+           if (sel.length == 1) {
+               // scroll table
+               UIUtil.scrollToSelectedRow(table);
+           }
         }
-
+    
         mediator.fireDbAttributeDisplayEvent(new AttributeDisplayEvent(
-                this,
-                att,
-                mediator.getCurrentDbEntity(),
-                mediator.getCurrentDataMap(),
-                mediator.getCurrentDataDomain()));
+               this,
+               attrs,
+               mediator.getCurrentDbEntity(),
+               mediator.getCurrentDataMap(),
+               mediator.getCurrentDataDomain()));
     }
 
     public void dbAttributeChanged(AttributeEvent e) {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipTab.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipTab.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipTab.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityRelationshipTab.java Sat Jun 21 11:25:29 2008
@@ -23,6 +23,7 @@
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.util.EventObject;
+import java.util.List;
 
 import javax.swing.ComboBoxModel;
 import javax.swing.DefaultComboBoxModel;
@@ -59,6 +60,7 @@
 import org.apache.cayenne.modeler.event.EntityDisplayEvent;
 import org.apache.cayenne.modeler.event.RelationshipDisplayEvent;
 import org.apache.cayenne.modeler.event.TablePopupHandler;
+import org.apache.cayenne.modeler.util.CayenneAction;
 import org.apache.cayenne.modeler.util.CayenneTable;
 import org.apache.cayenne.modeler.util.CayenneWidgetFactory;
 import org.apache.cayenne.modeler.util.CellRenderers;
@@ -177,48 +179,60 @@
     /**
      * Selects a specified relationship in the relationships table.
      */
-    public void selectRelationship(DbRelationship rel) {
-        if (rel == null) {
-            Application
-                    .getInstance()
-                    .getAction(RemoveRelationshipAction.getActionName())
-                    .setEnabled(false);
+    public void selectRelationships(DbRelationship[] rels) {
+        CayenneAction removeAction = Application
+            .getInstance()
+            .getAction(RemoveRelationshipAction.getActionName());
+        
+        if (rels.length == 0) {
+            removeAction.setEnabled(false);
             return;
         }
         // enable the remove button
-        Application
-                .getInstance()
-                .getAction(RemoveRelationshipAction.getActionName())
-                .setEnabled(true);
+        removeAction.setEnabled(true);
+        removeAction.setName(RemoveRelationshipAction.getActionName(rels.length > 1));
 
         DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
-        java.util.List rels = model.getObjectList();
-        int relPos = rels.indexOf(rel);
-        if (relPos >= 0) {
-            table.select(relPos);
+        
+        List listAttrs = model.getObjectList();
+        int[] newSel = new int[rels.length];
+        
+        for (int i = 0; i < rels.length; i++) {
+            newSel[i] = listAttrs.indexOf(rels[i]);
         }
+        
+        table.select(newSel);
     }
 
     public void processExistingSelection(EventObject e) {
         if (e instanceof ChangeEvent) {
             table.clearSelection();
         }
-        DbRelationship rel = null;
+        
+        DbRelationship[] rels = new DbRelationship[0];
         if (table.getSelectedRow() >= 0) {
-            DbRelationshipTableModel model;
-            model = (DbRelationshipTableModel) table.getModel();
-            rel = model.getRelationship(table.getSelectedRow());
-            resolve.setEnabled(rel.getTargetEntity() != null);
+            DbRelationshipTableModel model = (DbRelationshipTableModel) table.getModel();
+            
+            int[] sel = table.getSelectedRows();
+            rels = new DbRelationship[sel.length];
+            
+            for (int i = 0; i < sel.length; i++) {
+                rels[i] = model.getRelationship(sel[i]);
+            }
+            
+            resolve.setEnabled(rels.length == 1 && rels[0].getTargetEntity() != null);
 
-            // scroll table
-            UIUtil.scrollToSelectedRow(table);
+            if (sel.length == 1) {
+                // scroll table
+                UIUtil.scrollToSelectedRow(table);
+            }
         }
         else
             resolve.setEnabled(false);
         
         resolveMenu.setEnabled(resolve.isEnabled());
 
-        RelationshipDisplayEvent ev = new RelationshipDisplayEvent(this, rel, mediator
+        RelationshipDisplayEvent ev = new RelationshipDisplayEvent(this, rels, mediator
                 .getCurrentDbEntity(), mediator.getCurrentDataMap(), mediator
                 .getCurrentDataDomain());
 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTabbedView.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTabbedView.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTabbedView.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/editor/dbentity/DbEntityTabbedView.java Sat Jun 21 11:25:29 2008
@@ -116,19 +116,20 @@
         if (e.getEntity() == null) {
             return;
         }
-
+        
         // update relationship selection
-        Relationship rel = e.getRelationship();
-        if (rel instanceof DbRelationship) {
-            
-            // reset tab to relationship
-            if (getSelectedComponent() != relationshipsPanel) {
-                setSelectedComponent(relationshipsPanel);
-                relationshipsPanel.setVisible(true);
-            }
-            
-            relationshipsPanel.selectRelationship((DbRelationship) rel);
+        Relationship[] rels = e.getRelationships();
+        DbRelationship[] dbRels = new DbRelationship[rels.length];
+        
+        System.arraycopy(rels, 0, dbRels, 0, rels.length);
+        
+        // reset tab to relationship
+        if (getSelectedComponent() != relationshipsPanel) {
+            setSelectedComponent(relationshipsPanel);
+            relationshipsPanel.setVisible(true);
         }
+        
+        relationshipsPanel.selectRelationships(dbRels);
     }
 
     public void currentDbAttributeChanged(AttributeDisplayEvent e) {
@@ -136,13 +137,16 @@
             return;
 
         // update relationship selection
-        Attribute attr = e.getAttribute();
-        if (attr instanceof DbAttribute) {
-            if (getSelectedComponent() != attributesPanel){
-                setSelectedComponent(attributesPanel);
-                attributesPanel.setVisible(true);
-            }
-            attributesPanel.selectAttribute((DbAttribute) attr);
+        Attribute[] attrs = e.getAttributes();
+        DbAttribute[] dbAttrs = new DbAttribute[attrs.length];
+        
+        System.arraycopy(attrs, 0, dbAttrs, 0, attrs.length);
+        
+        if (getSelectedComponent() != attributesPanel) {
+            setSelectedComponent(attributesPanel);
+            attributesPanel.setVisible(true);
         }
+            
+        attributesPanel.selectAttributes(dbAttrs);
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/AttributeDisplayEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/AttributeDisplayEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/AttributeDisplayEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/AttributeDisplayEvent.java Sat Jun 21 11:25:29 2008
@@ -28,19 +28,31 @@
   * @author Michael Misha Shengaout
   */
 public class AttributeDisplayEvent extends EntityDisplayEvent {
-    protected Attribute attribute;
+    protected Attribute[] attributes;
+    
+    public AttributeDisplayEvent(
+            Object src,
+            Attribute attribute,
+            Entity entity,
+            DataMap dataMap,
+            DataDomain domain) {
+        
+            super(src, entity, dataMap, domain);
+            attributes = new Attribute[] { attribute };
+    }
 
     public AttributeDisplayEvent(
         Object src,
-        Attribute temp_attribute,
-        Entity temp_entity,
-        DataMap data_map,
-        DataDomain temp_domain) {
-        super(src, temp_entity, data_map, temp_domain);
-        attribute = temp_attribute;
-    }
+        Attribute[] attributes,
+        Entity entity,
+        DataMap dataMap,
+        DataDomain domain) {
 
-    public Attribute getAttribute() {
-        return attribute;
+        super(src, entity, dataMap, domain);
+        this.attributes = attributes;
+    }
+    
+    public Attribute[] getAttributes() {
+        return attributes;
     }
 }

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayEvent.java?rev=670246&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayEvent.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayEvent.java Sat Jun 21 11:25:29 2008
@@ -0,0 +1,42 @@
+/*****************************************************************
+ *   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.event;
+
+import java.util.EventObject;
+
+import org.apache.cayenne.project.ProjectPath;
+
+/**
+ * Display event for several selected objects
+ */
+public class MultipleObjectsDisplayEvent extends EventObject {
+    private ProjectPath[] paths;
+    
+    public MultipleObjectsDisplayEvent(Object src, ProjectPath[] paths) {
+        super(src);
+        this.paths = paths;
+    }
+    
+    /**
+     * @return all paths of this event
+     */
+    public ProjectPath[] getPaths() {
+        return paths;
+    }
+}

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java?rev=670246&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/MultipleObjectsDisplayListener.java Sat Jun 21 11:25:29 2008
@@ -0,0 +1,31 @@
+/*****************************************************************
+ *   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.event;
+
+import java.util.EventListener;
+
+/**
+ * Listener for multiple objects selections 
+ */
+public interface MultipleObjectsDisplayListener extends EventListener {
+    /**
+     * Invoked when a new set of objects was displayed
+     */
+    public void currentObjectsChanged(MultipleObjectsDisplayEvent e);
+}

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/ProcedureParameterDisplayEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/ProcedureParameterDisplayEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/ProcedureParameterDisplayEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/ProcedureParameterDisplayEvent.java Sat Jun 21 11:25:29 2008
@@ -29,7 +29,7 @@
  */
 public class ProcedureParameterDisplayEvent extends ProcedureDisplayEvent {
 
-    protected ProcedureParameter procedureParameter;
+    protected ProcedureParameter[] procedureParameters;
 
     public ProcedureParameterDisplayEvent(
         Object src,
@@ -39,14 +39,25 @@
         DataDomain domain) {
         	
         super(src, procedure, map, domain);
-        this.procedureParameter = procedureParameter;
+        this.procedureParameters = new ProcedureParameter[] { procedureParameter };
+    }
+    
+    public ProcedureParameterDisplayEvent(
+            Object src,
+            ProcedureParameter[] procedureParameters,
+            Procedure procedure,
+            DataMap map,
+            DataDomain domain) {
+                
+            super(src, procedure, map, domain);
+            this.procedureParameters = procedureParameters;
     }
 
-    public ProcedureParameter getProcedureParameter() {
-        return procedureParameter;
+    public ProcedureParameter[] getProcedureParameters() {
+        return procedureParameters;
     }
 
-    public void setProcedureParameter(ProcedureParameter parameter) {
-        procedureParameter = parameter;
+    public void setProcedureParameters(ProcedureParameter[] parameters) {
+        procedureParameters = parameters;
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/RelationshipDisplayEvent.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/RelationshipDisplayEvent.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/RelationshipDisplayEvent.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/RelationshipDisplayEvent.java Sat Jun 21 11:25:29 2008
@@ -25,22 +25,33 @@
 import org.apache.cayenne.map.Relationship;
 
 public class RelationshipDisplayEvent extends EntityDisplayEvent {
-    protected Relationship relationship;
+    protected Relationship[] relationships;
     protected boolean relationshipChanged = true;
+    
+    public RelationshipDisplayEvent(
+            Object src,
+            Relationship relationship,
+            Entity entity,
+            DataMap map,
+            DataDomain domain) {
+
+            super(src, entity, map, domain);
+            this.relationships = new Relationship[] { relationship };
+    }
 
     public RelationshipDisplayEvent(
         Object src,
-        Relationship relationship,
+        Relationship[] relationships,
         Entity entity,
         DataMap map,
         DataDomain domain) {
 
         super(src, entity, map, domain);
-        this.relationship = relationship;
+        this.relationships = relationships;
     }
-
-    public Relationship getRelationship() {
-        return relationship;
+    
+    public Relationship[] getRelationships() {
+        return relationships;
     }
 
     public boolean isRelationshipChanged() {

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/TablePopupHandler.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/TablePopupHandler.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/TablePopupHandler.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/event/TablePopupHandler.java Sat Jun 21 11:25:29 2008
@@ -67,8 +67,9 @@
             table.cancelEditing();
 
             int row = table.rowAtPoint(e.getPoint());
-            if (row != -1)
+            if (row != -1 && !table.getSelectionModel().isSelectedIndex(row)) {
                 table.setRowSelectionInterval(row, row);
+            }
 
             popup.show(table, e.getX(), e.getY());
         }

Added: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneCellEditor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneCellEditor.java?rev=670246&view=auto
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneCellEditor.java (added)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneCellEditor.java Sat Jun 21 11:25:29 2008
@@ -0,0 +1,61 @@
+/*****************************************************************
+ *   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 java.awt.event.MouseEvent;
+import java.util.EventObject;
+
+import javax.swing.DefaultCellEditor;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JTextField;
+
+/**
+ * Overrides CellEditor to allow multiple selection in table
+ * without bothering the editor.
+ * 
+ * @author Andrey Razumovsky
+ */
+public class CayenneCellEditor extends DefaultCellEditor {
+    public CayenneCellEditor(final JTextField textField) {
+        super(textField);
+    }
+    
+    public CayenneCellEditor(final JCheckBox checkBox) {
+        super(checkBox);
+    }
+    
+    public CayenneCellEditor(final JComboBox comboBox) {
+        super(comboBox);
+    }
+    
+    @Override
+    public boolean isCellEditable(EventObject e) {
+        if (e instanceof MouseEvent) {
+            //allow multiple selection without 
+            
+            MouseEvent me = (MouseEvent) e;
+            if (me.isControlDown() || me.isShiftDown()) {
+                return false;
+            }
+        }
+        
+        return super.isCellEditable(e);
+    }
+}

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTable.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTable.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTable.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneTable.java Sat Jun 21 11:25:29 2008
@@ -22,6 +22,7 @@
 import java.awt.Component;
 
 import javax.swing.DefaultCellEditor;
+import javax.swing.DefaultListSelectionModel;
 import javax.swing.JTable;
 import javax.swing.JTextField;
 import javax.swing.event.ChangeEvent;
@@ -42,6 +43,8 @@
         super();
         this.setRowHeight(25);
         this.setRowMargin(3);
+        
+        setSelectionModel(new CayenneListSelectionModel());
     }
 
     @Override
@@ -49,7 +52,7 @@
         super.createDefaultEditors();
 
         JTextField textField = CayenneWidgetFactory.createTextField(0);
-        final DefaultCellEditor textEditor = new DefaultCellEditor(textField);
+        final DefaultCellEditor textEditor = CayenneWidgetFactory.createCellEditor(textField);
         textEditor.setClickCountToStart(1);
 
         setDefaultEditor(Object.class, textEditor);
@@ -92,6 +95,14 @@
             getSelectionModel().setSelectionInterval(index, index);
         }
     }
+    
+    /**
+     * Selects multiple rows at once. Fires not more than only one 
+     * ListSelectionEvent
+     */
+    public void select(int[] rows) {
+        ((CayenneListSelectionModel) getSelectionModel()).setSelection(rows);
+    }
 
     public JTextComponent getSelectedTextComponent() {
         int row = getSelectedRow();
@@ -115,4 +126,70 @@
         cancelEditing();
         super.tableChanged(e);
     }
+    
+    /**
+     * ListSelectionModel for Cayenne table. Has a method to set multiple
+     * rows selection at once.
+     */
+    class CayenneListSelectionModel extends DefaultListSelectionModel {
+        boolean fireForbidden = false;
+        
+        /**
+         * Selects selection on multiple rows at once. Fires no more than one
+         * ListSelectionEvent
+         */
+        public void setSelection(int[] rows) {
+            /**
+             * First check if we must do anything at all
+             */
+            boolean selectionChanged = false;
+            for (int i = 0; i < rows.length; i++) {
+                if (!isRowSelected(rows[i])) {
+                    selectionChanged = true;
+                    break;
+                }
+            }
+            
+            if (!selectionChanged) {
+                for (int i = getMinSelectionIndex(); i < getMaxSelectionIndex(); i++) {
+                    if (isSelectedIndex(i)) {
+                        boolean inNewSelection = false;
+                        for (int j = 0; j < rows.length; j++) {
+                            if (rows[j] == i) {
+                                inNewSelection = true;
+                                break;
+                            }
+                        }
+                        
+                        if(!inNewSelection) {
+                            selectionChanged = true;
+                            break;
+                        }
+                    }
+                }
+            }
+            
+            if (!selectionChanged) {
+                return;
+            }
+            
+            fireForbidden = true;
+            
+            clearSelection();
+            for (int i = 0; i < rows.length; i++) {
+                addRowSelectionInterval(rows[i], rows[i]);
+            }
+            
+            fireForbidden = false;
+            
+            fireValueChanged(getValueIsAdjusting());
+        }
+        
+        @Override
+        protected void fireValueChanged(int firstIndex, int lastIndex, boolean isAdjusting) {
+            if (!fireForbidden) {
+                super.fireValueChanged(firstIndex, lastIndex, isAdjusting);
+            }
+        }
+    }
 }

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneWidgetFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneWidgetFactory.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneWidgetFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/CayenneWidgetFactory.java Sat Jun 21 11:25:29 2008
@@ -93,6 +93,13 @@
     }
     
     /**
+     * Creates cell editor for text field
+     */
+    public static DefaultCellEditor createCellEditor(JTextField textField) {
+        return new CayenneCellEditor(textField);
+    }
+    
+    /**
      * Creates cell editor for a table with combo as editor component. Type of this editor
      * depends on auto-completion behavior of JComboBox
      * 

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PanelFactory.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PanelFactory.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PanelFactory.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/PanelFactory.java Sat Jun 21 11:25:29 2008
@@ -125,7 +125,7 @@
         panel.setLayout(new BorderLayout(5, 5));
 
         // Create table with two columns and no rows.
-        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
+        table.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
         table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
 
         // Panel to add space between table and EAST/WEST borders

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/AutoCompletion.java Sat Jun 21 11:25:29 2008
@@ -181,6 +181,11 @@
                 }
                 return;
                 
+            case KeyEvent.VK_CONTROL:
+            case KeyEvent.VK_ALT:
+            case KeyEvent.VK_SHIFT:
+                return;
+                
             default:
                 //invoke in end of AWT thread so that information in textEditor would update
                 SwingUtilities.invokeLater(this);
@@ -219,4 +224,4 @@
             textEditor.requestFocus();
         }
     }
-}
\ No newline at end of file
+}

Modified: cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/ComboBoxCellEditor.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/ComboBoxCellEditor.java?rev=670246&r1=670245&r2=670246&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/ComboBoxCellEditor.java (original)
+++ cayenne/main/trunk/framework/cayenne-modeler/src/main/java/org/apache/cayenne/modeler/util/combo/ComboBoxCellEditor.java Sat Jun 21 11:25:29 2008
@@ -22,7 +22,9 @@
 import java.awt.Component;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
+import java.awt.event.MouseEvent;
 import java.io.Serializable;
+import java.util.EventObject;
 
 import javax.swing.AbstractCellEditor;
 import javax.swing.JComboBox;
@@ -84,4 +86,18 @@
         
         return comboBox;
     }
+    
+    @Override
+    public boolean isCellEditable(EventObject e) {
+        if (e instanceof MouseEvent) {
+            //allow multiple selection without 
+            
+            MouseEvent me = (MouseEvent) e;
+            if (me.isControlDown() || me.isShiftDown()) {
+                return false;
+            }
+        }
+        
+        return true;
+    }
 }



Mime
View raw message