Author: pwang
Date: 2010-07-23 16:10:32 -0700 (Fri, 23 Jul 2010)
New Revision: 21016
Modified:
cytoscape/trunk/src/cytoscape/data/readers/VisualStyleBuilder.java
Log:
Fixed bug: 0002254: xgmml import corrupts on .cys save
Modified: cytoscape/trunk/src/cytoscape/data/readers/VisualStyleBuilder.java
===================================================================
--- cytoscape/trunk/src/cytoscape/data/readers/VisualStyleBuilder.java
2010-07-23 21:33:18 UTC (rev 21015)
+++ cytoscape/trunk/src/cytoscape/data/readers/VisualStyleBuilder.java
2010-07-23 23:10:32 UTC (rev 21016)
@@ -120,20 +120,29 @@
public void buildStyle() {
// First, get our current style information.
VisualMappingManager vm = Cytoscape.getVisualMappingManager();
- VisualStyle currentStyle = vm.getVisualStyle();
- NodeAppearanceCalculator nac = new
NodeAppearanceCalculator(currentStyle.getNodeAppearanceCalculator());
- EdgeAppearanceCalculator eac = new
EdgeAppearanceCalculator(currentStyle.getEdgeAppearanceCalculator());
- GlobalAppearanceCalculator gac = new
GlobalAppearanceCalculator(currentStyle.getGlobalAppearanceCalculator());
+
+ String styleName = name + " style";
+
+ // Create the new style
+ final VisualStyle graphStyle = new VisualStyle(styleName);
+ final List<Calculator> calcs = new
ArrayList<Calculator>(vm.getCalculatorCatalog()
+
.getCalculators());
+ final Calculator dummy = calcs.get(0);
+ graphStyle.getNodeAppearanceCalculator().setCalculator(dummy);
+ NodeAppearanceCalculator nac =
graphStyle.getNodeAppearanceCalculator();
+ EdgeAppearanceCalculator eac =
graphStyle.getEdgeAppearanceCalculator();
+ GlobalAppearanceCalculator gac =
graphStyle.getGlobalAppearanceCalculator();
+
if (backgroundColor != null)
gac.setDefaultBackgroundColor(backgroundColor);
- currentStyle.getDependency().set(NODE_SIZE_LOCKED,
nodeSizeLocked);
+ graphStyle.getDependency().set(NODE_SIZE_LOCKED,
nodeSizeLocked);
processCounts();
for ( VisualPropertyType type : valueMaps.keySet() ) {
-
+
Map<Object,Object> valMap = valueMaps.get(type);
// If there is more than one value specified for a given
@@ -161,12 +170,18 @@
// and then remove the attribute that was created.
} else {
if ( type.isNodeProp() ) {
- for ( Object key : valMap.keySet() )
+ for ( Object key : valMap.keySet() ) {
+
+ System.out.println("Node key =
"+key);
+
nac.getDefaultAppearance().set(
type, valMap.get(key) );
+ }
Cytoscape.getNodeAttributes().deleteAttribute(getAttrName(type));
} else {
- for ( Object key : valMap.keySet() )
+ for ( Object key : valMap.keySet() ) {
+ System.out.println("Edge key =
"+key);
eac.getDefaultAppearance().set(
type, valMap.get(key) );
+ }
Cytoscape.getEdgeAttributes().deleteAttribute(getAttrName(type));
}
}
@@ -175,10 +190,6 @@
VisualMappingManager vizmapper =
Cytoscape.getVisualMappingManager();
CalculatorCatalog catalog = vizmapper.getCalculatorCatalog();
- String styleName = name + " style";
-
- VisualStyle graphStyle = new VisualStyle(styleName, nac, eac,
gac);
-
// Remove this in case we've already loaded this network once
catalog.removeVisualStyle(styleName);
--
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.