Commits

Anonymous committed d4d367d

Fix right click handling, removed runtime dependency of DefaultVariableResolver on oscore.
Updated jgraph to 5.8.0

Comments (0)

Files changed (6)

lib/designer/jgraph.jar

Binary file modified.

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

 package com.opensymphony.workflow.designer;
 
 import java.awt.*;
+import java.awt.event.MouseEvent;
 import java.awt.geom.Rectangle2D;
 import java.awt.datatransfer.DataFlavor;
 import java.awt.datatransfer.Transferable;
 import com.opensymphony.workflow.designer.layout.SugiyamaLayoutAlgorithm;
 import com.opensymphony.workflow.loader.*;
 import org.jgraph.JGraph;
+import org.jgraph.plaf.basic.BasicGraphUI;
 import org.jgraph.graph.*;
 
 public class WorkflowGraph extends JGraph implements DropTargetListener
     super(model);
     setMarqueeHandler(new WorkflowMarqueeHandler(this));
     getGraphLayoutCache().setFactory(new WorkflowCellViewFactory());
-    getGraphLayoutCache().setSelectsAllInsertedCells(false);
+    getGraphLayoutCache().setSelectsAllInsertedCells(false); 
+    getGraphLayoutCache().setSelectsLocalInsertedCells(false);
     ToolTipManager.sharedInstance().registerComponent(this);
     this.layout = layout;
     setDescriptor(descriptor);
     actions.add(createSplit);
     JMenu g = new JMenu(ResourceManager.getString("grid.size"));
     genericMenu.add(g);
-    g.add(new SetGridSize(this, menuLocation, 1));
-    g.add(new SetGridSize(this, menuLocation, 2));
-    g.add(new SetGridSize(this, menuLocation, 4));
-    g.add(new SetGridSize(this, menuLocation, 8));
-    g.add(new SetGridSize(this, menuLocation, 12));
-    g.add(new SetGridSize(this, menuLocation, 16));
+    g.add(new SetGridSize(this, 1));
+    g.add(new SetGridSize(this, 2));
+    g.add(new SetGridSize(this, 4));
+    g.add(new SetGridSize(this, 8));
+    g.add(new SetGridSize(this, 12));
+    g.add(new SetGridSize(this, 16));
 
     cellMenu = new JPopupMenu();
     Delete delete = new Delete(descriptor, this, menuLocation);
     new DropTarget(this, this);
   }
 
+  public void updateUI() {
+    setUI(new BasicGraphUI()
+    {
+      public boolean isToggleSelectionEvent(MouseEvent e)
+      {
+        return false;
+      }
+    });
+    invalidate();
+  }
+  
   public String convertValueToString(Object value)
   {
     if(value == null) return null;

src/designer/com/opensymphony/workflow/designer/actions/ResultEdgeColor.java

 
 import java.awt.*;
 import java.awt.event.ActionEvent;
+import java.util.Map;
+import java.util.HashMap;
 import javax.swing.*;
 
-import com.opensymphony.workflow.designer.ResultEdge;
 import com.opensymphony.workflow.designer.WorkflowGraph;
 import org.jgraph.graph.CellView;
 import org.jgraph.graph.GraphConstants;
     public void actionPerformed(ActionEvent e)
     {
       Object cell = graph.getFirstCellForLocation(location.x, location.y);
-      if(cell == null)
-      {
-        return;
-      }
-      else
+      if(cell != null)
       {
         CellView view = graph.getGraphLayoutCache().getMapping(cell, false);
         if(graph.getModel().isEdge(cell))
         {
-          GraphConstants.setForeground(((ResultEdge)cell).getAttributes(), color);
-          view.update();
-          view.refresh(graph.getModel(), graph.getGraphLayoutCache(), false);
-          graph.getSelectionModel().setSelectionCell(view.getCell());
+          Map map = new HashMap(1);
+          GraphConstants.setForeground(map, color);
+          GraphConstants.setLineColor(map, color);
+          graph.getGraphLayoutCache().edit(new Object[]{view.getCell()}, map);
         }
       }
     }

src/designer/com/opensymphony/workflow/designer/actions/ResultEdgeLineWidth.java

 
 import java.awt.*;
 import java.awt.event.ActionEvent;
+import java.util.Map;
+import java.util.HashMap;
 import javax.swing.*;
 
 import com.opensymphony.workflow.designer.ResultEdge;
     public void actionPerformed(ActionEvent e)
     {
       Object cell = graph.getFirstCellForLocation(location.x, location.y);
-      if(cell == null)
-      {
-        return;
-      }
-      else
+      if(cell != null)
       {
         CellView view = (graph.getGraphLayoutCache().getMapping(cell, false));
         if(graph.getModel().isEdge(cell))
         {
+          Map map = new HashMap(1);
           GraphConstants.setLineWidth(((ResultEdge)cell).getAttributes(), width);
-          view.update();
-          view.refresh(graph.getModel(), graph.getGraphLayoutCache(), false);
-          graph.getSelectionModel().setSelectionCell(view.getCell());
+          graph.getGraphLayoutCache().edit(new Object[]{view.getCell()}, map);
         }
       }
     }

src/designer/com/opensymphony/workflow/designer/actions/SetGridSize.java

 
 public class SetGridSize extends JMenuItem
 {
-	SetGridSizeWidthHandler customHandler;
+  SetGridSizeWidthHandler customHandler;
 
-  class SetGridSizeWidthHandler extends AbstractAction
+  static class SetGridSizeWidthHandler extends AbstractAction
   {
-	private WorkflowGraph graph;
-	private Point location;
-	private int iSize;
+    private WorkflowGraph graph;
+    private int iSize;
 
-	SetGridSizeWidthHandler(WorkflowGraph graph, Point location, int gridSize, String name)
-	{
-	  super(name);
-	  this.graph = graph;
-	  this.location = location;
-	  this.iSize = gridSize;
-	}
+    SetGridSizeWidthHandler(WorkflowGraph graph, int gridSize, String name)
+    {
+      super(name);
+      this.graph = graph;
+      this.iSize = gridSize;
+    }
 
-	public void actionPerformed(ActionEvent e)
-	{
-	  graph.setGridVisible(iSize>1);
-	  graph.setGridSize(iSize);
-	}
+    public void actionPerformed(ActionEvent e)
+    {
+      graph.setGridVisible(iSize > 1);
+      graph.setGridSize(iSize);
+    }
   }
 
-  public SetGridSize(WorkflowGraph graph, Point location, int gridSize)
+  public SetGridSize(WorkflowGraph graph, int gridSize)
   {
-	super(gridSize>1 ? gridSize + " pt" : ResourceManager.getString("grid.disable"));
-	setIcon(new GridIcon(gridSize));
-	customHandler = new SetGridSizeWidthHandler(graph, location, gridSize, this.getName());
-	addActionListener(customHandler);
+    super(gridSize > 1 ? gridSize + " pt" : ResourceManager.getString("grid.disable"));
+    setIcon(new GridIcon(gridSize));
+    customHandler = new SetGridSizeWidthHandler(graph, gridSize, this.getName());
+    addActionListener(customHandler);
   }
 
   class GridIcon implements Icon
   {
-	private int gridSize;
+    private int gridSize;
 
-	public GridIcon(int gridSize)
-	{
-	  this.gridSize = gridSize;
-	}
+    public GridIcon(int gridSize)
+    {
+      this.gridSize = gridSize;
+    }
 
-	public void paintIcon(Component c, Graphics g, int x, int y)
-	{
-	  g.setColor(Color.WHITE);
-	  g.fillRect(1, 1, getIconWidth(), getIconHeight() - 2);
-	  int gridStep = 2;
-	  g.setColor(new Color(220, 220, 220));
-	  if (gridSize>1)
-	  {
-		  while (gridStep<getIconWidth())
-		  {
-		  	g.drawLine(gridStep, 1, gridStep, getIconHeight() - 2);
-			g.drawLine(1, gridStep, getIconWidth(), gridStep);
-			gridStep += gridSize;
-		  }
-	  }
-	  g.setColor(Color.GRAY);
-	  g.drawRect(1, 1, getIconWidth(), getIconHeight() - 2);
-	}
+    public void paintIcon(Component c, Graphics g, int x, int y)
+    {
+      g.setColor(Color.WHITE);
+      g.fillRect(1, 1, getIconWidth(), getIconHeight() - 2);
+      int gridStep = 2;
+      g.setColor(new Color(220, 220, 220));
+      if(gridSize > 1)
+      {
+        while(gridStep < getIconWidth())
+        {
+          g.drawLine(gridStep, 1, gridStep, getIconHeight() - 2);
+          g.drawLine(1, gridStep, getIconWidth(), gridStep);
+          gridStep += gridSize;
+        }
+      }
+      g.setColor(Color.GRAY);
+      g.drawRect(1, 1, getIconWidth(), getIconHeight() - 2);
+    }
 
-	public int getIconWidth()
-	{
-	  return 20;
-	}
+    public int getIconWidth()
+    {
+      return 20;
+    }
 
-	public int getIconHeight()
-	{
-	  return getHeight();
-	}
+    public int getIconHeight()
+    {
+      return getHeight();
+    }
   }
 
 }

src/java/com/opensymphony/workflow/util/DefaultVariableResolver.java

 
     //~ Instance fields ////////////////////////////////////////////////////////
 
-    private transient BeanProvider beanProvider = null;
+  //this is an Object to avoid the designer having a dependency on oscore
+    private transient Object beanProvider = null;
 
     //~ Methods ////////////////////////////////////////////////////////////////
 
     }
 
     public BeanProvider getBeanProvider() {
-        return beanProvider;
+        return (BeanProvider)beanProvider;
     }
 
     public Object getVariableFromMaps(String var, Map transientVars, PropertySet ps) {
                 beanProvider = new DefaultBeanProvider();
             }
 
-            o = beanProvider.getProperty(o, var.substring(firstDot + 1));
+            o = ((BeanProvider)beanProvider).getProperty(o, var.substring(firstDot + 1));
         }
 
         return o;