Author: mes
Date: 2010-08-10 15:14:47 -0700 (Tue, 10 Aug 2010)
New Revision: 21291
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayout.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayout.java
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
changed how CyDataTables are managed for networks
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayout.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayout.java
2010-08-10 21:51:34 UTC (rev 21290)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayout.java
2010-08-10 22:14:47 UTC (rev 21291)
@@ -177,10 +177,9 @@
int r = (int) Math.sqrt(count);
r *= spacing;
- if (this.attribute != null){
- CyDataTable dataTable =
network.getCyDataTables("NODE").get(namespace);
- Class<?> klass =
dataTable.getColumnTypeMap().get(attribute);
- if (Comparable.class.isAssignableFrom(klass)){
+ if (this.attribute != null && count > 0) {
+ Class<?> klass =
nodes.get(0).getNode().getCyRow(namespace).contains(attribute);
+ if (klass != null &&
Comparable.class.isAssignableFrom(klass)){
// FIXME: I assume this would be better, but
get type errors if I try:
//Class<Comparable<?>> kasted =
(Class<Comparable<?>>) klass;
//Collections.sort(nodes, new
AttributeComparator<Comparable<?>>(kasted));
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayout.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayout.java
2010-08-10 21:51:34 UTC (rev 21290)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayout.java
2010-08-10 22:14:47 UTC (rev 21291)
@@ -10,6 +10,7 @@
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyTableManager;
import org.cytoscape.work.UndoSupport;
import java.util.ArrayList;
@@ -24,11 +25,15 @@
public class DegreeSortedCircleLayout extends AbstractGraphPartition {
private static final String DEGREE_ATTR_NAME = "degree";
+
+ private CyTableManager tableMgr;
+
/**
* Creates a new DegreeSortedCircleLayout object.
*/
- public DegreeSortedCircleLayout(UndoSupport undoSupport) {
+ public DegreeSortedCircleLayout(UndoSupport undoSupport, CyTableManager
tableMgr) {
super(undoSupport);
+ this.tableMgr = tableMgr;
}
/**
@@ -56,8 +61,8 @@
*/
public void layoutPartion(LayoutPartition partition) {
// Create attribute
-
if(network.getCyDataTables(NODE).get(CyNetwork.DEFAULT_ATTRS).getUniqueColumns().contains(DEGREE_ATTR_NAME)
== false) {
-
network.getCyDataTables(NODE).get(CyNetwork.DEFAULT_ATTRS).createColumn(DEGREE_ATTR_NAME,
+ if(tableMgr.getTableMap(NODE,
network).get(CyNetwork.DEFAULT_ATTRS).getUniqueColumns().contains(DEGREE_ATTR_NAME)
== false) {
+ tableMgr.getTableMap(NODE,
network).get(CyNetwork.DEFAULT_ATTRS).createColumn(DEGREE_ATTR_NAME,
Double.class, false);
}
Modified:
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-08-10 21:51:34 UTC (rev 21290)
+++
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-08-10 22:14:47 UTC (rev 21291)
@@ -40,4 +40,8 @@
interface="org.cytoscape.work.UndoSupport">
</osgi:reference>
+ <osgi:reference id="cyTableManagerServiceRef"
+ interface="org.cytoscape.model.CyTableManager">
+ </osgi:reference>
+
</beans>
Modified:
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-08-10 21:51:34 UTC (rev 21290)
+++
core3/layout-cytoscape-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-08-10 22:14:47 UTC (rev 21291)
@@ -33,6 +33,7 @@
<bean id="degreeSortedCircleLayout"
class="csplugins.layout.algorithms.graphPartition.DegreeSortedCircleLayout">
<constructor-arg ref="undoSupportServiceRef"/>
+ <constructor-arg ref="cyTableManagerServiceRef"/>
</bean>
<bean id="ISOMLayout"
class="csplugins.layout.algorithms.graphPartition.ISOMLayout">
--
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.