Author: rodche
Date: 2012-10-09 13:12:45 -0700 (Tue, 09 Oct 2012)
New Revision: 30638

Modified:
   
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
Log:
Made "force-directed" the default layout for BioPAX views.

Modified: 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
===================================================================
--- 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-10-09 19:36:02 UTC (rev 30637)
+++ 
core3/impl/trunk/biopax-impl/src/main/java/org/cytoscape/biopax/internal/action/BioPaxViewTracker.java
      2012-10-09 20:12:45 UTC (rev 30638)
@@ -107,15 +107,19 @@
                                        bioPaxVisualStyle.apply(view);
                                        view.updateView();
                                        
-                                       String pref = 
CyLayoutAlgorithmManager.DEFAULT_LAYOUT_NAME;
+                                       String pref = 
CyLayoutAlgorithmManager.DEFAULT_LAYOUT_NAME; //min. fall-back
                                        if (prop != null)
-                                               pref = 
prop.getProperties().getProperty("preferredLayoutAlgorithm", pref);
-                                       final CyLayoutAlgorithm layout = 
layoutAlgorithmManager.getLayout(pref);                                        
-                               final Object context = 
layout.getDefaultLayoutContext();
-                                       taskManagerRef.execute(
-                                       layout.createTaskIterator(view, 
context, CyLayoutAlgorithm.ALL_NODE_VIEWS,""));
+                                               pref = 
prop.getProperties().getProperty("preferredLayoutAlgorithm", "force-directed");
+                                       final CyLayoutAlgorithm layout = 
layoutAlgorithmManager.getLayout(pref);
+                                       if (layout != null) {
+                                               final Object context = 
layout.getDefaultLayoutContext();
+                                               taskManagerRef.execute(
+                                               layout.createTaskIterator(view, 
context, CyLayoutAlgorithm.ALL_NODE_VIEWS,""));
+                                       } else {
+                                               throw new 
IllegalArgumentException("Couldn't find layout algorithm: " + pref);
+                                       }                       
                                                                        
-//not yet migrated                     // set tooltips
+// not yet migrated to cy3....   - set tooltips
 //                             setNodeToolTips(view);                          
                                // add node's context menu
                                // TODO: NodeViewTaskFactory?

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