Author: clopes
Date: 2011-07-29 13:04:37 -0700 (Fri, 29 Jul 2011)
New Revision: 26336
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/GraphProxy.as
Log:
Fixed a data validation bug that was added in the previous change.
Modified:
cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/GraphProxy.as
===================================================================
--- cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/GraphProxy.as
2011-07-29 20:00:13 UTC (rev 26335)
+++ cytoscapeweb/trunk/cytoscapeweb/src/org/cytoscapeweb/model/GraphProxy.as
2011-07-29 20:04:37 UTC (rev 26336)
@@ -417,7 +417,7 @@
public function updateData(ds:DataSprite, data:Object):void {
if (ds != null && data != null) {
if (ds is EdgeSprite && ds.props.$merged) {
- throw new Error("It is not allowed to update a merged edge
data: " + ds.data.id);
+ throw new CWError("It is not allowed to update a merged
edge data: " + ds.data.id);
}
var schema:DataSchema = ds is NodeSprite ? _nodesSchema :
_edgesSchema;
@@ -440,7 +440,8 @@
ds.data[k] = v;
updated = true;
} else {
- throw new CWError("Cannot update data: there is no
Data Field for '"+k+"'.");
+ throw new CWError("Cannot update data: there is no
Data Field for '"+k+"'.",
+ ErrorCodes.MISSING_DATA_FIELD);
}
}
}
@@ -570,7 +571,7 @@
public function addNode(data:Object):NodeSprite {
if (data == null) data = {};
- normalizeData(data, Groups.EDGES);
+ normalizeData(data, Groups.NODES);
if (data.id == null) data.id = nextId(Groups.NODES);
else if (hasId(Groups.NODES, data.id)) throw new Error("Duplicate
node id ('"+data.id+"')");
@@ -582,7 +583,8 @@
}
public function addEdge(data:Object):EdgeSprite {
- if (data == null) throw new Error("The 'data' argument is
mandatory");
+ if (data == null) throw new CWError("The 'data' argument is
mandatory",
+
ErrorCodes.INVALID_DATA_CONVERSION);
trace("add edge: " + data.id);
normalizeData(data, Groups.EDGES);
@@ -595,7 +597,6 @@
if (data.id == null) data.id = nextId(Groups.EDGES);
else if (hasId(Groups.EDGES, data.id)) throw new Error("Duplicate
edge id ('"+data.id+"')");
-
// Create edge:
var e:EdgeSprite = graphData.addEdgeFor(src, tgt, data.directed,
data);
--
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.