Author: scooter
Date: 2008-09-08 12:22:12 -0700 (Mon, 08 Sep 2008)
New Revision: 14854

Modified:
   coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
Log:
Allow destination of a Copy to be a new attribute.


Modified: coreplugins/trunk/browser/src/browser/MultiDataEditAction.java
===================================================================
--- coreplugins/trunk/browser/src/browser/MultiDataEditAction.java      
2008-09-08 17:55:18 UTC (rev 14853)
+++ coreplugins/trunk/browser/src/browser/MultiDataEditAction.java      
2008-09-08 19:22:12 UTC (rev 14854)
@@ -273,7 +273,9 @@
         * attributeTo the values that were copied will be saved to "new_values"
         */
        private void copyAtt() {
-               if (attrData.getType(attributeFrom) != 
attrData.getType(attributeTo)) {
+               byte fromType = attrData.getType(attributeFrom);
+               byte toType= attrData.getType(attributeTo);
+               if (toType != CyAttributes.TYPE_UNDEFINED && fromType != 
toType) {
                        showErrorWindow("Copy Failed: Incompatible data 
types.");
 
                        return;
@@ -287,7 +289,13 @@
                for (Iterator i = objects.iterator(); i.hasNext();) {
                        GraphObject go = (GraphObject) i.next();
 
-                       Object value = 
attrData.getAttribute(go.getIdentifier(), attributeFrom);
+                       Object value = null;
+                       if (fromType == CyAttributes.TYPE_SIMPLE_LIST)
+                               value = 
attrData.getListAttribute(go.getIdentifier(), attributeFrom);
+                       else if (fromType == CyAttributes.TYPE_SIMPLE_MAP)
+                               value = 
attrData.getMapAttribute(go.getIdentifier(), attributeFrom);
+                       else
+                               value = 
attrData.getAttribute(go.getIdentifier(), attributeFrom);
                        new_values.add(value);
                        setAttributeValue(go.getIdentifier(), attributeTo, 
value);
                        old_values.add(null);


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cytoscape-cvs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cytoscape-cvs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to