Author: kono
Date: 2012-06-08 15:18:33 -0700 (Fri, 08 Jun 2012)
New Revision: 29514

Modified:
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/DVisualLexicon.java
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
Log:
fixes #1041 Custom graphics are now restored from old session files.

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/DVisualLexicon.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/DVisualLexicon.java
      2012-06-08 22:10:09 UTC (rev 29513)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/DVisualLexicon.java
      2012-06-08 22:18:33 UTC (rev 29514)
@@ -415,21 +415,38 @@
 
        private void createLookupMap() {
                // XGMML:
-               addIdentifierMapping(CyEdge.class, "sourceArrowColor",
-                               EDGE_SOURCE_ARROW_UNSELECTED_PAINT);
-               addIdentifierMapping(CyEdge.class, "targetArrowColor",
-                               EDGE_TARGET_ARROW_UNSELECTED_PAINT);
+               addIdentifierMapping(CyEdge.class, "sourceArrowColor", 
EDGE_SOURCE_ARROW_UNSELECTED_PAINT);
+               addIdentifierMapping(CyEdge.class, "targetArrowColor", 
EDGE_TARGET_ARROW_UNSELECTED_PAINT);
 
                // 2.x VizMap Properties:
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics1", 
NODE_CUSTOMGRAPHICS_1);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics2", 
NODE_CUSTOMGRAPHICS_2);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics3", 
NODE_CUSTOMGRAPHICS_3);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics4", 
NODE_CUSTOMGRAPHICS_4);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics5", 
NODE_CUSTOMGRAPHICS_5);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics6", 
NODE_CUSTOMGRAPHICS_6);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics7", 
NODE_CUSTOMGRAPHICS_7);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics8", 
NODE_CUSTOMGRAPHICS_8);
+               addIdentifierMapping(CyNode.class, "nodeCustomGraphics9", 
NODE_CUSTOMGRAPHICS_9);
+               
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition1", NODE_CUSTOMGRAPHICS_POSITION_1);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition2", NODE_CUSTOMGRAPHICS_POSITION_2);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition3", NODE_CUSTOMGRAPHICS_POSITION_3);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition4", NODE_CUSTOMGRAPHICS_POSITION_4);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition5", NODE_CUSTOMGRAPHICS_POSITION_5);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition6", NODE_CUSTOMGRAPHICS_POSITION_6);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition7", NODE_CUSTOMGRAPHICS_POSITION_7);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition8", NODE_CUSTOMGRAPHICS_POSITION_8);
+               addIdentifierMapping(CyNode.class, 
"nodeCustomGraphicsPosition9", NODE_CUSTOMGRAPHICS_POSITION_9);
+               
+               
                // TODO: missing node properties
                // 
addIdentifierMapping(CyNode.class,"nodeLabelOpacity",NODE_LABEL_TRANSPARENCY);
                // 
addIdentifierMapping(CyNode.class,"nodeBorderOpacity",NODE_BORDER_TRANSPARENCY);
                // 
addIdentifierMapping(CyNode.class,"nodeLabelWidth",NODE_LABEL_WIDTH);
-               
-               addIdentifierMapping(CyEdge.class, "edgeSourceArrowColor",
-                               EDGE_SOURCE_ARROW_UNSELECTED_PAINT);
-               addIdentifierMapping(CyEdge.class, "edgeTargetArrowColor",
-                               EDGE_TARGET_ARROW_UNSELECTED_PAINT);
+
+               addIdentifierMapping(CyEdge.class, "edgeSourceArrowColor", 
EDGE_SOURCE_ARROW_UNSELECTED_PAINT);
+               addIdentifierMapping(CyEdge.class, "edgeTargetArrowColor", 
EDGE_TARGET_ARROW_UNSELECTED_PAINT);
                // TODO: missing edge properties
                // 
addIdentifierMapping(CyEdge.class,"edgeLabelOpacity",EDGE_LABEL_TRANSPARENCY);
                // 
addIdentifierMapping(CyEdge.class,"edgeLabelWidth",EDGE_LABEL_WIDTH);

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
    2012-06-08 22:10:09 UTC (rev 29513)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/visualproperty/CustomGraphicsVisualProperty.java
    2012-06-08 22:18:33 UTC (rev 29514)
@@ -23,9 +23,10 @@
        @Override
        public CyCustomGraphics<CustomGraphic> parseSerializableString(String 
value) {
                // Return dummy if something is assigned.  This should be 
replaced after loading session.
-               if(NullCustomGraphics.getNullObject().toString().equals(value)) 
{
+               if(NullCustomGraphics.getNullObject().toString().equals(value) 
|| value.contains("NullCustomGraphics")) {
                        return NullCustomGraphics.getNullObject();
                } else {
+                       System.out.println("CG String = " + value);
                        final String[] parts = value.split(",");
                        return new 
DummyCustomGraphics(Long.parseLong(parts[1]), parts[2]);
                }

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