Author: Christian Lopes
Date: 2011-03-09 15:16:47 -0800 (Wed, 09 Mar 2011)
New Revision: 24352

Modified:
   
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerImpl.java
   
core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerTest.java
Log:
Fixed bug that prevented node/edge LabelColor mappings from being parsed.

Modified: 
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerImpl.java
===================================================================
--- 
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerImpl.java
        2011-03-09 23:06:27 UTC (rev 24351)
+++ 
core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerImpl.java
        2011-03-09 23:16:47 UTC (rev 24352)
@@ -187,6 +187,7 @@
 
                     if 
(t3.matches("nodeSizeLocked|arrowColorMatchesEdge|nodeLabelColorFromNodeColor|"
                                    + 
"defaultNodeShowNestedNetwork|nodeCustomGraphicsSizeSync|"
+                                   + "((node|edge)LabelColor)|"
                                    + "((node|edge)[a-zA-Z]+Calculator)|"
                                    + 
"(default(Node|Edge|Background|SloppySelection)[a-zA-Z0-9]+)")) {
                         // It looks like the second token is the style name!
@@ -229,7 +230,7 @@
 
         if (key != null) {
             b |= key.matches("(node|edge)AppearanceCalculator\\.[^\\.]+\\."
-                             + 
"\\1((CustomGraphics(Position)?\\d+)|([a-zA-Z]+Calculator))");
+                             + 
"\\1((CustomGraphics(Position)?\\d+)|LabelColor|([a-zA-Z]+Calculator))");
         }
 
         return b;
@@ -327,10 +328,39 @@
 // TODO: refactor and make it public
 class CalcConverter {
 
+    /** This type corresponds to java.lang.Boolean. */
     public final byte TYPE_BOOLEAN = 1;
+    /** This type corresponds to java.lang.Double. */
     public final byte TYPE_FLOATING_POINT = 2;
+    /** This type corresponds to java.lang.Integer. */
     public final byte TYPE_INTEGER = 3;
+    /** This type corresponds to java.lang.String. */
     public final byte TYPE_STRING = 4;
+    /** This type corresponds to an attribute which has not been defined. */
+    public final byte TYPE_UNDEFINED = -1;
+    /**
+     * This type corresponds to a 'simple' list.
+     * <P>
+     * A 'simple' list is defined as follows:
+     * <UL>
+     * <LI>All items within the list are of the same type, and are chosen
+     * from one of the following: <CODE>Boolean</CODE>, <CODE>Integer</CODE>,
+     * <CODE>Double</CODE> or <CODE>String</CODE>.
+     * </UL>
+     */
+    public final byte TYPE_SIMPLE_LIST = -2;
+    /**
+     * This type corresponds to a 'simple' hash map.
+     * <P>
+     * A 'simple' map is defined as follows:
+     * <UL>
+     * <LI>All keys within the map are of type:  <CODE>String</CODE>.
+     * <LI>All values within the map are of the same type, and are chosen
+     * from one of the following: <CODE>Boolean</CODE>, <CODE>Integer</CODE>,
+     * <CODE>Double</CODE> or <CODE>String</CODE>.
+     * </UL>
+     */
+    public final byte TYPE_SIMPLE_MAP = -3;
 
     private static final Map<Class<? extends CyTableEntry>, Map<String, 
CalcConverter>> converters;
 
@@ -436,6 +466,7 @@
                             dataValue = Integer.parseInt(sk);
                             break;
                         default:
+                            // TODO: Always handle List type as String?
                             break;
                     }
 

Modified: 
core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerTest.java
===================================================================
--- 
core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerTest.java
        2011-03-09 23:06:27 UTC (rev 24351)
+++ 
core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/internal/VisualStyleSerializerTest.java
        2011-03-09 23:16:47 UTC (rev 24352)
@@ -196,6 +196,7 @@
         
assertTrue(VisualStyleSerializerImpl.isMappingFunction("nodeAppearanceCalculator.My
 style.nodeCustomGraphics1"));
         
assertTrue(VisualStyleSerializerImpl.isMappingFunction("nodeAppearanceCalculator.My
 style.nodeCustomGraphicsPosition4"));
         
assertTrue(VisualStyleSerializerImpl.isMappingFunction("edgeAppearanceCalculator.default.edgeColorCalculator"));
+        
assertTrue(VisualStyleSerializerImpl.isMappingFunction("nodeAppearanceCalculator.galFiltered
 Style.nodeLabelColor"));
         
         
assertFalse(VisualStyleSerializerImpl.isMappingFunction("nodeAppearanceCalculator.My
 style.nodeSizeLocked"));
         
assertFalse(VisualStyleSerializerImpl.isMappingFunction("nodeAppearanceCalculator.My
 style.defaultNodeShowNestedNetwork"));

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