Author: mes
Date: 2011-04-29 17:12:34 -0700 (Fri, 29 Apr 2011)
New Revision: 24875
Added:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractBasicLayoutTask.java
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractPartitionLayoutTask.java
Removed:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractGraphPartition.java
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/LayoutTask.java
Modified:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/internal/algorithms/GridNodeLayoutTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/GroupAttributesLayoutTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/StackedNodeLayoutTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/bioLayout/BioLayoutAlgorithm.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayoutTask.java
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/DegreeSortedCircleLayoutTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/ISOMLayoutTask.java
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/hierarchicalLayout/HierarchicalLayoutAlgorithmTask.java
core3/layout-jgraph-impl/trunk/src/main/java/csplugins/layout/JGraphLayoutWrapperTask.java
core3/layout-prefuse-impl/trunk/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayoutTask.java
Log:
Renamed several classes in Layout API to be more sensible.
Copied:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractBasicLayoutTask.java
(from rev 24863,
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/LayoutTask.java)
===================================================================
---
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractBasicLayoutTask.java
(rev 0)
+++
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractBasicLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -0,0 +1,84 @@
+package org.cytoscape.view.layout;
+
+
+import java.util.Set;
+
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyRow;
+import org.cytoscape.model.CyTable;
+
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.View;
+
+import org.cytoscape.work.AbstractTask;
+import org.cytoscape.work.TaskMonitor;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * This is a basic implementation of a LayoutAlgorithm Task that does
+ * some bookkeeping, but primarily delegates to the doLayout() method.
+ * Extensions of this class are meant to operate on the CyNetworkView
+ * provided to the constructor (and is available as a protected member
+ * variable).
+ */
+public abstract class AbstractBasicLayoutTask extends AbstractTask {
+
+ private static final Logger logger =
LoggerFactory.getLogger(AbstractBasicLayoutTask.class);
+ protected static final String LAYOUT_ALGORITHM = "layoutAlgorithm";
+
+ protected final CyNetworkView networkView;
+ protected final boolean selectedOnly;
+ protected final Set<View<CyNode>> staticNodes;
+
+ private final String name;
+
+ public AbstractBasicLayoutTask(final CyNetworkView networkView, final
String name, boolean selectedOnly,
+ final Set<View<CyNode>> staticNodes)
+ {
+ super();
+
+ this.networkView = networkView;
+ this.name = name;
+ this.selectedOnly = selectedOnly;
+ this.staticNodes = staticNodes;
+ }
+
+ @Override
+ public final void run(final TaskMonitor taskMonitor) {
+ final long start = System.currentTimeMillis();
+ logger.debug("Layout Start: " + name);
+
+ // do some sanity checking
+ if (networkView == null)
+ return;
+
+ final CyNetwork network = networkView.getModel();
+ if (network.getNodeCount() <= 0)
+ return;
+
+ // this is overridden by children and does the actual layout
+ doLayout(taskMonitor);
+
+ // Fit Content method always redraw the presentation.
+ networkView.fitContent();
+
+ // update the __layoutAlgorithm attribute
+ final CyRow networkAttributes =
network.getCyRow(CyNetwork.HIDDEN_ATTRS);
+ final CyTable netAttrsTable = networkAttributes.getTable();
+ if (netAttrsTable.getColumn(LAYOUT_ALGORITHM) == null)
+ netAttrsTable.createColumn(LAYOUT_ALGORITHM,
String.class, true);
+ networkAttributes.set(LAYOUT_ALGORITHM, name);
+
+ logger.debug("Layout finished: " +
(System.currentTimeMillis()-start) + " msec.");
+ }
+
+
+ protected boolean isLocked(View<CyNode> v) {
+ return ((staticNodes != null) && (staticNodes.contains(v)));
+ }
+
+ protected abstract void doLayout(final TaskMonitor taskMonitor);
+}
Deleted:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractGraphPartition.java
===================================================================
---
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractGraphPartition.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractGraphPartition.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -1,214 +0,0 @@
-package org.cytoscape.view.layout;
-
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.model.View;
-import org.cytoscape.work.TaskMonitor;
-
-
-/**
- * An abstract class that handles the partitioning of graphs so that
- * the partitions will be laid out individually.
- */
-public abstract class AbstractGraphPartition extends LayoutTask {
- protected TaskMonitor taskMonitor;
-
- double incr = 100;
- protected List <LayoutPartition> partitionList = null;
- protected EdgeWeighter edgeWeighter = null;
- private boolean singlePartition;
-
- // Information for taskMonitor
- double current_start = 0; // Starting node number
- double current_size = 0; // Partition size
- double total_nodes = 0; // Total number of nodes
-
- /**
- * Creates a new AbstractGraphPartition object.
- */
- public AbstractGraphPartition(final CyNetworkView networkView, final
String name,
- final boolean singlePartition,
- final boolean selectedOnly, final
Set<View<CyNode>> staticNodes) {
- super(networkView, name, selectedOnly, staticNodes);
- this.singlePartition = singlePartition;
- }
-
- /**
- * Override this method and layout the LayoutPartion just
- * like you would a NetworkView.
- *
- * @param partition The LayoutPartion to be laid out.
- */
- public abstract void layoutPartion(LayoutPartition partition);
-
- /**
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
- */
- public boolean supportsSelectedOnly() {
- return true;
- }
-
- /**
- * Sets the singlePartition flag, which disables partitioning. This
- * can be used by users who do not want to partition their graph for
- * some reason.
- *
- * @param partitioning if false, no paritioning will be done
- */
- public void setPartition(final boolean partitioning) {
- singlePartition = !partitioning;
- }
-
- /**
- * Sets the singlePartition flag, which disables partitioning. This
- * can be used by users who do not want to partition their graph for
- * some reason.
- *
- * @param value if "false", no paritioning will be done
- */
- public void setPartition(String value) {
- Boolean val = new Boolean(value);
- setPartition(val.booleanValue());
- }
-
- /**
- * DOCUMENT ME!
- *
- * @param percent The percentage of completion for this partition
- */
- protected void setTaskStatus(int percent) {
- if (taskMonitor != null) {
- // Calculate the nodes done for this partition
- double nodesDone = current_size*(double)percent/100.;
- // Calculate the percent done overall
- double pDone = (nodesDone+current_start)/total_nodes;
- taskMonitor.setProgress(pDone);
- taskMonitor.setStatusMessage("Completed " + (int)pDone
+ "%");
- }
- }
-
- /**
- * AbstractGraphPartitionLayout implements the constuct method
- * and calls layoutPartion for each partition.
- */
- public void doLayout(final TaskMonitor taskMonitor, final CyNetwork
network) {
- if (edgeWeighter != null)
- edgeWeighter.reset();
-
- this.taskMonitor = taskMonitor;
-
- // Depending on whether we are partitioned or not,
- // we use different initialization. Note that if the user only
wants
- // to lay out selected nodes, partitioning becomes a very bad
idea!
- if (selectedOnly || singlePartition) {
- // We still use the partition abstraction, even if we're
- // not partitioning. This makes the code further down
- // much cleaner
- LayoutPartition partition = new
LayoutPartition(networkView, selectedOnly, edgeWeighter);
- partition.setTaskMonitor(taskMonitor);
- partitionList = new ArrayList(1);
- partitionList.add(partition);
- } else if (staticNodes != null && staticNodes.size() > 0) {
- // Someone has programmatically locked a set of nodes
-- construct
- // the list of unlocked nodes
- List<CyNode> unlockedNodes = new ArrayList();
- for (CyNode node: network.getNodeList()) {
- if (!isLocked(networkView.getNodeView(node))) {
- unlockedNodes.add(node);
- }
- }
- LayoutPartition partition = new
LayoutPartition(networkView, unlockedNodes, edgeWeighter);
- partitionList = new ArrayList(1);
- partitionList.add(partition);
- } else {
- partitionList = PartitionUtil.partition(networkView,
false, edgeWeighter);
- }
-
- total_nodes = network.getNodeCount();
- current_start = 0;
-
- // Set up offsets -- we start with the overall min and max
- double xStart = (partitionList.get(0)).getMinX();
- double yStart = (partitionList.get(0)).getMinY();
-
- for (LayoutPartition part: partitionList) {
- xStart = Math.min(xStart, part.getMinX());
- yStart = Math.min(yStart, part.getMinY());
- }
-
- double next_x_start = xStart;
- double next_y_start = yStart;
- double current_max_y = 0;
-
- double max_dimensions = Math.sqrt((double)
network.getNodeCount());
- // give each node room
- max_dimensions *= incr;
- max_dimensions += xStart;
-
-
- for (LayoutPartition partition: partitionList) {
- if (cancelled)
- break;
-
- // get the partition
- current_size = (double)partition.size();
- // System.out.println("Partition
#"+partition.getPartitionNumber()+" has "+current_size+" nodes");
- setTaskStatus(1);
-
- // Partitions Requiring Layout
- if (partition.nodeCount() > 1) {
- try {
- layoutPartion(partition);
- } catch (Throwable _e) {
- _e.printStackTrace();
- return;
- }
-
- if (!selectedOnly && !singlePartition) {
- // System.out.println("Offsetting partition
#"+partition.getPartitionNumber()+" to "+next_x_start+", "+next_y_start);
- // OFFSET
- partition.offset(next_x_start, next_y_start);
- }
-
- // single nodes
- } else if ( partition.nodeCount() == 1 ) {
- // Reset our bounds
- partition.resetNodes();
-
- // Single node -- get it
- LayoutNode node = (LayoutNode)
partition.getNodeList().get(0);
- node.setLocation(next_x_start, next_y_start);
- partition.moveNodeToLocation(node);
- } else {
- continue;
- }
-
- double last_max_x = partition.getMaxX();
- double last_max_y = partition.getMaxY();
-
- if (last_max_y > current_max_y) {
- current_max_y = last_max_y;
- }
-
- if (last_max_x > max_dimensions) {
- next_x_start = xStart;
- next_y_start = current_max_y;
- next_y_start += incr;
- } else {
- next_x_start = last_max_x;
- next_x_start += incr;
- }
-
- setTaskStatus( 100 );
- current_start += current_size;
- }
- }
-}
Copied:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractPartitionLayoutTask.java
(from rev 24863,
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractGraphPartition.java)
===================================================================
---
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractPartitionLayoutTask.java
(rev 0)
+++
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/AbstractPartitionLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -0,0 +1,218 @@
+package org.cytoscape.view.layout;
+
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.view.model.CyNetworkView;
+import org.cytoscape.view.model.View;
+import org.cytoscape.work.TaskMonitor;
+
+/**
+ * This is a more helpful implementation of a LayoutAlgorithm Task
+ * that extends AbstractBasicLayoutTask and does the work of partitioning
+ * the CyNetworkView so that partitions may be laid out individually.
+ * Extensions of this class are meant to implement the layoutPartition()
+ * method and operate on the LayoutParition object that is passed to that
+ * method as an argument.
+ */
+public abstract class AbstractPartitionLayoutTask extends
AbstractBasicLayoutTask {
+ protected TaskMonitor taskMonitor;
+
+ double incr = 100;
+ protected List <LayoutPartition> partitionList = null;
+ protected EdgeWeighter edgeWeighter = null;
+ private boolean singlePartition;
+
+ // Information for taskMonitor
+ double current_start = 0; // Starting node number
+ double current_size = 0; // Partition size
+ double total_nodes = 0; // Total number of nodes
+
+ /**
+ * Creates a new AbstractPartitionLayoutTask object.
+ */
+ public AbstractPartitionLayoutTask(final CyNetworkView networkView,
final String name,
+ final boolean singlePartition,
+ final boolean selectedOnly, final
Set<View<CyNode>> staticNodes) {
+ super(networkView, name, selectedOnly, staticNodes);
+ this.singlePartition = singlePartition;
+ }
+
+ /**
+ * Override this method and layout the LayoutPartion just
+ * like you would a NetworkView.
+ *
+ * @param partition The LayoutPartion to be laid out.
+ */
+ public abstract void layoutPartion(LayoutPartition partition);
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @return DOCUMENT ME!
+ */
+ public boolean supportsSelectedOnly() {
+ return true;
+ }
+
+ /**
+ * Sets the singlePartition flag, which disables partitioning. This
+ * can be used by users who do not want to partition their graph for
+ * some reason.
+ *
+ * @param partitioning if false, no paritioning will be done
+ */
+ public void setPartition(final boolean partitioning) {
+ singlePartition = !partitioning;
+ }
+
+ /**
+ * Sets the singlePartition flag, which disables partitioning. This
+ * can be used by users who do not want to partition their graph for
+ * some reason.
+ *
+ * @param value if "false", no paritioning will be done
+ */
+ public void setPartition(String value) {
+ Boolean val = new Boolean(value);
+ setPartition(val.booleanValue());
+ }
+
+ /**
+ * DOCUMENT ME!
+ *
+ * @param percent The percentage of completion for this partition
+ */
+ protected void setTaskStatus(int percent) {
+ if (taskMonitor != null) {
+ // Calculate the nodes done for this partition
+ double nodesDone = current_size*(double)percent/100.;
+ // Calculate the percent done overall
+ double pDone = (nodesDone+current_start)/total_nodes;
+ taskMonitor.setProgress(pDone);
+ taskMonitor.setStatusMessage("Completed " + (int)pDone
+ "%");
+ }
+ }
+
+ /**
+ * AbstractGraphPartitionLayout implements the constuct method
+ * and calls layoutPartion for each partition.
+ */
+ public void doLayout(final TaskMonitor taskMonitor) {
+ final CyNetwork network = networkView.getModel();
+ if (edgeWeighter != null)
+ edgeWeighter.reset();
+
+ this.taskMonitor = taskMonitor;
+
+ // Depending on whether we are partitioned or not,
+ // we use different initialization. Note that if the user only
wants
+ // to lay out selected nodes, partitioning becomes a very bad
idea!
+ if (selectedOnly || singlePartition) {
+ // We still use the partition abstraction, even if we're
+ // not partitioning. This makes the code further down
+ // much cleaner
+ LayoutPartition partition = new
LayoutPartition(networkView, selectedOnly, edgeWeighter);
+ partition.setTaskMonitor(taskMonitor);
+ partitionList = new ArrayList(1);
+ partitionList.add(partition);
+ } else if (staticNodes != null && staticNodes.size() > 0) {
+ // Someone has programmatically locked a set of nodes
-- construct
+ // the list of unlocked nodes
+ List<CyNode> unlockedNodes = new ArrayList();
+ for (CyNode node: network.getNodeList()) {
+ if (!isLocked(networkView.getNodeView(node))) {
+ unlockedNodes.add(node);
+ }
+ }
+ LayoutPartition partition = new
LayoutPartition(networkView, unlockedNodes, edgeWeighter);
+ partitionList = new ArrayList(1);
+ partitionList.add(partition);
+ } else {
+ partitionList = PartitionUtil.partition(networkView,
false, edgeWeighter);
+ }
+
+ total_nodes = network.getNodeCount();
+ current_start = 0;
+
+ // Set up offsets -- we start with the overall min and max
+ double xStart = (partitionList.get(0)).getMinX();
+ double yStart = (partitionList.get(0)).getMinY();
+
+ for (LayoutPartition part: partitionList) {
+ xStart = Math.min(xStart, part.getMinX());
+ yStart = Math.min(yStart, part.getMinY());
+ }
+
+ double next_x_start = xStart;
+ double next_y_start = yStart;
+ double current_max_y = 0;
+
+ double max_dimensions = Math.sqrt((double)
network.getNodeCount());
+ // give each node room
+ max_dimensions *= incr;
+ max_dimensions += xStart;
+
+
+ for (LayoutPartition partition: partitionList) {
+ if (cancelled)
+ break;
+
+ // get the partition
+ current_size = (double)partition.size();
+ // System.out.println("Partition
#"+partition.getPartitionNumber()+" has "+current_size+" nodes");
+ setTaskStatus(1);
+
+ // Partitions Requiring Layout
+ if (partition.nodeCount() > 1) {
+ try {
+ layoutPartion(partition);
+ } catch (Throwable _e) {
+ _e.printStackTrace();
+ return;
+ }
+
+ if (!selectedOnly && !singlePartition) {
+ // System.out.println("Offsetting partition
#"+partition.getPartitionNumber()+" to "+next_x_start+", "+next_y_start);
+ // OFFSET
+ partition.offset(next_x_start, next_y_start);
+ }
+
+ // single nodes
+ } else if ( partition.nodeCount() == 1 ) {
+ // Reset our bounds
+ partition.resetNodes();
+
+ // Single node -- get it
+ LayoutNode node = (LayoutNode)
partition.getNodeList().get(0);
+ node.setLocation(next_x_start, next_y_start);
+ partition.moveNodeToLocation(node);
+ } else {
+ continue;
+ }
+
+ double last_max_x = partition.getMaxX();
+ double last_max_y = partition.getMaxY();
+
+ if (last_max_y > current_max_y) {
+ current_max_y = last_max_y;
+ }
+
+ if (last_max_x > max_dimensions) {
+ next_x_start = xStart;
+ next_y_start = current_max_y;
+ next_y_start += incr;
+ } else {
+ next_x_start = last_max_x;
+ next_x_start += incr;
+ }
+
+ setTaskStatus( 100 );
+ current_start += current_size;
+ }
+ }
+}
Deleted:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/LayoutTask.java
===================================================================
---
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/LayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/LayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -1,78 +0,0 @@
-package org.cytoscape.view.layout;
-
-
-import java.util.Set;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.model.CyRow;
-import org.cytoscape.model.CyTable;
-
-import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.model.View;
-
-import org.cytoscape.work.AbstractTask;
-import org.cytoscape.work.TaskMonitor;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public abstract class LayoutTask extends AbstractTask {
-
- private static final Logger logger =
LoggerFactory.getLogger(LayoutTask.class);
- protected static final String LAYOUT_ALGORITHM = "layoutAlgorithm";
-
- protected final CyNetworkView networkView;
- protected final boolean selectedOnly;
- protected final Set<View<CyNode>> staticNodes;
-
- private final String name;
-
- public LayoutTask(final CyNetworkView networkView, final String name,
boolean selectedOnly,
- final Set<View<CyNode>> staticNodes)
- {
- super();
-
- this.networkView = networkView;
- this.name = name;
- this.selectedOnly = selectedOnly;
- this.staticNodes = staticNodes;
- }
-
- @Override
- public final void run(final TaskMonitor taskMonitor) {
- final long start = System.currentTimeMillis();
- logger.debug("Layout Start: " + name);
-
- // do some sanity checking
- if (networkView == null)
- return;
-
- final CyNetwork network = networkView.getModel();
- if (network.getNodeCount() <= 0)
- return;
-
- // this is overridden by children and does the actual layout
- doLayout(taskMonitor, network);
-
- // Fit Content method always redraw the presentation.
- networkView.fitContent();
-
- // update the __layoutAlgorithm attribute
- final CyRow networkAttributes =
network.getCyRow(CyNetwork.HIDDEN_ATTRS);
- final CyTable netAttrsTable = networkAttributes.getTable();
- if (netAttrsTable.getColumn(LAYOUT_ALGORITHM) == null)
- netAttrsTable.createColumn(LAYOUT_ALGORITHM,
String.class, true);
- networkAttributes.set(LAYOUT_ALGORITHM, name);
-
- logger.debug("Layout finished: " +
(System.currentTimeMillis()-start) + " msec.");
- }
-
-
- protected boolean isLocked(View<CyNode> v) {
- return ((staticNodes != null) && (staticNodes.contains(v)));
- }
-
- protected abstract void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network);
-}
Modified:
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/internal/algorithms/GridNodeLayoutTask.java
===================================================================
---
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/internal/algorithms/GridNodeLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-api/trunk/src/main/java/org/cytoscape/view/layout/internal/algorithms/GridNodeLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -35,7 +35,7 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.LayoutTask;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.model.VisualProperty;
@@ -48,7 +48,7 @@
* The GridNodeLayout provides a very simple layout, suitable as
* the default layout for Cytoscape data readers.
*/
-public class GridNodeLayoutTask extends LayoutTask {
+public class GridNodeLayoutTask extends AbstractBasicLayoutTask {
private final double nodeVerticalSpacing;
private final double nodeHorizontalSpacing;
@@ -70,12 +70,13 @@
* This creates the default square layout.
*/
@Override
- final protected void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network) {
+ final protected void doLayout(final TaskMonitor taskMonitor) {
double currX = 0.0d;
double currY = 0.0d;
double initialX = 0.0d;
double initialY = 0.0d;
int columns;
+ final CyNetwork network = networkView.getModel();
final VisualProperty<Double> xLoc =
MinimalVisualLexicon.NODE_X_LOCATION;
final VisualProperty<Double> yLoc =
MinimalVisualLexicon.NODE_Y_LOCATION;
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/GroupAttributesLayoutTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/GroupAttributesLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/GroupAttributesLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -10,7 +10,7 @@
import java.util.TreeMap;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.LayoutTask;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
@@ -21,7 +21,7 @@
import org.cytoscape.model.CyTableEntry;
import org.cytoscape.model.CyTableManager;
-public class GroupAttributesLayoutTask extends LayoutTask {
+public class GroupAttributesLayoutTask extends AbstractBasicLayoutTask {
//@Tunable(description="Horizontal spacing between two partitions in a
row")
public double spacingx;
@@ -61,9 +61,9 @@
- final protected void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network) {
+ final protected void doLayout(final TaskMonitor taskMonitor) {
this.taskMonitor = taskMonitor;
- this.network = network;
+ this.network = networkView.getModel();
construct();
}
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/StackedNodeLayoutTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/StackedNodeLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/StackedNodeLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -7,13 +7,13 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
-import org.cytoscape.view.layout.LayoutTask;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
import org.cytoscape.work.TaskMonitor;
-public class StackedNodeLayoutTask extends LayoutTask {
+public class StackedNodeLayoutTask extends AbstractBasicLayoutTask {
private double y_start_position;
private double x_position;
@@ -36,14 +36,14 @@
}
- final protected void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network) {
+ final protected void doLayout(final TaskMonitor taskMonitor) {
if (selectedOnly){
nodes =
CyTableUtil.getNodesInState(networkView.getModel(),"selected",true);
}
else {
// select all nodes from the view
- nodes = network.getNodeList();
+ nodes = networkView.getModel().getNodeList();
}
construct();
}
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/bioLayout/BioLayoutAlgorithm.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/bioLayout/BioLayoutAlgorithm.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/bioLayout/BioLayoutAlgorithm.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -38,7 +38,7 @@
import java.util.Set;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.EdgeWeighter;
import org.cytoscape.view.layout.LayoutPartition;
import org.cytoscape.view.model.CyNetworkView;
@@ -53,7 +53,7 @@
* @author <a href="mailto:[email protected]">Scooter Morris</a>
* @version 0.9
*/
-public abstract class BioLayoutAlgorithm extends AbstractGraphPartition {
+public abstract class BioLayoutAlgorithm extends AbstractPartitionLayoutTask {
/**
* Properties
*/
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/circularLayout/CircularLayoutAlgorithmTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -7,7 +7,7 @@
import java.util.Set;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.LayoutEdge;
import org.cytoscape.view.layout.LayoutNode;
import org.cytoscape.view.layout.LayoutPartition;
@@ -21,7 +21,7 @@
import csplugins.layout.algorithms.hierarchicalLayout.Graph;
-public class CircularLayoutAlgorithmTask extends AbstractGraphPartition {
+public class CircularLayoutAlgorithmTask extends AbstractPartitionLayoutTask {
public int nodeHorizontalSpacing; // = 64;
public int nodeVerticalSpacing;// = 32;
public int leftEdge;// = 32;
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayoutTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/AttributeCircleLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -9,7 +9,7 @@
import org.cytoscape.model.CyColumn;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.LayoutNode;
import org.cytoscape.view.layout.LayoutPartition;
import org.cytoscape.view.model.CyNetworkView;
@@ -17,7 +17,7 @@
import org.cytoscape.work.Tunable;
-public class AttributeCircleLayoutTask extends AbstractGraphPartition {
+public class AttributeCircleLayoutTask extends AbstractPartitionLayoutTask {
private final String attribute;
private final double spacing;
private final boolean supportNodeAttributes;
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
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayout.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -10,7 +10,7 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableManager;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.AbstractLayoutAlgorithm;
import org.cytoscape.view.layout.LayoutNode;
import org.cytoscape.view.layout.LayoutPartition;
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayoutTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/DegreeSortedCircleLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -12,7 +12,7 @@
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableManager;
import org.cytoscape.model.CyTable;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.LayoutNode;
import org.cytoscape.view.layout.LayoutPartition;
import org.cytoscape.view.model.CyNetworkView;
@@ -20,7 +20,7 @@
import org.cytoscape.model.CyTableEntry;
-public class DegreeSortedCircleLayoutTask extends AbstractGraphPartition {
+public class DegreeSortedCircleLayoutTask extends AbstractPartitionLayoutTask {
private String DEGREE_ATTR_NAME = "degree";
private CyTableManager tableMgr;
private CyNetwork network;
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/ISOMLayoutTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/ISOMLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/graphPartition/ISOMLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -7,7 +7,7 @@
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.LayoutNode;
import org.cytoscape.view.layout.LayoutPartition;
import org.cytoscape.view.model.CyNetworkView;
@@ -21,7 +21,7 @@
import cern.colt.matrix.DoubleMatrix1D;
import cern.colt.matrix.impl.DenseDoubleMatrix1D;
-public class ISOMLayoutTask extends AbstractGraphPartition {
+public class ISOMLayoutTask extends AbstractPartitionLayoutTask {
public int maxEpoch;
private int epoch;
Modified:
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/hierarchicalLayout/HierarchicalLayoutAlgorithmTask.java
===================================================================
---
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/hierarchicalLayout/HierarchicalLayoutAlgorithmTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-cytoscape-impl/trunk/src/main/java/csplugins/layout/algorithms/hierarchicalLayout/HierarchicalLayoutAlgorithmTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -12,7 +12,7 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.CyTableUtil;
-import org.cytoscape.view.layout.LayoutTask;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
@@ -21,7 +21,7 @@
-public class HierarchicalLayoutAlgorithmTask extends LayoutTask {
+public class HierarchicalLayoutAlgorithmTask extends AbstractBasicLayoutTask {
private int nodeHorizontalSpacing;
private int nodeVerticalSpacing;
@@ -61,9 +61,9 @@
* This creates the default square layout.
*/
@Override
- final protected void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network) {
+ final protected void doLayout(final TaskMonitor taskMonitor) {
this.taskMonitor = taskMonitor;
- this.network = network;
+ this.network = networkView.getModel();
construct();
}
Modified:
core3/layout-jgraph-impl/trunk/src/main/java/csplugins/layout/JGraphLayoutWrapperTask.java
===================================================================
---
core3/layout-jgraph-impl/trunk/src/main/java/csplugins/layout/JGraphLayoutWrapperTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-jgraph-impl/trunk/src/main/java/csplugins/layout/JGraphLayoutWrapperTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -12,7 +12,7 @@
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.LayoutTask;
+import org.cytoscape.view.layout.AbstractBasicLayoutTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.View;
import org.cytoscape.view.presentation.property.MinimalVisualLexicon;
@@ -31,7 +31,7 @@
import org.jgraph.plugins.layouts.JGraphLayoutAlgorithm;
import org.jgraph.plugins.layouts.JGraphLayoutSettings;
-public class JGraphLayoutWrapperTask extends LayoutTask{
+public class JGraphLayoutWrapperTask extends AbstractBasicLayoutTask{
private JGraphLayoutAlgorithm layout = null;
private JGraphLayoutSettings layoutSettings = null;
@@ -59,9 +59,9 @@
* Perform actual layout task.
*/
@Override
- final protected void doLayout(final TaskMonitor taskMonitor, final
CyNetwork network) {
+ final protected void doLayout(final TaskMonitor taskMonitor) {
this.taskMonitor = taskMonitor;
- this.network = network;
+ this.network = networkView.getModel();
construct();
}
Modified:
core3/layout-prefuse-impl/trunk/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayoutTask.java
===================================================================
---
core3/layout-prefuse-impl/trunk/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayoutTask.java
2011-04-29 23:45:20 UTC (rev 24874)
+++
core3/layout-prefuse-impl/trunk/src/main/java/org/cytoscape/prefuse/layouts/internal/ForceDirectedLayoutTask.java
2011-04-30 00:12:34 UTC (rev 24875)
@@ -37,7 +37,7 @@
import java.util.Set;
import org.cytoscape.model.CyNode;
-import org.cytoscape.view.layout.AbstractGraphPartition;
+import org.cytoscape.view.layout.AbstractPartitionLayoutTask;
import org.cytoscape.view.layout.EdgeWeighter;
import org.cytoscape.view.layout.LayoutEdge;
import org.cytoscape.view.layout.LayoutNode;
@@ -61,7 +61,7 @@
* This class wraps the Prefuse force-directed layout algorithm.
* See {@link http://prefuse.org} for more detail.
*/
-public class ForceDirectedLayoutTask extends AbstractGraphPartition {
+public class ForceDirectedLayoutTask extends AbstractPartitionLayoutTask {
private ForceSimulator m_fsim;
public int numIterations;
--
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.