Author: mes
Date: 2012-04-30 10:48:48 -0700 (Mon, 30 Apr 2012)
New Revision: 29041
Removed:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTask.java
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTaskFactoryImpl.java
Log:
removed edit code since it's now part of AbstractLayoutTask.
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
2012-04-30 17:43:17 UTC (rev 29040)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/CyActivator.java
2012-04-30 17:48:48 UTC (rev 29041)
@@ -261,7 +261,7 @@
ExportNetworkImageTaskFactoryImpl exportNetworkImageTaskFactory
= new
ExportNetworkImageTaskFactoryImpl(viewWriterManagerServiceRef,cyApplicationManagerServiceRef);
ExportNetworkViewTaskFactoryImpl exportNetworkViewTaskFactory =
new ExportNetworkViewTaskFactoryImpl(networkViewWriterManagerServiceRef,
tunableSetterServiceRef);
ExportSelectedTableTaskFactoryImpl
exportCurrentTableTaskFactory = new
ExportSelectedTableTaskFactoryImpl(cyTableWriterManagerRef,
cyTableManagerServiceRef, cyNetworkManagerServiceRef);
- ApplyPreferredLayoutTaskFactoryImpl
applyPreferredLayoutTaskFactory = new
ApplyPreferredLayoutTaskFactoryImpl(undoSupportServiceRef,cyEventHelperRef,cyLayoutsServiceRef,cyPropertyServiceRef);
+ ApplyPreferredLayoutTaskFactoryImpl
applyPreferredLayoutTaskFactory = new
ApplyPreferredLayoutTaskFactoryImpl(cyLayoutsServiceRef,cyPropertyServiceRef);
DeleteColumnTaskFactoryImpl deleteColumnTaskFactory = new
DeleteColumnTaskFactoryImpl(undoSupportServiceRef);
RenameColumnTaskFactoryImpl renameColumnTaskFactory = new
RenameColumnTaskFactoryImpl(undoSupportServiceRef, tunableSetterServiceRef);
CopyValueToEntireColumnTaskFactoryImpl
copyValueToEntireColumnTaskFactory = new
CopyValueToEntireColumnTaskFactoryImpl(undoSupportServiceRef);
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTask.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTask.java
2012-04-30 17:43:17 UTC (rev 29040)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTask.java
2012-04-30 17:48:48 UTC (rev 29041)
@@ -28,13 +28,11 @@
package org.cytoscape.task.internal.layout;
-import org.cytoscape.event.CyEventHelper;
import org.cytoscape.task.AbstractNetworkViewTask;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.layout.CyLayoutAlgorithmManager;
import org.cytoscape.view.layout.CyLayoutAlgorithm;
import org.cytoscape.work.TaskMonitor;
-import org.cytoscape.work.undo.UndoSupport;
import java.util.Properties;
@@ -42,20 +40,14 @@
public class ApplyPreferredLayoutTask extends AbstractNetworkViewTask {
private static final String DEF_LAYOUT = "force-directed";
- private final UndoSupport undoSupport;
- private final CyEventHelper eventHelper;
private Properties props;
private final CyLayoutAlgorithmManager layouts;
- public ApplyPreferredLayoutTask(final UndoSupport undoSupport,
- final CyEventHelper eventHelper,
- final CyNetworkView v,
+ public ApplyPreferredLayoutTask(final CyNetworkView v,
final CyLayoutAlgorithmManager layouts,
final Properties props)
{
super(v);
- this.undoSupport = undoSupport;
- this.eventHelper = eventHelper;
this.layouts = layouts;
this.props = props;
}
@@ -64,8 +56,6 @@
final CyLayoutAlgorithmManager layouts)
{
super(v);
- this.undoSupport = null;
- this.eventHelper = null;
this.layouts = layouts;
}
@@ -74,8 +64,6 @@
public void run(TaskMonitor tm) {
tm.setProgress(0.0d);
tm.setStatusMessage("Applying Default Layout...");
- if (undoSupport != null)
- undoSupport.postEdit(new LayoutEdit(eventHelper, view));
tm.setProgress(0.1);
String pref = CyLayoutAlgorithmManager.DEFAULT_LAYOUT_NAME;
if (props != null)
Modified:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTaskFactoryImpl.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTaskFactoryImpl.java
2012-04-30 17:43:17 UTC (rev 29040)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/ApplyPreferredLayoutTaskFactoryImpl.java
2012-04-30 17:48:48 UTC (rev 29041)
@@ -3,35 +3,27 @@
import java.util.Properties;
-import org.cytoscape.event.CyEventHelper;
import org.cytoscape.property.CyProperty;
import org.cytoscape.task.AbstractNetworkViewTaskFactory;
import org.cytoscape.task.visualize.ApplyPreferredLayoutTaskFactory;
import org.cytoscape.view.layout.CyLayoutAlgorithmManager;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.work.TaskIterator;
-import org.cytoscape.work.undo.UndoSupport;
public class ApplyPreferredLayoutTaskFactoryImpl extends
AbstractNetworkViewTaskFactory implements ApplyPreferredLayoutTaskFactory {
- private final UndoSupport undoSupport;
- private final CyEventHelper eventHelper;
+
private final CyLayoutAlgorithmManager layouts;
private final Properties props;
- public ApplyPreferredLayoutTaskFactoryImpl(final UndoSupport
undoSupport,
- final CyEventHelper eventHelper,
- final CyLayoutAlgorithmManager
layouts,
+ public ApplyPreferredLayoutTaskFactoryImpl(final
CyLayoutAlgorithmManager layouts,
final CyProperty<Properties> p)
{
- this.undoSupport = undoSupport;
- this.eventHelper = eventHelper;
this.layouts = layouts;
this.props = p.getProperties();
}
public TaskIterator createTaskIterator(CyNetworkView view) {
- return new TaskIterator(2, new
ApplyPreferredLayoutTask(undoSupport, eventHelper, view,
- layouts,
props));
+ return new TaskIterator(2, new ApplyPreferredLayoutTask(view,
layouts, props));
}
}
Deleted:
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
===================================================================
---
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
2012-04-30 17:43:17 UTC (rev 29040)
+++
core3/impl/trunk/core-task-impl/src/main/java/org/cytoscape/task/internal/layout/LayoutEdit.java
2012-04-30 17:48:48 UTC (rev 29041)
@@ -1,105 +0,0 @@
-package org.cytoscape.task.internal.layout;
-
-
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_X_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_Y_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NODE_Z_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_CENTER_X_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_CENTER_Y_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_CENTER_Z_LOCATION;
-import static
org.cytoscape.view.presentation.property.BasicVisualLexicon.NETWORK_SCALE_FACTOR;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import org.cytoscape.event.CyEventHelper;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.view.model.CyNetworkView;
-import org.cytoscape.view.model.View;
-import org.cytoscape.work.undo.AbstractCyEdit;
-
-
-/** An undoable edit that will undo and redo the zooming of a network view. */
-final class LayoutEdit extends AbstractCyEdit {
- private final CyEventHelper eventHelper;
- private final CyNetworkView view;
- private List<NodeViewAndLocations> nodeViewsAndLocations;
- private double networkScale;
- private double networkCenterX;
- private double networkCenterY;
- private double networkCenterZ;
-
- LayoutEdit(final CyEventHelper eventHelper, final CyNetworkView view) {
- super("Apply Preferred Layout");
-
- this.eventHelper = eventHelper;
- this.view = view;
-
- saveNodeViewsAndLocations();
- }
-
- public void redo() {
- ;
-
- saveAndRestore();
- }
-
- public void undo() {
- ;
-
- saveAndRestore();
- }
-
- private void saveAndRestore() {
- final List<NodeViewAndLocations> oldNodeViewsAndLocations =
nodeViewsAndLocations;
- final double oldNetworkScale = networkScale;
- final double oldNetworkCenterX = networkCenterX;
- final double oldNetworkCenterY = networkCenterY;
- final double oldNetworkCenterZ = networkCenterZ;
- saveNodeViewsAndLocations();
- for (final NodeViewAndLocations nodeViewAndLocation :
oldNodeViewsAndLocations)
- nodeViewAndLocation.restoreLocations();
-
- view.setVisualProperty(NETWORK_SCALE_FACTOR, oldNetworkScale);
- view.setVisualProperty(NETWORK_CENTER_X_LOCATION,
oldNetworkCenterX);
- view.setVisualProperty(NETWORK_CENTER_Y_LOCATION,
oldNetworkCenterY);
- view.setVisualProperty(NETWORK_CENTER_Z_LOCATION,
oldNetworkCenterZ);
-
- eventHelper.flushPayloadEvents();
- view.updateView();
- }
-
- private void saveNodeViewsAndLocations() {
- networkScale = view.getVisualProperty(NETWORK_SCALE_FACTOR);
- networkCenterX =
view.getVisualProperty(NETWORK_CENTER_X_LOCATION);
- networkCenterY =
view.getVisualProperty(NETWORK_CENTER_Y_LOCATION);
- networkCenterZ =
view.getVisualProperty(NETWORK_CENTER_Z_LOCATION);
-
- final Collection<View<CyNode>> nodeViews = view.getNodeViews();
- nodeViewsAndLocations = new
ArrayList<NodeViewAndLocations>(nodeViews.size());
- for (final View<CyNode> nodeView : nodeViews)
- nodeViewsAndLocations.add(new
NodeViewAndLocations(nodeView));
- }
-}
-
-
-final class NodeViewAndLocations {
- private final View<CyNode> nodeView;
- private final double xLocation;
- private final double yLocation;
- private final double zLocation;
-
- NodeViewAndLocations(final View<CyNode> nodeView) {
- this.nodeView = nodeView;
- xLocation = nodeView.getVisualProperty(NODE_X_LOCATION);
- yLocation = nodeView.getVisualProperty(NODE_Y_LOCATION);
- zLocation = nodeView.getVisualProperty(NODE_Z_LOCATION);
- }
-
- void restoreLocations() {
- nodeView.setVisualProperty(NODE_X_LOCATION, xLocation);
- nodeView.setVisualProperty(NODE_Y_LOCATION, yLocation);
- nodeView.setVisualProperty(NODE_Z_LOCATION, zLocation);
- }
-}
--
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.