Anonymous avatar Anonymous committed 94f5d7b

More editor cleanup

Comments (0)

Files changed (7)

src/designer/com/opensymphony/workflow/designer/WorkflowGraph.java

 import com.opensymphony.workflow.designer.dnd.DragData;
 import com.opensymphony.workflow.designer.layout.LayoutAlgorithm;
 import com.opensymphony.workflow.designer.layout.SugiyamaLayoutAlgorithm;
+import com.opensymphony.workflow.designer.views.StepView;
 import com.opensymphony.workflow.loader.*;
 import org.jgraph.JGraph;
 import org.jgraph.plaf.basic.BasicGraphUI;
     {
       return ((EdgeView)value).getCell().toString();
     }
-    else
+    else if(value instanceof VertexView)
     {
-      return value.toString();
+      return ((VertexView)value).getCell().toString();
     }
+    return value.toString();
   }
 
 	public WorkflowDescriptor getDescriptor()

src/designer/com/opensymphony/workflow/designer/views/CustomEdgeView.java

     }
   }
 
-  public class CustomEdgeHandle extends EdgeHandle
+  public static class CustomEdgeHandle extends EdgeHandle
   {
 
     CustomEdgeHandle(EdgeView edge, GraphContext ctx)

src/designer/com/opensymphony/workflow/designer/views/EdgeRouter.java

-package com.opensymphony.workflow.designer.views;
-
-import java.awt.Point;
-import java.awt.geom.Point2D;
-import java.awt.geom.Rectangle2D;
-import java.util.List;
-
-import org.jgraph.graph.Edge;
-import org.jgraph.graph.EdgeView;
-import org.jgraph.graph.PortView;
-
-import com.opensymphony.workflow.designer.WorkflowPort;
-
-/**
- * User: Hani Suleiman
- * Date: Oct 16, 2003
- * Time: 1:45:47 PM
- */
-public class EdgeRouter implements Edge.Routing
-{
-  public List route(EdgeView edgeView)
-  {
-    return null;
-  }
-
-  public int getPreferredLineStyle(EdgeView edgeView)
-  {
-    return 0;
-  }
-
-  public void route(EdgeView edge, java.util.List points)
-  {
-    PortView sourceView = (PortView)edge.getSource();
-    PortView targetView = (PortView)edge.getTarget();
-    if(sourceView==null || targetView==null) return;
-
-    WorkflowPort sourcePort = (WorkflowPort)sourceView.getCell();
-    WorkflowPort targetPort = (WorkflowPort)targetView.getCell();
-    Point2D from = sourceView.getLocation();
-    Point2D to = targetView.getLocation();
-    //check if this is a dup route
-//    Collection duplicates = new HashSet();
-//    if(sourcePort!=targetPort)
-//    {
-//      Iterator iter = sourcePort.edges();
-//      while(iter.hasNext())
-//      {
-//        Edge e = (Edge)iter.next();
-//        if(e.getTarget()==sourcePort && e.getSource()==targetPort && e!=edge.getCell())
-//        {
-//          duplicates.add(e);
-//          System.out.println("detected duplicate line for edge " + e);
-//        }
-//      }
-//    }
-    if(from != null && to != null)
-    {
-      Point[] routed;
-      // Handle self references
-      if(sourcePort == targetPort)
-      {
-        Rectangle2D bounds = sourceView.getParentView().getBounds();
-        int size = 35;
-        routed = new Point[4];
-        routed[0] = new Point((int)(bounds.getX() + bounds.getWidth()), (int)(bounds.getY() + bounds.getHeight()));
-        routed[1] = new Point((int)(bounds.getX() + bounds.getWidth()), (int)(bounds.getY() + bounds.getHeight() + size));
-        routed[2] = new Point((int)(bounds.getX() + size + bounds.getWidth()), (int)(bounds.getY() + bounds.getHeight() + size));
-        routed[3] = new Point((int)(bounds.getX() + size + bounds.getWidth()), (int)(bounds.getY() + bounds.getHeight()));
-      }
-      else
-      {
-        double dx = Math.abs(from.getX() - to.getX());
-        double dy = Math.abs(from.getY() - to.getY());
-        double x2 = from.getX() + ((to.getX() - from.getX()) / 2);
-        double y2 = from.getY() + ((to.getY() - from.getY()) / 2);
-        routed = new Point[2];
-        if(dx > dy)
-        {
-          routed[0] = new Point((int)x2, (int)from.getY());
-          routed[1] = new Point((int)x2, (int)to.getY());
-        }
-        else
-        {
-          routed[0] = new Point((int)from.getX(), (int)y2);
-          routed[1] = new Point((int)to.getX(), (int)y2);
-        }
-      }
-      // Set/Add Points
-      for(int i = 0; i < routed.length; i++)
-        if(points.size() > i + 2)
-          points.set(i + 1, routed[i]);
-        else
-          points.add(i + 1, routed[i]);
-      // Remove spare points
-      while(points.size() > routed.length + 2)
-      {
-        points.remove(points.size() - 2);
-      }
-    }
-  }
-
-}

src/designer/com/opensymphony/workflow/designer/views/InitialActionView.java

 package com.opensymphony.workflow.designer.views;
 
-import java.awt.*;
-import java.awt.geom.Rectangle2D;
-
 import org.jgraph.graph.CellViewRenderer;
 import org.jgraph.graph.VertexView;
 
 public class InitialActionView extends VertexView
 {
-  private Object cell;
   private static final InitialActionRenderer renderer = new InitialActionRenderer();
 
   public InitialActionView(Object cell)
   {
     super(cell);
-    this.cell = cell;
-  }
-
-  public String toString()
-  {
-    return cell.toString();
-  }
-
-  /**
-   * Returns the intersection of the bounding rectangle and the
-   * straight line between the source and the specified point p.
-   * The specified point is expected not to intersect the bounds.
-   */
-  public Point getPerimeterPoint(Point source, Point p)
-  {
-    // Compute relative bounds
-    Rectangle2D r = getBounds();
-    double a = (r.getWidth() + 1) / 2;
-    double b = (r.getHeight() + 1) / 2;
-
-    // Get center
-    int xCenter = (int)r.getCenterX();
-    int yCenter = (int)r.getCenterY();
-
-    // Compute angle
-    int dx = p.x - xCenter;
-    int dy = p.y - yCenter;
-    double t = Math.atan2(dy, dx);
-
-    // Compute Perimeter Point
-    int xout = xCenter + (int)(a * Math.cos(t)) - 1;
-    int yout = yCenter + (int)(b * Math.sin(t)) - 1;
-
-    // Return perimeter point
-    return new Point(xout, yout);
   }
 
   public CellViewRenderer getRenderer()

src/designer/com/opensymphony/workflow/designer/views/JoinView.java

   {
     return renderer;
   }
-
-  public String toString()
-  {
-    return cell.toString();
-  }
 }

src/designer/com/opensymphony/workflow/designer/views/SplitView.java

   {
     return renderer;
   }
-
-  public String toString()
-  {
-    return cell.toString();
-  }
 }

src/designer/com/opensymphony/workflow/designer/views/StepView.java

   {
     return renderer;
   }
-
-  public String toString()
-  {
-    return cell.toString();
-  }
-
 }
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.