Author: clopes
Date: 2012-05-18 15:41:55 -0700 (Fri, 18 May 2012)
New Revision: 29298

Modified:
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleEdge.java
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleNode.java
   
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/ContinuousMappingEditorPanel.java
Log:
Fixes #1010 : When load session from 2.8.2, Cytoscape throws a lot of exceptions

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleEdge.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleEdge.java
    2012-05-18 17:27:19 UTC (rev 29297)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleEdge.java
    2012-05-18 22:41:55 UTC (rev 29298)
@@ -114,7 +114,6 @@
                                        edge = manager.createEdge(sourceNode, 
targetNode, id, label, directed);
                                } else if (curNet instanceof CySubNetwork && 
!curNet.containsEdge(edge)) {
                                        ((CySubNetwork) curNet).addEdge(edge);
-                                       manager.setCurrentElement(edge);
                                }
                                
                                if (!manager.isSessionFormat() || 
manager.getDocumentVersion() < 3.0) {
@@ -135,6 +134,9 @@
                                                row.set(CyEdge.INTERACTION, 
interaction);
                                        }
                                }
+                               
+                               manager.setCurrentElement(edge);
+                               
                        } else {
                                throw new SAXException("Cannot create edge from 
XGMML (id=" + id + " label=" + label + " source=" +
                                                                           
sourceId + " target=" + targetId + "): source or target node not found");

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleNode.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleNode.java
    2012-05-18 17:27:19 UTC (rev 29297)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/HandleNode.java
    2012-05-18 22:41:55 UTC (rev 29298)
@@ -79,6 +79,9 @@
                        }
                }
                
+               if (node != null)
+                       manager.setCurrentElement(node);
+               
                return current;
        }
 }

Modified: 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
===================================================================
--- 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
       2012-05-18 17:27:19 UTC (rev 29297)
+++ 
core3/impl/trunk/io-impl/impl/src/main/java/org/cytoscape/io/internal/read/xgmml/handler/ReadDataManager.java
       2012-05-18 22:41:55 UTC (rev 29298)
@@ -426,8 +426,6 @@
                node = this.getCurrentNetwork().addNode();
         }
         
-        this.setCurrentElement(node);
-        
         // Add to internal cache:
         cache.cache(oldId, node);
         cache.cacheNodeByName(label, node);
@@ -477,7 +475,6 @@
                }
                
                edge = net.addEdge(actualSrc, actualTgt, directed);
-               this.setCurrentElement(edge);
         }
         
         // Add to internal cache:

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/ContinuousMappingEditorPanel.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/ContinuousMappingEditorPanel.java
        2012-05-18 17:27:19 UTC (rev 29297)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/mappingeditor/ContinuousMappingEditorPanel.java
        2012-05-18 22:41:55 UTC (rev 29298)
@@ -123,11 +123,8 @@
        final JPanel mainPanel;
 
        /**
-        * 
-        * Creates new form ContinuousMapperEditorPanel Accepts only one visual
-        * property type T.
-        * 
-        * */
+        * Creates new form ContinuousMapperEditorPanel Accepts only one visual 
property type T.
+        */
        public ContinuousMappingEditorPanel(final VisualStyle style, final 
ContinuousMapping<K, V> mapping,
                        final CyTable table, final CyApplicationManager 
appManager, final VisualMappingManager vmm) {
                if (mapping == null)
@@ -150,9 +147,12 @@
                
                //TODO more error checking
                final CyColumn col = table.getColumn(controllingAttrName);
-               if(col == null)
-                       throw new NullPointerException("No such column exists 
in the given table.");
                
+               if (col == null) {
+                       throw new NullPointerException("The column \"" + 
controllingAttrName + "\" does not exist in the \""
+                                       + table.getTitle() + "\" table");
+               }
+               
                final Class<?> attrType = col.getType();
 
                logger.debug("Selected attr type is " + attrType);
@@ -436,12 +436,12 @@
        abstract public ImageIcon drawIcon(int iconWidth, int iconHeight, 
boolean detail);
 
        private void initRangeValues() {
-
                // Set range values
                if (tracer.getRange(type) == 0) {
                        Double maxValue = Double.NEGATIVE_INFINITY;
                        Double minValue = Double.POSITIVE_INFINITY;
                        final List<K> valueList = 
dataTable.getColumn(mapping.getMappingColumnName()).getValues(this.dataType);
+                       
                        for (K val : valueList) {
                                if (val.doubleValue() > maxValue)
                                        maxValue = val.doubleValue();

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