Author: Christian Lopes
Date: 2011-03-08 15:14:08 -0800 (Tue, 08 Mar 2011)
New Revision: 24339

Modified:
   
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
Log:
Quick fix for the VizMapper UI code that builds the discrete mapping entries 
from List-type attributes (may need to be improved!)

Modified: 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
===================================================================
--- 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
 2011-03-08 23:07:31 UTC (rev 24338)
+++ 
core3/vizmap-gui-impl/trunk/src/main/java/org/cytoscape/view/vizmap/gui/internal/VizMapPropertyBuilder.java
 2011-03-08 23:14:08 UTC (rev 24339)
@@ -201,8 +201,15 @@
                                
                                if (column != null) {
                                        final Class<?> attrClass = 
column.getType();
-                                       Object id = row.get(attrName, 
attrClass);
+                                       Object id = null;
                                        
+                                       if 
(attrClass.isAssignableFrom(List.class)) {
+                                               id = row.getList(attrName, 
column.getListElementType());
+                                               if (id != null) id = ((List) 
id).toString();
+                                       } else {
+                                               id = row.get(attrName, 
attrClass);
+                                       }
+                                       
                                        if (id != null)
                                                attrSet.add((K) id);
                                }
@@ -254,6 +261,8 @@
        
                                        if (attrName.equals("SUID"))
                                                value = go.getSUID();
+                                       else if 
(attrClass.isAssignableFrom(List.class))
+                                               value = 
go.getCyRow().getList(attrName, column.getListElementType());
                                        else
                                                value = 
go.getCyRow().get(attrName, attrClass);
        
@@ -262,18 +271,20 @@
                                        else
                                                stringVal = null;
        
-                                       final VizMapperProperty<String, V, 
VisualMappingFunction<K, V>> oneProperty = new VizMapperProperty<String, V, 
VisualMappingFunction<K, V>>(
-                                                       CellType.DISCRETE, id, 
(Class<V>) value.getClass());
-                                       
oneProperty.setInternalValue(visualMapping);
-                                       oneProperty.setValue(stringVal);
-       
-                                       // This prop. should not be editable!
-                                       oneProperty.setEditable(false);
-       
-                                       
oneProperty.setParentProperty(topProperty);
-                                       oneProperty.setDisplayName(id);
-       
-                                       topProperty.addSubProperty(oneProperty);
+                                       if (value != null) {
+                                               final VizMapperProperty<String, 
V, VisualMappingFunction<K, V>> oneProperty = new VizMapperProperty<String, V, 
VisualMappingFunction<K, V>>(
+                                                               
CellType.DISCRETE, id, (Class<V>) value.getClass());
+                                               
oneProperty.setInternalValue(visualMapping);
+                                               oneProperty.setValue(stringVal);
+               
+                                               // This prop. should not be 
editable!
+                                               oneProperty.setEditable(false);
+               
+                                               
oneProperty.setParentProperty(topProperty);
+                                               oneProperty.setDisplayName(id);
+               
+                                               
topProperty.addSubProperty(oneProperty);
+                                       }
                                }
                        }
 

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