Author: clopes
Date: 2012-01-02 14:42:25 -0800 (Mon, 02 Jan 2012)
New Revision: 27899

Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/CalculatorConverter.java
Log:
Fixed parsing Cytoscape 2.3 edge arrow calculators.

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/CalculatorConverter.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/CalculatorConverter.java
  2012-01-02 22:04:18 UTC (rev 27898)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/util/vizmap/CalculatorConverter.java
  2012-01-02 22:42:25 UTC (rev 27899)
@@ -197,19 +197,31 @@
         *           {@link 
org.cytoscape.io.internal.util.vizmap.model.PassThroughMapping} object
         */
        private Object getMappingFunction(Properties props, String mapperName, 
VisualProperty vp) {
-               // e.g. "edgeColorCalculator.MyStyle-Edge Color-Discrete 
Mapper.mapping."
-               String baseKey = (legacyKey != null ? legacyKey : key) + "." + 
mapperName + ".mapping.";
-               String functionType = props.getProperty(baseKey + "type");
+               String baseKey = null;
+               String functionType = null;
                
-               if (functionType == null) {
-                       // Try 2.3 calculator names...
-                       if (baseKey.startsWith("nodeFillColorCalculator.")) {
-                               baseKey = "nodeColorCalculator." + mapperName + 
".mapping.";
-                               functionType = props.getProperty(baseKey + 
"type");
+               while (functionType == null) {
+                       // e.g. "edgeColorCalculator.MyStyle-Edge 
Color-Discrete Mapper.mapping."
+                       baseKey = (legacyKey != null ? legacyKey : key) + "." + 
mapperName + ".mapping.";
+                       functionType = props.getProperty(baseKey + "type");
+                       
+                       if (functionType == null) {
+                               // Try with Cytoscape v2.3 calculator names...
+                               if 
(baseKey.startsWith("nodeFillColorCalculator.")) {
+                                       legacyKey = "nodeColorCalculator";
+                               } else if 
(baseKey.startsWith("edgeSourceArrowCalculator.") || 
+                                                  
baseKey.startsWith("edgeTargetArrowCalculator.")) {
+                                       legacyKey = "edgeArrowCalculator";
+                               } else {
+                                       return null;
+                               }
                        }
                }
                
                String attrName = props.getProperty(baseKey + "controller");
+               
+               if (attrName == null)
+                       return null;
 
                // "ID" is actually the "name" column!!!
                if ("ID".equalsIgnoreCase(attrName)) attrName = "name";

-- 
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